diff --git a/public/github-icon.png b/public/github-icon.png
new file mode 100644
index 0000000..0f0ee21
Binary files /dev/null and b/public/github-icon.png differ
diff --git a/src/main.ts b/src/main.ts
index 6e78618..a7445d1 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -141,6 +141,8 @@ document.addEventListener('DOMContentLoaded', () => {
const closeModal = document.getElementById('close-modal');
let latestAssets: any[] = [];
+ let nightlyAssets: any[] = [];
+ let currentOSType = 'Windows';
const detectOS = () => {
const ua = window.navigator.userAgent.toLowerCase();
@@ -185,27 +187,31 @@ document.addEventListener('DOMContentLoaded', () => {
const openDownloadModal = (osType: string) => {
if (!modal || !modalOptions || !modalTitle) return;
+ currentOSType = osType;
+
+ const nightlyToggle = document.getElementById('nightly-toggle') as HTMLInputElement;
+ const isNightly = nightlyToggle?.checked || false;
+ const assets = isNightly ? nightlyAssets : latestAssets;
- audio.playSFX('click.wav');
- const { arch } = detectOS();
let filteredAssets = [];
let title = 'Select Downloader';
if (osType === 'Windows') {
- filteredAssets = latestAssets.filter(a => a.name.endsWith('.exe') || a.name.endsWith('.msi'));
- title = 'Emerald Legacy for Windows';
+ filteredAssets = assets.filter(a => a.name.endsWith('.exe') || a.name.endsWith('.msi'));
+ title = `Emerald Legacy for Windows ${isNightly ? '(Nightly)' : ''}`;
} else if (osType === 'macOS') {
- filteredAssets = latestAssets.filter(a => a.name.endsWith('.dmg'));
- title = 'Emerald Legacy for macOS';
+ filteredAssets = assets.filter(a => a.name.endsWith('.dmg'));
+ title = `Emerald Legacy for macOS ${isNightly ? '(Nightly)' : ''}`;
} else if (osType === 'Linux') {
- filteredAssets = latestAssets.filter(a => a.name.endsWith('.AppImage') || a.name.endsWith('.deb') || a.name.endsWith('.rpm'));
- title = 'Emerald Legacy for Linux';
+ filteredAssets = assets.filter(a => a.name.endsWith('.AppImage') || a.name.endsWith('.deb') || a.name.endsWith('.rpm'));
+ title = `Emerald Legacy for Linux ${isNightly ? '(Nightly)' : ''}`;
}
+ const { arch } = detectOS();
const recommended = getRecommendedAsset(osType, arch, filteredAssets);
modalTitle.innerText = title;
- modalOptions.innerHTML = filteredAssets.map(asset => {
+ modalOptions.innerHTML = filteredAssets.length > 0 ? filteredAssets.map(asset => {
const isRecommended = asset.name === recommended?.name;
return `
@@ -215,18 +221,34 @@ document.addEventListener('DOMContentLoaded', () => {
${isRecommended ? 'Recommended!' : ''}
`;
- }).join('');
+ }).join('') : `
No builds found for this platform.
`;
modal.classList.add('active');
};
+ const nightlyToggle = document.getElementById('nightly-toggle');
+ nightlyToggle?.addEventListener('change', () => {
+ audio.playSFX('click.wav');
+ openDownloadModal(currentOSType);
+ });
+
(window as any).playAudioSFX = (file: string) => audio.playSFX(file);
const updateDownloadButtons = async () => {
try {
- const response = await fetch(`https://api.github.com/repos/${repo}/releases/latest`);
- const data = await response.json();
- latestAssets = data.assets;
+ const [latestRes, nightlyRes] = await Promise.all([
+ fetch(`https://api.github.com/repos/${repo}/releases/latest`),
+ fetch(`https://api.github.com/repos/${repo}/releases/tags/nightly`)
+ ]);
+
+ const [latestData, nightlyData] = await Promise.all([
+ latestRes.json(),
+ nightlyRes.json()
+ ]);
+
+ latestAssets = latestData.assets || [];
+ nightlyAssets = nightlyData.assets || [];
+
const { os } = detectOS();
const mainBtn = document.getElementById('main-download-btn');
@@ -248,7 +270,7 @@ document.addEventListener('DOMContentLoaded', () => {
macBtn?.addEventListener('click', (e) => { e.preventDefault(); openDownloadModal('macOS'); });
} catch (error) {
- console.error('Error fetching latest release:', error);
+ console.error('Error fetching releases:', error);
}
};
diff --git a/src/style.css b/src/style.css
index 78f7998..ff2f911 100644
--- a/src/style.css
+++ b/src/style.css
@@ -385,15 +385,19 @@ body {
z-index: 2;
}
-.get-launcher {
+.get-launcher,
+.github-repo,
+.join-discord {
justify-content: space-between;
padding: 0 20px;
+ height: 64px;
}
.join-discord {
- flex-direction: row;
- justify-content: center;
- height: 56px;
+ font-size: 1.8rem;
+}
+
+.github-repo {
font-size: 1.8rem;
}
@@ -410,7 +414,8 @@ body {
}
.btn-icon,
-.btn-icon-discord {
+.btn-icon-discord,
+.btn-icon-github {
height: 40px;
}
@@ -613,6 +618,73 @@ body {
margin-bottom: 8px;
}
+.header-left {
+ display: flex;
+ align-items: center;
+ gap: 20px;
+}
+
+.nightly-toggle-wrapper {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ background: #1a1a1a;
+ padding: 4px 12px;
+ border: 2px solid #7c7c7c;
+}
+
+.toggle-label {
+ font-family: var(--font-pixel);
+ font-size: 1.1rem;
+ color: #fff;
+ text-transform: uppercase;
+}
+
+.switch {
+ position: relative;
+ display: inline-block;
+ width: 44px;
+ height: 22px;
+}
+
+.switch input {
+ opacity: 0;
+ width: 0;
+ height: 0;
+}
+
+.slider {
+ position: absolute;
+ cursor: pointer;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background-color: #3c3c3c;
+ transition: .1s;
+ border: 2px solid #7c7c7c;
+}
+
+.slider:before {
+ position: absolute;
+ content: "";
+ height: 14px;
+ width: 14px;
+ left: 2px;
+ bottom: 2px;
+ background-color: #fff;
+ transition: .1s;
+}
+
+input:checked+.slider {
+ background-color: var(--color-emerald);
+ border-color: #fff;
+}
+
+input:checked+.slider:before {
+ transform: translateX(22px);
+}
+
.modal-header h2 {
font-size: 2rem;
color: #fff;