add start anyway button

This commit is contained in:
smartfrigde 2024-02-03 17:17:02 +01:00
parent a3665a5b6e
commit 2d2181fae2
3 changed files with 39 additions and 22 deletions

View file

@ -38,14 +38,11 @@ html,
body {
-webkit-app-region: drag;
overflow: hidden;
margin: 0;
padding: 0;
width: 100%;
height: 100%;
background: var(--background-primary);
display: flex;
flex-direction: column;
justify-content: center;
@ -54,29 +51,27 @@ body {
* {
font-family: "Whitney", sans-serif;
box-sizing: border-box;
-webkit-user-select: none;
cursor: default;
}
video {
display: block;
width: 200px;
height: 150px;
object-fit: cover;
margin: 0 auto;
}
#text-splashscreen {
font-size: 7vw;
text-align: center;
color: var(--header-primary);
font-weight: 400;
font-style: italic;
font-size: 16px;
text-transform: uppercase;
width: 100%;
}
@ -84,15 +79,12 @@ video {
#bar-fill {
width: 180px;
height: 8px;
border-radius: 4px;
visibility: hidden;
}
#bar-container {
background-color: var(--background-secondary);
position: relative;
margin-top: 12px;
}
@ -106,7 +98,6 @@ video {
position: absolute;
bottom: 6px;
right: 6px;
text-align: right;
font-size: 10px;
color: var(--text-muted);
@ -116,3 +107,22 @@ video {
img.logo {
width: 272px;
}
button {
background: var(--brand-experiment);
color: var(--header-primary);
outline: none;
border: none;
border-radius: 5px;
padding: 8px;
-webkit-user-select: all !important;
user-select: all !important;
margin-top: 10px;
-webkit-app-region: no-drag;
transition: 0.17s ease;
display: none;
margin: 0 auto;
}
button:hover {
cursor: grab !important;
}

View file

@ -21,13 +21,18 @@
<source src="https://armcord.app/discord_loading.webm" type="video/webm" />
</video>
<p id="text-splashscreen"></p>
<button id="ignore">Start anyway</button>
</div>
</body>
<script>
async function loadLang() {
const text = document.getElementById("text-splashscreen");
if (window.navigator.onLine === false) {
if (window.navigator.onLine === true) {
text.innerHTML = await internal.getLang("loading_screen_offline");
document.getElementById("ignore").style.display = "block";
document.getElementById("ignore").onclick = () => {
window.internal.splashEnd();
};
} else {
text.innerHTML = await internal.getLang("loading_screen_start");
if (window.internal.version === "3.3.0") {

View file

@ -404,8 +404,7 @@ export function updateModInstallState() {
modInstallState = "done";
}
export async function installModLoader(): Promise<void>
{
export async function installModLoader(): Promise<void> {
if ((await getConfig("mods")) == "none") {
modInstallState = "none";
fs.rmSync(`${app.getPath("userData")}/plugins/loader`, {recursive: true, force: true});
@ -417,7 +416,7 @@ export async function installModLoader(): Promise<void>
}
const pluginFolder = `${app.getPath("userData")}/plugins/`;
if (fs.existsSync(`${pluginFolder}loader`) && fs.existsSync(`${pluginFolder}loader/dist/bundle.css`)){
if (fs.existsSync(`${pluginFolder}loader`) && fs.existsSync(`${pluginFolder}loader/dist/bundle.css`)) {
updateModInstallState();
return;
}
@ -428,23 +427,26 @@ export async function installModLoader(): Promise<void>
let zipPath = `${app.getPath("temp")}/loader.zip`;
if(!fs.existsSync(pluginFolder)) {
fs.mkdirSync (pluginFolder);
if (!fs.existsSync(pluginFolder)) {
fs.mkdirSync(pluginFolder);
console.log("[Mod loader] Created missing plugin folder");
}
// Add more of these later if needed!
let URLs = ['https://armcord.app/loader.zip', 'https://armcord.vercel.app/loader.zip', 'https://raw.githubusercontent.com/ArmCord/website/new/public/loader.zip'];
let URLs = [
"https://armcord.app/loader.zip",
"https://armcord.vercel.app/loader.zip",
"https://raw.githubusercontent.com/ArmCord/website/new/public/loader.zip"
];
let loaderZip: any;
while (true){
if(URLs.length <= 0)
throw new Error(`unexpected response ${loaderZip.statusText}`);
while (true) {
if (URLs.length <= 0) throw new Error(`unexpected response ${loaderZip.statusText}`);
try {
loaderZip = await fetch(URLs[0]);
} catch (err) {
console.log('[Mod loader] Failed to download. Links left to try: ' + (URLs.length - 1));
console.log("[Mod loader] Failed to download. Links left to try: " + (URLs.length - 1));
URLs.splice(0, 1);
continue;