diff --git a/module/build.gradle.kts b/module/build.gradle.kts index 89fe450..7f2efe3 100644 --- a/module/build.gradle.kts +++ b/module/build.gradle.kts @@ -170,8 +170,10 @@ androidComponents.onVariants { variant -> set.add(Pair(root.file("webroot/js/language.js").asFile, null)) set.add(Pair(root.file("webroot/js/restoreError.js").asFile, null)) set.add(Pair(root.file("webroot/js/navbar.js").asFile, null)) - set.add(Pair(root.file("webroot/js/daemon_actions.js").asFile, null)) + set.add(Pair(root.file("webroot/js/daemonActions.js").asFile, null)) set.add(Pair(root.file("webroot/js/errorCatcher.js").asFile, null)) + set.add(Pair(root.file("webroot/js/browserRedirect.js").asFile, null)) + set.add(Pair(root.file("webroot/js/errorScreen.js").asFile, null)) set.add(Pair(root.file("webroot/js/translate/action.js").asFile, null)) set.add(Pair(root.file("webroot/js/translate/home.js").asFile, null)) @@ -203,6 +205,7 @@ androidComponents.onVariants { variant -> set.add(Pair(root.file("webroot/css/index.css").asFile, null)) set.add(Pair(root.file("webroot/css/icons.css").asFile, null)) set.add(Pair(root.file("webroot/css/fonts.css").asFile, null)) + set.add(Pair(root.file("webroot/css/error.css").asFile, null)) set.add(Pair(root.file("webroot/fonts/ProductSans-Italic.ttf").asFile, null)) set.add(Pair(root.file("webroot/fonts/ProductSans-Regular.ttf").asFile, null)) @@ -219,6 +222,7 @@ androidComponents.onVariants { variant -> set.add(Pair(root.file("webroot/assets/action.svg").asFile, null)) set.add(Pair(root.file("webroot/assets/home.svg").asFile, null)) set.add(Pair(root.file("webroot/assets/delete.svg").asFile, null)) + set.add(Pair(root.file("webroot/assets/ec-icon.svg").asFile, null)) set.add(Pair(root.file("webroot/assets_light/action.svg").asFile, null)) set.add(Pair(root.file("webroot/assets_light/home.svg").asFile, null)) diff --git a/module/src/customize.sh b/module/src/customize.sh index 7946eef..3ef3a06 100644 --- a/module/src/customize.sh +++ b/module/src/customize.sh @@ -121,8 +121,10 @@ extract "$ZIPFILE" 'webroot/js/theme.js' "$MODPATH/webroot/js" true extract "$ZIPFILE" 'webroot/js/language.js' "$MODPATH/webroot/js" true extract "$ZIPFILE" 'webroot/js/navbar.js' "$MODPATH/webroot/js" true extract "$ZIPFILE" 'webroot/js/restoreError.js' "$MODPATH/webroot/js" true -extract "$ZIPFILE" 'webroot/js/daemon_actions.js' "$MODPATH/webroot/js" true +extract "$ZIPFILE" 'webroot/js/daemonActions.js' "$MODPATH/webroot/js" true extract "$ZIPFILE" 'webroot/js/errorCatcher.js' "$MODPATH/webroot/js" true +extract "$ZIPFILE" 'webroot/js/browserRedirect.js' "$MODPATH/webroot/js" true +extract "$ZIPFILE" 'webroot/js/errorScreen.js' "$MODPATH/webroot/js" true extract "$ZIPFILE" 'webroot/js/translate/home.js' "$MODPATH/webroot/js/translate" true extract "$ZIPFILE" 'webroot/js/translate/action.js' "$MODPATH/webroot/js/translate" true @@ -149,11 +151,12 @@ extract "$ZIPFILE" 'webroot/js/switcher/fontChanger.js' "$MODPATH/webroot/js/swi extract "$ZIPFILE" 'webroot/css/index.css' "$MODPATH/webroot/css" true extract "$ZIPFILE" 'webroot/css/fonts.css' "$MODPATH/webroot/css" true extract "$ZIPFILE" 'webroot/css/icons.css' "$MODPATH/webroot/css" true +extract "$ZIPFILE" 'webroot/css/error.css' "$MODPATH/webroot/css" true extract "$ZIPFILE" 'webroot/fonts/ProductSans-Italic.ttf' "$MODPATH/webroot/fonts" true extract "$ZIPFILE" 'webroot/fonts/ProductSans-Regular.ttf' "$MODPATH/webroot/fonts" true -for svg in mark tick warn module expand settings close content error action home delete; do +for svg in mark tick warn module expand settings close content error action home delete ec-icon; do extract "$ZIPFILE" "webroot/assets/${svg}.svg" "$MODPATH/webroot/assets" true done diff --git a/webroot/assets/ec-icon.svg b/webroot/assets/ec-icon.svg new file mode 100644 index 0000000..5de997d --- /dev/null +++ b/webroot/assets/ec-icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/webroot/css/error.css b/webroot/css/error.css new file mode 100644 index 0000000..936ed19 --- /dev/null +++ b/webroot/css/error.css @@ -0,0 +1,49 @@ +.e-container { + background-color: black; + z-index: 30; + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; + color: #fff; +} + +.e-main { + background-color: black; + position: fixed; + bottom: 230px; + left: 0; + right: 0; + color: #fff; +} + +.e-bg { + background-color: black; + color: #fff; +} + +.e-card { + margin: 30px; + color: #fff; +} + +.e-font { + color: #ba1a1a; +} + +.e-button { + display: flex; + align-items: center; + justify-content: center; + width: 120px; + height: 40px; + border-radius: 30px; + background-color: #ba1a1a; + color: black; + transition: transform 0.1s ease-in-out; +} + +.e-button:active { + transform: scale(90%) +} \ No newline at end of file diff --git a/webroot/css/icons.css b/webroot/css/icons.css index 4cf9f04..b596949 100644 --- a/webroot/css/icons.css +++ b/webroot/css/icons.css @@ -27,6 +27,11 @@ z-index: 10; } +#ec_icon { + background: url(../assets/ec-icon.svg); + z-index: 40; +} + /* Light */ #ni_home.light { background: url(../assets_light/home.svg); diff --git a/webroot/index.html b/webroot/index.html index 716cad8..19c2d33 100644 --- a/webroot/index.html +++ b/webroot/index.html @@ -7,21 +7,43 @@ + + - + + + + +
diff --git a/webroot/js/browserRedirect.js b/webroot/js/browserRedirect.js new file mode 100644 index 0000000..4bf400e --- /dev/null +++ b/webroot/js/browserRedirect.js @@ -0,0 +1,11 @@ +import { exec } from './kernelsu.js' + +document.addEventListener('click', async (event) => { + const getLink = event.target.getAttribute('credit-link') + if (!getLink || typeof getLink !== 'string') return; + + const ptrace64Cmd = await exec(`am start -a android.intent.action.VIEW -d https://${getLink}`).catch(() => { + return window.open(`https://${getLink}`, "_blank", 'toolbar=0,location=0,menubar=0') + }) + if (ptrace64Cmd.errno !== 0) return window.open(`https://${getLink}`, "_blank", 'toolbar=0,location=0,menubar=0') +}, false) \ No newline at end of file diff --git a/webroot/js/daemon_actions.js b/webroot/js/daemonActions.js similarity index 100% rename from webroot/js/daemon_actions.js rename to webroot/js/daemonActions.js diff --git a/webroot/js/errorScreen.js b/webroot/js/errorScreen.js new file mode 100644 index 0000000..b870cce --- /dev/null +++ b/webroot/js/errorScreen.js @@ -0,0 +1,6 @@ +const button = document.getElementById('esc-copy-button') +const log = document.getElementById('esc-log') + +button.addEventListener('click', () => { + navigator.clipboard.writeText(log.innerHTML) +}) \ No newline at end of file diff --git a/webroot/js/main.js b/webroot/js/main.js index 2145db3..f3fda1e 100644 --- a/webroot/js/main.js +++ b/webroot/js/main.js @@ -167,14 +167,4 @@ export function setErrorData(errorLog) { } else { setError('find', `Error while finding zygisk modules (${findModulesCmd.errno}): ${findModulesCmd.stderr}`) } -})().catch((err) => setError('WebUI', err.stack ? err.stack : err.message)) - -document.addEventListener('click', async (event) => { - const getLink = event.target.getAttribute('credit-link') - if (!getLink || typeof getLink !== 'string') return; - - const ptrace64Cmd = await exec(`am start -a android.intent.action.VIEW -d https://${getLink}`).catch(() => { - return window.open(`https://${getLink}`, "_blank", 'toolbar=0,location=0,menubar=0') - }) - if (ptrace64Cmd.errno !== 0) return window.open(`https://${getLink}`, "_blank", 'toolbar=0,location=0,menubar=0') -}, false) \ No newline at end of file +})().catch((err) => setError('WebUI', err.stack ? err.stack : err.message)) \ No newline at end of file