Skip to content

Commit 91aa210

Browse files
committed
Bump version to 0.1.11 and enhance modpack filtering based on account whitelist
1 parent ab2183d commit 91aa210

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tacxtv/miratopia-launcher",
3-
"version": "0.1.10",
3+
"version": "0.1.11",
44
"description": "Launcher officiel du serveur Minecraft Miratopia",
55
"main": "dist-electron/main.js",
66
"repository": "https://github.com/tacxtv/miratopia-launcher.git",
@@ -52,4 +52,4 @@
5252
"peerDependencies": {
5353
"vue": "^3.4"
5454
}
55-
}
55+
}

src/app.vue

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ import type { Modpack } from '../types/modpack.type'
1111
// @ts-ignore
1212
export default defineNuxtComponent({
1313
async setup() {
14+
const currentAccount = await window.electron.currentAccount()
15+
const getAccount = async (currentAccount: any) => {
16+
const accounts = await window.electron.getAccounts()
17+
if (!accounts) return
18+
return accounts.find((account: any) => {
19+
return account.username === currentAccount
20+
})
21+
}
22+
1423
const launcher: Launcher = (
1524
await axios.get('https://raw.githubusercontent.com/tacxtv/miratopia-launcher/config/launcher.json', {
1625
headers: {
@@ -19,17 +28,22 @@ export default defineNuxtComponent({
1928
})
2029
).data
2130
22-
let modpack
2331
const modpacks = []
2432
for await (const mp of launcher?.config?.modpacks) {
2533
const mpk: Modpack = (
26-
await axios.get(`https://raw.githubusercontent.com/tacxtv/miratopia-launcher/config/modpacks/${mp}/modpack.json`, {
34+
await axios.get(`https://raw.githubusercontent.com/tacxtv/miratopia-launcher/config/modpacks/${mp.name}/modpack.json`, {
2735
headers: {
2836
'Content-Type': 'application/json',
2937
},
3038
})
3139
).data
32-
modpacks.push(mpk)
40+
if (mpk.whitelist) {
41+
if (mpk.whitelist.includes((await getAccount(currentAccount))?.username.toLowerCase())) {
42+
modpacks.push(mpk)
43+
}
44+
} else {
45+
modpacks.push(mpk)
46+
}
3347
}
3448
3549
return {

src/pages/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ export default defineNuxtComponent({
6868
return flow
6969
},
7070
defaultModpack(): Modpack {
71-
return this.modpacks.find((modpack) => modpack.default) as Modpack
71+
const mp = this.modpacks.find((modpack) => modpack.default) as Modpack
72+
return mp || this.modpacks[0]
7273
},
7374
},
7475
setup() {

0 commit comments

Comments
 (0)