add: fatal error screen

This commit is contained in:
RainyXeon
2024-07-22 10:55:13 +07:00
committed by ThePedroo
parent cde142de7f
commit 9957be838f
10 changed files with 106 additions and 15 deletions

View File

@@ -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))

View File

@@ -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

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="60px" viewBox="0 -960 960 960" width="60px" fill="#ba1a1a"><path d="M92-120q-9 0-15.65-4.13Q69.7-128.25 66-135q-4.17-6.6-4.58-14.3Q61-157 66-165l388-670q5-8 11.5-11.5T480-850q8 0 14.5 3.5T506-835l388 670q5 8 4.58 15.7-.41 7.7-4.58 14.3-3.7 6.75-10.35 10.87Q877-120 868-120H92Zm392.18-117q12.82 0 21.32-8.68 8.5-8.67 8.5-21.5 0-12.82-8.68-21.32-8.67-8.5-21.5-8.5-12.82 0-21.32 8.68-8.5 8.67-8.5 21.5 0 12.82 8.68 21.32 8.67 8.5 21.5 8.5Zm0-111q12.82 0 21.32-8.63 8.5-8.62 8.5-21.37v-164q0-12.75-8.68-21.38-8.67-8.62-21.5-8.62-12.82 0-21.32 8.62-8.5 8.63-8.5 21.38v164q0 12.75 8.68 21.37 8.67 8.63 21.5 8.63Z"/></svg>

After

Width:  |  Height:  |  Size: 663 B

49
webroot/css/error.css Normal file
View File

@@ -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%)
}

View File

@@ -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);

View File

@@ -7,21 +7,43 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="js/errorCatcher.js" type="module"></script>
<script src="js/errorScreen.js" type="module"></script>
<script src="js/browserRedirect.js" type="module"></script>
<script src="js/theme.js" type="module"></script>
<script src="js/restoreError.js" type="module"></script>
<script src="js/navbar.js" type="module"></script>
<script src="js/daemon_actions.js" type="module"></script>
<script src="js/daemonActions.js" type="module"></script>
<script src="js/list/language.js" type="module"></script>
<script src="js/switcher/fontChanger.js" type="module"></script>
<script src="js/modal/language.js" type="module"></script>
<script src="js/modal/errorHistory.js" type="module"></script>
<script src="js/main.js" type="module"></script>
<link rel="stylesheet" href="css/error.css">
<link rel="stylesheet" href="css/icons.css">
<link rel="stylesheet" href="css/fonts.css">
<link rel="stylesheet" href="css/index.css">
</head>
<body id="main_body">
<!-- INFO: Error screen -->
<div id="fatal-error-screen" class="e-container" style="display: none;">
<div class="e-bg e-card e-main">
<img class="e-bg" src="./assets/ec-icon.svg" style="margin-bottom: 5px;"/>
<div class="e-bg">
Your WebUI is corrupt. It can't be trusted and may not work properly.
</div>
<div class="e-bg" style="margin-top: 15px;">
Please click the copy log button below and visit
<div class="e-bg e-font" credit-link="t.me/performancorg">t.me/performancorg</div>
for support.
</div>
<div id="esc-copy-button" class="e-button" style="margin-top: 15px;">COPY LOG</div>
<textarea id="esc-log" style="display: none;"></textarea>
</div>
</div>
<!-- INFO: Loading screen -->
<div id="loading_screen" class="load_screen">
<div id="backport_errorh" class="loader"></div>

View File

@@ -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)

View File

@@ -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)
})

View File

@@ -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)
})().catch((err) => setError('WebUI', err.stack ? err.stack : err.message))