mirror of
https://github.com/titaniumnetwork-dev/Ultraviolet.git
synced 2025-05-17 05:20:01 -04:00
add more steps, fix grammar, show version
This commit is contained in:
parent
5119555f3f
commit
54f9b43995
2 changed files with 34 additions and 9 deletions
36
src/uv.sw.js
36
src/uv.sw.js
|
@ -404,7 +404,10 @@ function hostnameErrorTemplate(fetchedURL, bareServer) {
|
||||||
)};` +
|
)};` +
|
||||||
`bareServer.href = ${JSON.stringify(bareServer)};` +
|
`bareServer.href = ${JSON.stringify(bareServer)};` +
|
||||||
`uvHostname.textContent = ${JSON.stringify(location.hostname)};` +
|
`uvHostname.textContent = ${JSON.stringify(location.hostname)};` +
|
||||||
`reload.addEventListener("click", () => location.reload())`;
|
`reload.addEventListener("click", () => location.reload());` +
|
||||||
|
`uvVersion.textContent = ${JSON.stringify(
|
||||||
|
process.env.ULTRAVIOLET_VERSION
|
||||||
|
)};`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
'<!DOCTYPE html>' +
|
'<!DOCTYPE html>' +
|
||||||
|
@ -419,12 +422,14 @@ function hostnameErrorTemplate(fetchedURL, bareServer) {
|
||||||
'<p><b id="remoteHostname"></b>’s server IP address could not be found.</p>' +
|
'<p><b id="remoteHostname"></b>’s server IP address could not be found.</p>' +
|
||||||
'<p>Try:</p>' +
|
'<p>Try:</p>' +
|
||||||
'<ul>' +
|
'<ul>' +
|
||||||
'<li>Make sure you entered the correct address</li>' +
|
'<li>Verifying you entered the correct address</li>' +
|
||||||
'<li>Clearing the site data</li>' +
|
'<li>Clearing the site data</li>' +
|
||||||
'<li>Contact the administrator of <b id="uvHostname"></b></li>' +
|
'<li>Contacting <b id="uvHostname"></b>\'s administrator</li>' +
|
||||||
"<li>Verify your <a id='bareServer' title='Bare server'>Bare server</a> isn't censored</li>" +
|
"<li>Verifying the <a id='bareServer' title='Bare server'>Bare server</a> isn't censored</li>" +
|
||||||
'</ul>' +
|
'</ul>' +
|
||||||
'<button id="reload">Reload</button>' +
|
'<button id="reload">Reload</button>' +
|
||||||
|
'<hr />' +
|
||||||
|
'<p><i>Ultraviolet v<span id="uvVersion"></span></i></p>' +
|
||||||
`<script src="${
|
`<script src="${
|
||||||
'data:application/javascript,' + encodeURIComponent(script)
|
'data:application/javascript,' + encodeURIComponent(script)
|
||||||
}"></script>` +
|
}"></script>` +
|
||||||
|
@ -466,8 +471,13 @@ function errorTemplate(
|
||||||
`errorTrace.value = ${JSON.stringify(trace)};` +
|
`errorTrace.value = ${JSON.stringify(trace)};` +
|
||||||
`fetchedURL.textContent = ${JSON.stringify(fetchedURL)};` +
|
`fetchedURL.textContent = ${JSON.stringify(fetchedURL)};` +
|
||||||
`bareServer.href = ${JSON.stringify(bareServer)};` +
|
`bareServer.href = ${JSON.stringify(bareServer)};` +
|
||||||
`uvHostname.textContent = ${JSON.stringify(location.hostname)};` +
|
`for (const node of document.querySelectorAll("#uvHostname")) node.textContent = ${JSON.stringify(
|
||||||
`reload.addEventListener("click", () => location.reload());`;
|
location.hostname
|
||||||
|
)};` +
|
||||||
|
`reload.addEventListener("click", () => location.reload());` +
|
||||||
|
`uvVersion.textContent = ${JSON.stringify(
|
||||||
|
process.env.ULTRAVIOLET_VERSION
|
||||||
|
)};`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
'<!DOCTYPE html>' +
|
'<!DOCTYPE html>' +
|
||||||
|
@ -488,12 +498,20 @@ function errorTemplate(
|
||||||
'<textarea id="errorTrace" cols="40" rows="10" readonly></textarea>' +
|
'<textarea id="errorTrace" cols="40" rows="10" readonly></textarea>' +
|
||||||
'<p>Try:</p>' +
|
'<p>Try:</p>' +
|
||||||
'<ul>' +
|
'<ul>' +
|
||||||
'<li>Make sure you entered the correct address</li>' +
|
'<li>Verifying you entered the correct address</li>' +
|
||||||
'<li>Clearing the site data</li>' +
|
'<li>Clearing the site data</li>' +
|
||||||
'<li>Contact the administrator of <b id="uvHostname"></b></li>' +
|
'<li>Contacting <b id="uvHostname"></b>\'s administrator</li>' +
|
||||||
"<li>Verify your <a id='bareServer' title='Bare server'>Bare server</a> isn't censored</li>" +
|
"<li>Verify the <a id='bareServer' title='Bare server'>Bare server</a> isn't censored</li>" +
|
||||||
|
'</ul>' +
|
||||||
|
'<p>If you\'re the administrator of <b id="uvHostname"></b>, try:</p>' +
|
||||||
|
'<ul>' +
|
||||||
|
'<li>Restarting your Bare server</li>' +
|
||||||
|
'<li>Updating Ultraviolet</li>' +
|
||||||
|
'<li>Troubleshooting the error on the <a href="https://github.com/titaniumnetwork-dev/Ultraviolet">GitHub repository</a></li>' +
|
||||||
'</ul>' +
|
'</ul>' +
|
||||||
'<button id="reload">Reload</button>' +
|
'<button id="reload">Reload</button>' +
|
||||||
|
'<hr />' +
|
||||||
|
'<p><i>Ultraviolet v<span id="uvVersion"></span></i></p>' +
|
||||||
`<script src="${
|
`<script src="${
|
||||||
'data:application/javascript,' + encodeURIComponent(script)
|
'data:application/javascript,' + encodeURIComponent(script)
|
||||||
}"></script>` +
|
}"></script>` +
|
||||||
|
|
|
@ -2,6 +2,12 @@ import { fileURLToPath } from 'url';
|
||||||
import ESLintPlugin from 'eslint-webpack-plugin';
|
import ESLintPlugin from 'eslint-webpack-plugin';
|
||||||
import TerserPlugin from 'terser-webpack-plugin';
|
import TerserPlugin from 'terser-webpack-plugin';
|
||||||
import CopyPlugin from 'copy-webpack-plugin';
|
import CopyPlugin from 'copy-webpack-plugin';
|
||||||
|
import webpack from 'webpack';
|
||||||
|
import { readFile } from 'fs/promises';
|
||||||
|
|
||||||
|
// read version from package.json
|
||||||
|
const pk = JSON.parse(await readFile(new URL('package.json', import.meta.url)));
|
||||||
|
process.env.ULTRAVIOLET_VERSION = pk.version;
|
||||||
|
|
||||||
const isDevelopment = process.env.NODE_ENV !== 'production';
|
const isDevelopment = process.env.NODE_ENV !== 'production';
|
||||||
|
|
||||||
|
@ -67,6 +73,7 @@ const config = {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
new webpack.EnvironmentPlugin('ULTRAVIOLET_VERSION'),
|
||||||
],
|
],
|
||||||
performance: {
|
performance: {
|
||||||
// suppress "entrypoint size limit" warning
|
// suppress "entrypoint size limit" warning
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue