diff --git a/apps/app-frontend/src/App.vue b/apps/app-frontend/src/App.vue index 6d867be..aef6aa9 100644 --- a/apps/app-frontend/src/App.vue +++ b/apps/app-frontend/src/App.vue @@ -3,6 +3,7 @@ import { AuthFeature, TauriModrinthClient, VerboseLoggingFeature } from '@modrin import { ChangeSkinIcon, CompassIcon, + GlobeIcon, DownloadIcon, ExternalIcon, FlaskConicalIcon, @@ -735,6 +736,10 @@ const messages = defineMessages({ id: 'app.navigation.skin-selector', defaultMessage: 'Skin selector', }, + starlightSkin: { + id: 'app.navigation.starlight-skin', + defaultMessage: '斯达莱特', + }, library: { id: 'app.navigation.library', defaultMessage: 'Library', @@ -2314,6 +2319,13 @@ provideAppUpdateDownloadProgress(appUpdateDownload) > + + + +import { defineMessages, useVIntl } from '@modrinth/ui' +import { ref } from 'vue' + +const { formatMessage } = useVIntl() + +const messages = defineMessages({ + title: { + id: 'app.starlight-skin.title', + defaultMessage: '斯达莱特', + }, + frameTitle: { + id: 'app.starlight-skin.frame-title', + defaultMessage: 'StarLight Skin Site', + }, +}) + +const SKIN_SITE_URL = 'https://skin.starlight.cool/' + +const loading = ref(true) + +function onLoad() { + loading.value = false +} + + + + + + {{ formatMessage(messages.title) }}… + + + + diff --git a/apps/app-frontend/src/routes.js b/apps/app-frontend/src/routes.js index 99cfc26..72fb0df 100644 --- a/apps/app-frontend/src/routes.js +++ b/apps/app-frontend/src/routes.js @@ -93,6 +93,14 @@ export default new createRouter({ discordActivity: 'Changing skins...', }, }, + { + path: '/starlight-skin', + name: 'Starlight skin', + component: () => import('@/pages/StarlightSkin.vue'), + meta: { + breadcrumb: [{ name: 'Starlight skin' }], + }, + }, { path: '/multiplayer', name: 'Multiplayer', diff --git a/apps/app/tauri.conf.json b/apps/app/tauri.conf.json index 225a1fc..1a7addc 100644 --- a/apps/app/tauri.conf.json +++ b/apps/app/tauri.conf.json @@ -117,7 +117,8 @@ "style-src": "'unsafe-inline' 'self'", "script-src": "'self' 'unsafe-eval' 'wasm-unsafe-eval'", "worker-src": "'self' blob:", - "frame-src": "https://www.youtube.com https://www.youtube-nocookie.com https://discord.com 'self' http://axolotl-skin.localhost axolotl-skin://localhost", + + "frame-src": "https://www.youtube.com https://www.youtube-nocookie.com https://discord.com 'self' http://axolotl-skin.localhost axolotl-skin://localhost https://skin.starlight.cool", "media-src": "'self' data: https://*.githubusercontent.com" }, "csp": { @@ -127,8 +128,7 @@ "img-src": "https: 'unsafe-inline' 'self' asset: http://asset.localhost http://textures.minecraft.net blob: data:", "style-src": "'unsafe-inline' 'self'", "script-src": "'self' 'unsafe-eval' 'wasm-unsafe-eval'", - "worker-src": "'self' blob:", - "frame-src": "https://www.youtube.com https://www.youtube-nocookie.com https://discord.com 'self' axolotl-skin://localhost http://axolotl-skin.localhost", + "frame-src": "https://www.youtube.com https://www.youtube-nocookie.com https://discord.com 'self' axolotl-skin://localhost http://axolotl-skin.localhost https://skin.starlight.cool", "media-src": "'self' data: https://*.githubusercontent.com" } } diff --git a/tools/icon_work/add_nav.py b/tools/icon_work/add_nav.py new file mode 100644 index 0000000..6605a4d --- /dev/null +++ b/tools/icon_work/add_nav.py @@ -0,0 +1,59 @@ + +p = r"D:\Project\Starlight_Lancher\apps\app-frontend\src\App.vue" +lines = open(p, encoding="utf-8").read().split("\n") + +# 1) import 加 GlobeIcon:在第 5 行(CompassIcon)后、第 4 行(ChangeSkinIcon)开始那个块里 +# 找到 "CompassIcon," 那行,在其后插 "GlobeIcon," +imp_idx = None +for i, ln in enumerate(lines): + if ln.strip() == "CompassIcon,": + imp_idx = i + break +assert imp_idx is not None, "找不到 CompassIcon import" +lines.insert(imp_idx + 1, "\tGlobeIcon,") + +# 2) messages 加 starlightSkin:在 skinSelector 块结束的 '},' (原737) 后插 +# 因为上面插了1行,行号+1。重新定位 skinSelector 块 +skin_msg_idx = None +for i, ln in enumerate(lines): + if "app.navigation.skin-selector" in ln: + # 找它下面的 '},' + for j in range(i, i + 5): + if lines[j].strip() == "},": + skin_msg_idx = j + break + break +assert skin_msg_idx is not None, "找不到 skinSelector 消息块结尾" +new_msg = [ + "\tstarlightSkin: {", + "\t\tid: 'app.navigation.starlight-skin',", + "\t\tdefaultMessage: '斯达莱特',", + "\t},", +] +lines[skin_msg_idx + 1:skin_msg_idx + 1] = new_msg + +# 3) 模板加 NavButton:在 skin selector 的 (原2316) 后 +# 找 'nav-skins' 的块结尾 +nav_idx = None +for i, ln in enumerate(lines): + if 'data-onboarding-id="nav-skins"' in ln: + for j in range(i, i + 10): + if "" in lines[j]: + nav_idx = j + break + break +assert nav_idx is not None, "找不到 nav-skins 的 NavButton 结尾" +new_nav = [ + "\t\t\t\t", + "\t\t\t\t\t", + "\t\t\t\t", +] +lines[nav_idx + 1:nav_idx + 1] = new_nav + +open(p, "w", encoding="utf-8", newline="\n").write("\n".join(lines)) +print("完成。") +print("import 行:", lines[imp_idx], "->", lines[imp_idx+1]) diff --git a/tools/icon_work/add_route.py b/tools/icon_work/add_route.py new file mode 100644 index 0000000..19962ad --- /dev/null +++ b/tools/icon_work/add_route.py @@ -0,0 +1,27 @@ + +p = r"D:\Project\Starlight_Lancher\apps\app-frontend\src\routes.js" +lines = open(p, encoding="utf-8").read().split("\n") + +# 在第 95 行 (idx 94) 的 '},' 之后插入新路由;即 idx 95 前插 +anchor_idx = 95 # 0-based, 原第96行 '{' +# 校验 +assert lines[94].strip() == "},", f"第95行不是 '}},' 而是: {lines[94]!r}" +assert lines[95].strip() == "{", f"第96行不是 '{{' 而是: {lines[95]!r}" + +new_route = [ + "\t\t{", + "\t\t\tpath: '/starlight-skin',", + "\t\t\tname: 'Starlight skin',", + "\t\t\tcomponent: () => import('@/pages/StarlightSkin.vue'),", + "\t\t\tmeta: {", + "\t\t\t\tbreadcrumb: [{ name: 'Starlight skin' }],", + "\t\t\t},", + "\t\t},", +] +lines[95:95] = new_route +open(p, "w", encoding="utf-8", newline="\n").write("\n".join(lines)) +print("插入完成,新行数:", len(lines)) +print("--- 插入区 86-105 ---") +for i in range(85, 106): + if i < len(lines): + print(f"{i+1}: {lines[i]}") diff --git a/tools/icon_work/fix_csp.py b/tools/icon_work/fix_csp.py new file mode 100644 index 0000000..3108983 --- /dev/null +++ b/tools/icon_work/fix_csp.py @@ -0,0 +1,13 @@ + +p = r"D:\Project\Starlight_Lancher\apps\app\tauri.conf.json" +lines = open(p, encoding="utf-8").read().split("\n") +correct = ' "frame-src": "https://www.youtube.com https://www.youtube-nocookie.com https://discord.com \'self\' axolotl-skin://localhost http://axolotl-skin.localhost https://skin.starlight.cool",' +print("BEFORE 129-135:") +for i in range(128, 135): + print(f"{i+1}: {lines[i]}") +# 合并 131-134 (idx 130..133) 为一行 +lines[130:134] = [correct] +open(p, "w", encoding="utf-8", newline="\n").write("\n".join(lines)) +print("AFTER 128-135:") +for i in range(127, 135): + print(f"{i+1}: {lines[i]}")