From 87d99bd99e8a0b05c560e386f270219108dc6c0b Mon Sep 17 00:00:00 2001 From: Shirasawa <764798966@qq.com> Date: Fri, 20 Mar 2020 02:18:14 +0800 Subject: [PATCH] Add release --- .../{resources-cn.png => versions-cn.png} | Bin .../{resources.png => versions.png} | Bin index.html | 3 +- install-local.html | 39 ------------------ plugins.html | 11 ++--- release.html | 8 ++-- src/index.ts | 38 +++++++++++++---- src/install-local.ts | 17 -------- src/main.css | 2 +- src/release.ts | 13 ++++++ src/versions.ts | 2 +- versions.html | 1 + 12 files changed, 59 insertions(+), 75 deletions(-) rename assets/screenshots/{resources-cn.png => versions-cn.png} (100%) rename assets/screenshots/{resources.png => versions.png} (100%) delete mode 100644 install-local.html delete mode 100644 src/install-local.ts create mode 100644 src/release.ts diff --git a/assets/screenshots/resources-cn.png b/assets/screenshots/versions-cn.png similarity index 100% rename from assets/screenshots/resources-cn.png rename to assets/screenshots/versions-cn.png diff --git a/assets/screenshots/resources.png b/assets/screenshots/versions.png similarity index 100% rename from assets/screenshots/resources.png rename to assets/screenshots/versions.png diff --git a/index.html b/index.html index 9b143cf..6be1f5d 100644 --- a/index.html +++ b/index.html @@ -45,7 +45,7 @@

- +

@@ -139,6 +139,7 @@

English
+
辽ICP备16002088号-2
Copyright © 2020 Apisium All rights reserved. diff --git a/install-local.html b/install-local.html deleted file mode 100644 index 80ce8d7..0000000 --- a/install-local.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - PureLauncher | Resources Install - - - - - - - - - - - - - - -
-
-
-

-
-
- - - - - - - diff --git a/plugins.html b/plugins.html index d85f9d7..0db87db 100644 --- a/plugins.html +++ b/plugins.html @@ -35,31 +35,31 @@

- +

AuthlibInjector

- +

MCBot

- +

CurseForge

- +

- +
@@ -72,6 +72,7 @@ English +
辽ICP备16002088号-2
Copyright © 2020 Apisium All rights reserved. diff --git a/release.html b/release.html index 4004789..464e885 100644 --- a/release.html +++ b/release.html @@ -34,17 +34,17 @@

WINDOWS

- +

MACOS

- +

LINUX

- +
@@ -57,11 +57,13 @@ English +
辽ICP备16002088号-2
Copyright © 2020 Apisium All rights reserved. + diff --git a/src/index.ts b/src/index.ts index 9509fc7..392ac74 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,27 +4,49 @@ const os = (data.os.name || '').toLowerCase() const cn = { home: require('../assets/screenshots/home-cn.png'), - resources: require('../assets/screenshots/resources-cn.png'), + resources: require('../assets/screenshots/versions-cn.png'), accounts: require('../assets/screenshots/accounts-cn.png') } const en = { home: require('../assets/screenshots/home.png'), - resources: require('../assets/screenshots/resources.png'), + resources: require('../assets/screenshots/versions.png'), accounts: require('../assets/screenshots/accounts.png') } const changeText = () => { let text: string + let ext: string if (os.startsWith('android') || os.startsWith('blackberry') || os.startsWith('ios') || os.startsWith('windows phone')) { text = $i('notSupport') $('#download-now').prop('disabled', true) - } else if (os.startsWith('windows')) text = `Windows ${$i('32')} (.exe)` - else if (os.startsWith('mac os')) text = `MACOS ${$i('64')} (.dmg)` - else if (os.startsWith('debian') || os.startsWith('ubuntu') || os.startsWith('deepin')) text = `Debian Linux ${$i('64')} (.deb)` - else if (os.startsWith('redhat') || os.startsWith('suse') || os.startsWith('centos')) text = `RedHat Linux ${$i('64')} (.rpm)` - else text = `Linux ${$i('64')} (.tar.gz)` - $('#release-type').text(text) + } else if (os.startsWith('windows')) { + text = `Windows ${$i('32')}` + ext = 'exe' + } else if (os.startsWith('mac os')) { + text = `MACOS ${$i('64')}` + ext = 'dmg' + } else if (os.startsWith('debian') || os.startsWith('ubuntu') || os.startsWith('deepin')) { + text = `Debian Linux ${$i('64')}` + ext = 'deb' + } else if (os.startsWith('redhat') || os.startsWith('suse') || os.startsWith('centos')) { + text = `RedHat Linux ${$i('64')}` + ext = 'rpm' + } else { + text = `Linux ${$i('64')}` + ext = 'tar.gz' + } + const btn = document.getElementById('download-now') + if (ext) { + $('#release-type').text(text + ` (${ext})`) + btn.onclick = () => void window.open( + `https://xmcl.azurewebsites.net/api/pl-get-release?ext=${ext}&gfw=${(window as any).currentLang === 'zh-cn'}`, + '_blank' + ) + } else { + $('#release-type').text(text) + btn.onclick = () => {} + } } const fn = (window as any).setLanguague const f = (window as any).setLanguague = (str: string, exec: boolean) => { diff --git a/src/install-local.ts b/src/install-local.ts deleted file mode 100644 index eeeb915..0000000 --- a/src/install-local.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { ensureRunning, protocol, info } from 'pure-launcher/packages/web-api' - -info().then(console.log) - -const path = decodeURIComponent(location.search.slice(1)) - -ensureRunning() - .then(() => path && protocol({ type: 'InstallLocal', path } as any)) - .then(() => { - $('#text').text($i('installSuccess')) - setTimeout(close, 5000) - }) - .catch(e => { - console.error(e) - $('#text').text($i('installFailed')) - setTimeout(() => (location.href = '/'), 7000) - }) diff --git a/src/main.css b/src/main.css index cd2621d..efea085 100644 --- a/src/main.css +++ b/src/main.css @@ -50,5 +50,5 @@ footer > div { } footer a { text-decoration: none; - color: rgba(255, 255, 255, 0.86); + /* color: rgba(255, 255, 255, 0.86); */ } diff --git a/src/release.ts b/src/release.ts new file mode 100644 index 0000000..5a45988 --- /dev/null +++ b/src/release.ts @@ -0,0 +1,13 @@ +const fn1 = (window as any).setLanguague +const f1 = (window as any).setLanguague = (str: string, exec: boolean) => { + const isCN = str === 'zh-cn' + $('[data-ext]').each((_, it) => { + const e = $(it) + e.prop( + 'href', + `https://xmcl.azurewebsites.net/api/pl-get-release?ext=${e.data('ext')}&gfw=${isCN}` + ) + }) + if (!exec) fn1(str) +} +f1((window as any).currentLang, true) diff --git a/src/versions.ts b/src/versions.ts index 883f913..6b10849 100644 --- a/src/versions.ts +++ b/src/versions.ts @@ -72,7 +72,7 @@ const genList = () => { (window as any).install = (e: MouseEvent, id: number, type: 0 | 1 | 2 | 3) => { const v = data.versions[id] - let json: any = { type: 'Version', mcVersion: v.id, useIdAsName: true } + let json: any = { type: 'Version', mcVersion: v.id } switch (type) { case 1: json.id = v.fabric + '-Fabric' diff --git a/versions.html b/versions.html index 8b8501b..06764c6 100644 --- a/versions.html +++ b/versions.html @@ -63,6 +63,7 @@ English +
辽ICP备16002088号-2
Copyright © 2020 Apisium All rights reserved.