feat:侧边栏加了皮肤站标签,可在启动内直接打开皮肤站
This commit is contained in:
@ -3,6 +3,7 @@ import { AuthFeature, TauriModrinthClient, VerboseLoggingFeature } from '@modrin
|
|||||||
import {
|
import {
|
||||||
ChangeSkinIcon,
|
ChangeSkinIcon,
|
||||||
CompassIcon,
|
CompassIcon,
|
||||||
|
GlobeIcon,
|
||||||
DownloadIcon,
|
DownloadIcon,
|
||||||
ExternalIcon,
|
ExternalIcon,
|
||||||
FlaskConicalIcon,
|
FlaskConicalIcon,
|
||||||
@ -735,6 +736,10 @@ const messages = defineMessages({
|
|||||||
id: 'app.navigation.skin-selector',
|
id: 'app.navigation.skin-selector',
|
||||||
defaultMessage: 'Skin selector',
|
defaultMessage: 'Skin selector',
|
||||||
},
|
},
|
||||||
|
starlightSkin: {
|
||||||
|
id: 'app.navigation.starlight-skin',
|
||||||
|
defaultMessage: '斯达莱特',
|
||||||
|
},
|
||||||
library: {
|
library: {
|
||||||
id: 'app.navigation.library',
|
id: 'app.navigation.library',
|
||||||
defaultMessage: 'Library',
|
defaultMessage: 'Library',
|
||||||
@ -2314,6 +2319,13 @@ provideAppUpdateDownloadProgress(appUpdateDownload)
|
|||||||
>
|
>
|
||||||
<ChangeSkinIcon />
|
<ChangeSkinIcon />
|
||||||
</NavButton>
|
</NavButton>
|
||||||
|
<NavButton
|
||||||
|
v-tooltip.right="formatMessage(messages.starlightSkin)"
|
||||||
|
data-onboarding-id="nav-starlight-skin"
|
||||||
|
to="/starlight-skin"
|
||||||
|
>
|
||||||
|
<GlobeIcon />
|
||||||
|
</NavButton>
|
||||||
<NavButton
|
<NavButton
|
||||||
v-tooltip.right="formatMessage(messages.library)"
|
v-tooltip.right="formatMessage(messages.library)"
|
||||||
data-onboarding-id="nav-library"
|
data-onboarding-id="nav-library"
|
||||||
|
|||||||
@ -147,7 +147,7 @@
|
|||||||
"name": "xinvxueyuan",
|
"name": "xinvxueyuan",
|
||||||
"avatarUrl": "https://avatars.githubusercontent.com/u/149921651?v=4&s=96",
|
"avatarUrl": "https://avatars.githubusercontent.com/u/149921651?v=4&s=96",
|
||||||
"url": "https://github.com/xinvxueyuan",
|
"url": "https://github.com/xinvxueyuan",
|
||||||
"contributions": 42
|
"contributions": 43
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "piprett",
|
"name": "piprett",
|
||||||
|
|||||||
41
apps/app-frontend/src/pages/StarlightSkin.vue
Normal file
41
apps/app-frontend/src/pages/StarlightSkin.vue
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
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
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="flex h-full min-h-0 flex-col">
|
||||||
|
<div v-if="loading" class="flex flex-1 items-center justify-center">
|
||||||
|
<span class="text-secondary">{{ formatMessage(messages.title) }}…</span>
|
||||||
|
</div>
|
||||||
|
<iframe
|
||||||
|
:src="SKIN_SITE_URL"
|
||||||
|
:title="formatMessage(messages.frameTitle)"
|
||||||
|
class="h-full min-h-0 w-full flex-1 border-0"
|
||||||
|
:class="loading ? 'hidden' : ''"
|
||||||
|
@load="onLoad"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@ -93,6 +93,14 @@ export default new createRouter({
|
|||||||
discordActivity: 'Changing skins...',
|
discordActivity: 'Changing skins...',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/starlight-skin',
|
||||||
|
name: 'Starlight skin',
|
||||||
|
component: () => import('@/pages/StarlightSkin.vue'),
|
||||||
|
meta: {
|
||||||
|
breadcrumb: [{ name: 'Starlight skin' }],
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/multiplayer',
|
path: '/multiplayer',
|
||||||
name: 'Multiplayer',
|
name: 'Multiplayer',
|
||||||
|
|||||||
@ -117,7 +117,8 @@
|
|||||||
"style-src": "'unsafe-inline' 'self'",
|
"style-src": "'unsafe-inline' 'self'",
|
||||||
"script-src": "'self' 'unsafe-eval' 'wasm-unsafe-eval'",
|
"script-src": "'self' 'unsafe-eval' 'wasm-unsafe-eval'",
|
||||||
"worker-src": "'self' blob:",
|
"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"
|
"media-src": "'self' data: https://*.githubusercontent.com"
|
||||||
},
|
},
|
||||||
"csp": {
|
"csp": {
|
||||||
@ -127,8 +128,7 @@
|
|||||||
"img-src": "https: 'unsafe-inline' 'self' asset: http://asset.localhost http://textures.minecraft.net blob: data:",
|
"img-src": "https: 'unsafe-inline' 'self' asset: http://asset.localhost http://textures.minecraft.net blob: data:",
|
||||||
"style-src": "'unsafe-inline' 'self'",
|
"style-src": "'unsafe-inline' 'self'",
|
||||||
"script-src": "'self' 'unsafe-eval' 'wasm-unsafe-eval'",
|
"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 https://skin.starlight.cool",
|
||||||
"frame-src": "https://www.youtube.com https://www.youtube-nocookie.com https://discord.com 'self' axolotl-skin://localhost http://axolotl-skin.localhost",
|
|
||||||
"media-src": "'self' data: https://*.githubusercontent.com"
|
"media-src": "'self' data: https://*.githubusercontent.com"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
59
tools/icon_work/add_nav.py
Normal file
59
tools/icon_work/add_nav.py
Normal file
@ -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 的 </NavButton> (原2316) 后
|
||||||
|
# 找 'nav-skins' 的块结尾 </NavButton>
|
||||||
|
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 "</NavButton>" in lines[j]:
|
||||||
|
nav_idx = j
|
||||||
|
break
|
||||||
|
break
|
||||||
|
assert nav_idx is not None, "找不到 nav-skins 的 NavButton 结尾"
|
||||||
|
new_nav = [
|
||||||
|
"\t\t\t\t<NavButton",
|
||||||
|
'\t\t\t\t\tv-tooltip.right="formatMessage(messages.starlightSkin)"',
|
||||||
|
'\t\t\t\t\tdata-onboarding-id="nav-starlight-skin"',
|
||||||
|
'\t\t\t\t\tto="/starlight-skin"',
|
||||||
|
"\t\t\t\t>",
|
||||||
|
"\t\t\t\t\t<GlobeIcon />",
|
||||||
|
"\t\t\t\t</NavButton>",
|
||||||
|
]
|
||||||
|
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])
|
||||||
27
tools/icon_work/add_route.py
Normal file
27
tools/icon_work/add_route.py
Normal file
@ -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]}")
|
||||||
13
tools/icon_work/fix_csp.py
Normal file
13
tools/icon_work/fix_csp.py
Normal file
@ -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]}")
|
||||||
Reference in New Issue
Block a user