File tree Expand file tree Collapse file tree 3 files changed +21
-6
lines changed
Expand file tree Collapse file tree 3 files changed +21
-6
lines changed Original file line number Diff line number Diff line change 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" ,
5252 "peerDependencies" : {
5353 "vue" : " ^3.4"
5454 }
55- }
55+ }
Original file line number Diff line number Diff line change @@ -11,6 +11,15 @@ import type { Modpack } from '../types/modpack.type'
1111// @ts-ignore
1212export 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 {
Original file line number Diff line number Diff 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() {
You can’t perform that action at this time.
0 commit comments