Skip to content

Commit

Permalink
v17.4.6b
Browse files Browse the repository at this point in the history
- Bugfix for app startup on  Linux.
  • Loading branch information
EdenwareApps committed Jan 12, 2025
1 parent fdc0be8 commit 38625dc
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 60 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ android {
applicationId "tv.megacubo.app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionName '17.5.5'
versionName '17.5.6'
versionCode getVersionCodeFromVersionName(versionName)
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
Expand Down
114 changes: 74 additions & 40 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion www/nodejs/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ const init = async (language, timezone) => {
console.log('Initializing premium...')

const Premium = await import('./modules/premium-helper/premium-helper.js')
global.premium = new Premium.default()
if(Premium) {
const p = typeof(Premium.default) == 'function' ? Premium.default : Premium
global.premium = new p()
}

streamer.state.on('state', (url, state, source) => {
if (source) {
Expand Down
48 changes: 31 additions & 17 deletions www/nodejs/modules/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,41 @@ dayjs.locale = async locales => {
if (typeof(locales) == 'string') {
locales = [locales]
}
for (const locale of locales) {
const file = path.join(getDirname(), 'dayjs-locale', locale +'.js')
const dir = getDirname()
const run = (content, varName) => {
const context = {
global: {
[varName]: null
},
[varName]: null,
output: null
}
vm.createContext(context)
try {
console.log(`Loading locale ${file}`)

let scriptContent = await fs.promises.readFile(file, 'utf8')
scriptContent = 'output='+ (scriptContent.
replace(new RegExp('(^.*|,)[a-z] ?=', 'm'), '').
replace(new RegExp(';[^;]*return.*$', 'm'), ''))
const context = {output: null}
const script = new vm.Script(scriptContent);
vm.createContext(context)
const script = new vm.Script(content)
script.runInNewContext(context)
if(context.output) {
originalLocale(context.output)
console.log(`Locale ${locale} loaded from ${file}`)
}
break
return context.output || context.global[varName] || context[varName] || null
} catch(err) {
console.error(`Error loading locale ${locale} from ${file}:`, err)
return null
}
}
for (const locale of locales) {
const file = path.join(dir, 'dayjs-locale', locale +'.js')
const stat = await fs.promises.stat(file).catch(() => {})
if (!stat || !stat.size) continue

const varName = 'dayjs_locale_' + locale.replace('-', '_')
const scriptContent = await fs.promises.readFile(file, 'utf8')
let trimmedScriptContent = 'output='+ scriptContent.
replace(new RegExp('(^.*|,)[a-z] ?=', 'm'), '').
replace(new RegExp(';[^;]*return.*$', 'm'), '')
const ret = run(trimmedScriptContent, varName) || run(scriptContent, varName)
if(!ret) {
console.error(`Error loading locale ${locale} from ${file}`)
continue
}
originalLocale(ret)
break
}
}

Expand Down
2 changes: 1 addition & 1 deletion www/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"icon": "./default_icon.png",
"version": "17.5.6",
"megacubo": {
"revision": "17559"
"revision": "17560"
},
"main": "dist/main.js",
"window": {
Expand Down

0 comments on commit 38625dc

Please sign in to comment.