mirror of
https://github.com/zumbiepig/MineXLauncher.git
synced 2025-06-08 09:24:48 +00:00
remove offline, uses too much bandwidth
This commit is contained in:
parent
acd410f575
commit
9b731c71ce
@ -22,25 +22,5 @@
|
|||||||
<meta property="og:locale" content="en-US" />
|
<meta property="og:locale" content="en-US" />
|
||||||
<script src="/resources/scripts/google-tag.js"></script>
|
<script src="/resources/scripts/google-tag.js"></script>
|
||||||
<script src="/resources/scripts/main.js"></script>
|
<script src="/resources/scripts/main.js"></script>
|
||||||
<script>
|
|
||||||
const lastPage = storage.session.get('lastPage');
|
|
||||||
const isMobile = detect.mobile();
|
|
||||||
const iframe = document.createElement('iframe');
|
|
||||||
|
|
||||||
iframe.id = 'main_frame'
|
|
||||||
|
|
||||||
if (storage.local.get('lastVersion') === null) {
|
|
||||||
iframe.src = '/welcome/';
|
|
||||||
} else if (lastPage !== null) {
|
|
||||||
iframe.src = lastPage;
|
|
||||||
} else if (isMobile) {
|
|
||||||
iframe.src = '/mobile/';
|
|
||||||
} else {
|
|
||||||
iframe.src = '/home/game/';
|
|
||||||
}
|
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
|
||||||
document.body.appendChild(iframe);
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
</html>
|
</html>
|
||||||
|
@ -70,10 +70,10 @@
|
|||||||
<option value="campfire">Campfire</option>
|
<option value="campfire">Campfire</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="settings-section">
|
<!-- <div class="settings-section">
|
||||||
<label for="offline-checkbox">Enable offline use:</label>
|
<label for="offline-checkbox">Enable offline use:</label>
|
||||||
<input type="checkbox" id="offline-checkbox" />
|
<input type="checkbox" id="offline-checkbox" />
|
||||||
</div>
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -51,7 +51,6 @@
|
|||||||
<div class="news-item">
|
<div class="news-item">
|
||||||
<!-- Don't forget to update launcherVersion and the changelog in main.js as well -->
|
<!-- Don't forget to update launcherVersion and the changelog in main.js as well -->
|
||||||
<strong>MineXLauncher 1.5</strong>
|
<strong>MineXLauncher 1.5</strong>
|
||||||
<li>The launcher can now be downloaded for offline use</li>
|
|
||||||
<li>You can now install the launcher as a PWA web app</li>
|
<li>You can now install the launcher as a PWA web app</li>
|
||||||
<br />
|
<br />
|
||||||
<strong>MineXLauncher 1.4</strong>
|
<strong>MineXLauncher 1.4</strong>
|
||||||
|
@ -39,8 +39,8 @@
|
|||||||
<option value="starfall">Starfall</option>
|
<option value="starfall">Starfall</option>
|
||||||
<option value="campfire">Campfire</option>
|
<option value="campfire">Campfire</option>
|
||||||
</select>
|
</select>
|
||||||
<label for="offline-checkbox">Enable offline use:</label>
|
<!-- <label for="offline-checkbox">Enable offline use:</label>
|
||||||
<input type="checkbox" id="offline-checkbox" />
|
<input type="checkbox" id="offline-checkbox" /> -->
|
||||||
<button type="submit" class="setup-submit">Submit</button>
|
<button type="submit" class="setup-submit">Submit</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -284,19 +284,43 @@ const serviceworker = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (window.location.pathname === '/') {
|
if (window.location.pathname === '/') {
|
||||||
|
const lastPage = storage.session.get('lastPage');
|
||||||
|
const isMobile = detect.mobile();
|
||||||
|
const iframe = document.createElement('iframe');
|
||||||
|
iframe.id = 'main_frame';
|
||||||
|
|
||||||
|
iframe.style.display = 'none';
|
||||||
|
iframe.addEventListener('load', () => {
|
||||||
|
iframe.style.display = '';
|
||||||
|
});
|
||||||
|
|
||||||
|
if (storage.local.get('lastVersion') === null) {
|
||||||
|
iframe.src = '/welcome/';
|
||||||
|
} else if (lastPage !== null) {
|
||||||
|
iframe.src = lastPage;
|
||||||
|
} else if (isMobile) {
|
||||||
|
iframe.src = '/mobile/';
|
||||||
|
} else {
|
||||||
|
iframe.src = '/home/game/';
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
document.body.appendChild(iframe);
|
||||||
|
});
|
||||||
|
|
||||||
window.addEventListener('beforeinstallprompt', (event) => {
|
window.addEventListener('beforeinstallprompt', (event) => {
|
||||||
const mainFrame = document.getElementById('main_frame') as HTMLIFrameElement;
|
if (iframe.contentWindow) {
|
||||||
if (mainFrame.contentWindow) {
|
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
mainFrame.contentWindow.installPwaEvent = event;
|
iframe.contentWindow.installPwaEvent = event;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (storage.local.get('offlineCache') === true) {
|
/* if (storage.local.get('offlineCache') === true) {
|
||||||
serviceworker.register('/sw-full.js');
|
serviceworker.register('/sw-full.js');
|
||||||
} else {
|
} else {
|
||||||
serviceworker.register('/sw.js');
|
serviceworker.register('/sw.js');
|
||||||
}
|
} */
|
||||||
|
serviceworker.register('/sw.js');
|
||||||
} else {
|
} else {
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const profileName = document.getElementById('profile-name');
|
const profileName = document.getElementById('profile-name');
|
||||||
@ -311,7 +335,6 @@ if (window.location.pathname === '/') {
|
|||||||
alert(`MineXLauncher has been updated to v${launcherVersion}!
|
alert(`MineXLauncher has been updated to v${launcherVersion}!
|
||||||
|
|
||||||
Changes in v${launcherVersion}:
|
Changes in v${launcherVersion}:
|
||||||
- The launcher can now be downloaded for offline use
|
|
||||||
- You can now install the launcher as a PWA web app`);
|
- You can now install the launcher as a PWA web app`);
|
||||||
storage.local.set('lastVersion', launcherVersion);
|
storage.local.set('lastVersion', launcherVersion);
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,11 @@ if (window.location.pathname === '/settings/') {
|
|||||||
const profileName = document.getElementById('profile-name');
|
const profileName = document.getElementById('profile-name');
|
||||||
const usernameInput = document.getElementById('username-input') as HTMLInputElement;
|
const usernameInput = document.getElementById('username-input') as HTMLInputElement;
|
||||||
const themeSelect = document.getElementById('theme-select') as HTMLSelectElement;
|
const themeSelect = document.getElementById('theme-select') as HTMLSelectElement;
|
||||||
const offlineCheckbox = document.getElementById('offline-checkbox') as HTMLInputElement;
|
// const offlineCheckbox = document.getElementById('offline-checkbox') as HTMLInputElement;
|
||||||
|
|
||||||
usernameInput.placeholder = storage.local.get('username') ?? '';
|
usernameInput.placeholder = storage.local.get('username') ?? '';
|
||||||
themeSelect.value = storage.local.get('theme') ?? '';
|
themeSelect.value = storage.local.get('theme') ?? '';
|
||||||
offlineCheckbox.checked = storage.local.get('offlineCache') ?? false;
|
// offlineCheckbox.checked = storage.local.get('offlineCache') ?? false;
|
||||||
|
|
||||||
usernameInput.addEventListener('input', () => {
|
usernameInput.addEventListener('input', () => {
|
||||||
let username = usernameInput.value.replace(/[^A-Za-z0-9]/g, '_').substring(0, 16);
|
let username = usernameInput.value.replace(/[^A-Za-z0-9]/g, '_').substring(0, 16);
|
||||||
@ -25,7 +25,7 @@ if (window.location.pathname === '/settings/') {
|
|||||||
theme.set(themeSelect.value);
|
theme.set(themeSelect.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
offlineCheckbox.addEventListener('change', () => {
|
/* offlineCheckbox.addEventListener('change', () => {
|
||||||
storage.local.set('offlineCache', offlineCheckbox.checked);
|
storage.local.set('offlineCache', offlineCheckbox.checked);
|
||||||
if (offlineCheckbox.checked) {
|
if (offlineCheckbox.checked) {
|
||||||
serviceworker.register('/sw-full.js');
|
serviceworker.register('/sw-full.js');
|
||||||
@ -36,7 +36,7 @@ if (window.location.pathname === '/settings/') {
|
|||||||
serviceworker.register('/sw.js');
|
serviceworker.register('/sw.js');
|
||||||
alert('Offline cache has been deleted.');
|
alert('Offline cache has been deleted.');
|
||||||
}
|
}
|
||||||
});
|
}); */
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ if (window.location.pathname === '/welcome/') {
|
|||||||
const setupForm = document.getElementById('setup-form') as HTMLFormElement;
|
const setupForm = document.getElementById('setup-form') as HTMLFormElement;
|
||||||
const usernameInput = document.getElementById('username-input') as HTMLInputElement;
|
const usernameInput = document.getElementById('username-input') as HTMLInputElement;
|
||||||
const themeSelect = document.getElementById('theme-select') as HTMLSelectElement;
|
const themeSelect = document.getElementById('theme-select') as HTMLSelectElement;
|
||||||
const offlineCheckbox = document.getElementById('offline-checkbox') as HTMLInputElement;
|
// const offlineCheckbox = document.getElementById('offline-checkbox') as HTMLInputElement;
|
||||||
|
|
||||||
usernameInput.addEventListener('input', () => {
|
usernameInput.addEventListener('input', () => {
|
||||||
const username = usernameInput.value.replace(/[^A-Za-z0-9]/g, '_').substring(0, 16);
|
const username = usernameInput.value.replace(/[^A-Za-z0-9]/g, '_').substring(0, 16);
|
||||||
@ -72,10 +72,10 @@ if (window.location.pathname === '/welcome/') {
|
|||||||
|
|
||||||
storage.local.set('username', username);
|
storage.local.set('username', username);
|
||||||
storage.local.set('theme', themeSelect.value);
|
storage.local.set('theme', themeSelect.value);
|
||||||
storage.local.set('offlineCache', offlineCheckbox.checked);
|
// storage.local.set('offlineCache', offlineCheckbox.checked);
|
||||||
storage.local.set('lastVersion', launcherVersion);
|
storage.local.set('lastVersion', launcherVersion);
|
||||||
|
|
||||||
if (offlineCheckbox.checked) {
|
/* if (offlineCheckbox.checked) {
|
||||||
serviceworker.register('/sw-full.js');
|
serviceworker.register('/sw-full.js');
|
||||||
alert(
|
alert(
|
||||||
'Offline cache is now downloading.\nThe download size is about 1GB, so it may take a while.\n\nPlease do not leave this page while the download is in progress.\nYou will be notified when the download is complete.'
|
'Offline cache is now downloading.\nThe download size is about 1GB, so it may take a while.\n\nPlease do not leave this page while the download is in progress.\nYou will be notified when the download is complete.'
|
||||||
@ -88,7 +88,7 @@ if (window.location.pathname === '/welcome/') {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
serviceworker.register('/sw.js');
|
serviceworker.register('/sw.js');
|
||||||
}
|
} */
|
||||||
|
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
window.top.location.href = '/';
|
window.top.location.href = '/';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user