Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@tauri-apps/plugin-dialog": "^2.8.3",
"@tauri-apps/plugin-fs": "^2.7.1",
"dompurify": "^3.4.16",
"foundation-ui": "https://codeload.github.com/AlkaidLab/foundation-ui/tar.gz/a79bbdf0066bb65a6d200a251a20cc9ca13cc936",
"foundation-ui": "https://codeload.github.com/AlkaidLab/foundation-ui/tar.gz/9c8109897ec0137e5a1ce671f794c8913fb02f0e",
"markdown-it": "^14.3.2",
"pixi.js": "^8.19.0",
"qrcode": "^1.5.4",
Expand Down
23 changes: 23 additions & 0 deletions src/renderer/brandAssets.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import test from 'node:test'
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'

// foundation-ui draws no picture of 薇薇 and has no wallpaper of hers until a product registers them: the windows that show her do it, the others carry none of her files
const read = (path) => readFileSync(new URL(path, import.meta.url), 'utf8')
const registers = (path) => /import \{ registerViviAssets \} from 'foundation-ui\/brand-assets'/.test(read(path)) && /^registerViviAssets\(\)$/m.test(read(path))

test('the desktop window and the installer page register 薇薇 and her wallpapers before they mount', () => {
for (const main of ['desktop/main.js', 'installer/main.js']) assert.ok(registers(main), main)
assert.ok(read('desktop/main.js').indexOf('registerViviAssets()') < read('desktop/main.js').indexOf('createApp(App)'))
})

test('the small windows (menu, toolbar, pin, latency clock, launch splash, tool window, home) do not import the art', () => {
for (const main of ['ctxmenu', 'toolbar', 'pin', 'latency-clock', 'launch-splash', 'tool-window', 'home']) assert.doesNotMatch(read(`${main}/main.js`), /brand-assets/, main)
})

test('the components that show the product name get it from the panel', () => {
assert.match(read('config/brand.js'), /PRODUCT_NAME = 'Foundation Sunshine'/)
assert.match(read('components/SidebarMenu.vue'), /<MBrand class="panel-caption__brand" :name="PRODUCT_NAME"/)
assert.match(read('components/SidebarMenu.vue'), /<MScene [^\n]*:brand-name="PRODUCT_NAME"/)
for (const page of ['DiagnosticsPage', 'DoctorPage']) assert.match(read(`components/m3e/${page}.vue`), /:product="PRODUCT_NAME"/)
})
7 changes: 4 additions & 3 deletions src/renderer/components/SidebarMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<MCaption bem="panel-caption" more bar-more :more-label="t.m3e.nav.moreTitle" data-tauri-drag-region="deep" @pointerdown="onTouchWindowDragStart" @more="moreOpen = true">
<template v-if="backButton" #back><MCaptionBack :page="backPage" :locale="locale" @back="jumps.back()" /></template>
<template #version><MCaptionVersion :version="currentVersion" :build="buildInfo" :os="osName()" :locale="locale" :update="notice.version" @copied="onVersionCopied" @open-update="openUpdates" /></template>
<template #brand><MBrand class="panel-caption__brand" :size="20" data-tauri-drag-region /></template>
<template #brand><MBrand class="panel-caption__brand" :name="PRODUCT_NAME" :size="20" data-tauri-drag-region /></template>
<template #announcements><UpdateDownloadChip @open="showUpdateDialog = true" /><MStatusBell :locale="locale" /><MFeedbackButton :locale="locale" /><MAnnouncementButton :unread="announcements.unread.value" :locale="locale" @open="router.navigate(ROUTES.ANNOUNCEMENTS)" /></template>
<template #search><div class="panel-caption__search" data-tauri-drag-region><MUnifiedSearch :search="uni" :texts="searchT" :compact="compactSearch || caption.tight.value" :height="38" /></div></template>
<template #connect><button type="button" class="m-caption-connect" :aria-label="connectT.title" :data-tip="connectT.title" :disabled="hostUnusable" @click="connect.show('pair')"><MIcon name="person_add" /><span>{{ connectT.title }}</span></button></template>
Expand All @@ -15,7 +15,7 @@
</div></template>
</MCaption>
<div class="panel-body">
<MScene :nav="nav" :caption-height="48" :jumps="jumps" :chip="backChip" :rail-items="rail" :bar-items="bar" :bar-current="barCur" :texts="sceneTexts" :overlay="isWebPage || offlineShown" :status="offlineShown" storage-key="foundation-ui.panel.list" @rail="onRail">
<MScene :nav="nav" :caption-height="48" :jumps="jumps" :chip="backChip" :rail-items="rail" :bar-items="bar" :bar-current="barCur" :texts="sceneTexts" :brand-name="PRODUCT_NAME" :overlay="isWebPage || offlineShown" :status="offlineShown" storage-key="foundation-ui.panel.list" @rail="onRail">
<template #back-chip><MBackChip :page="backPage" :locale="locale" @back="jumps.back()" /></template>
<template #rail-foot><MIconButton icon="palette" :label="appearanceLabel" :current="nav.rail.value === 'appearance'" @click="router.navigate(ROUTES.CFG_APPEARANCE)" /><MIconButton icon="info" :label="aboutTexts(locale).title" :current="router.currentRoute.value === ROUTES.ABOUT" :badge="notice.dot ? 'dot' : ''" @click="router.navigate(ROUTES.ABOUT, undefined, { root: true })" /><MSponsorButton :label="t.m3e.home.sponsor" :title="t.m3e.home.sponsorTitle" :sections="sponsorSections" :close-label="t.m3e.home.done" @open="(it) => actions_openExternal(it.url)" /></template>
<template #list="{ entry, scene }">
Expand Down Expand Up @@ -106,7 +106,7 @@
<MErrorHost :locale="locale" report-sheet :can-go-back="nav.canPop.value" :host-online="hostConn.state.status === 'online'" :restart="() => hostConn.restart('service')" :doctor="openDoctor" :open-url="actions_openExternal" @back="errorBack" />
<!-- 更多 of the bottom bar: what the bar has no room for -->
<MSheet v-model="moreOpen" :title="t.m3e.nav.moreTitle" side="end" :close-label="t.m3e.home.done">
<div class="panel-more-version"><MBrand :size="20" /><MCaptionVersion :version="currentVersion" :build="buildInfo" :os="osName()" :locale="locale" :update="notice.version" @copied="onVersionCopied" @open-update="moreGo(openUpdates)" /></div>
<div class="panel-more-version"><MBrand :name="PRODUCT_NAME" :size="20" /><MCaptionVersion :version="currentVersion" :build="buildInfo" :os="osName()" :locale="locale" :update="notice.version" @copied="onVersionCopied" @open-update="moreGo(openUpdates)" /></div>
<MGroup>
<!-- what the caption bar has no room for (its tier, MCaption): in the order it has there -->
<MItem v-if="caption.tier.value >= 5" action icon="person_add" :title="connectT.title" :disabled="hostUnusable" @click="moreGo(() => connect.show('pair'))" />
Expand Down Expand Up @@ -221,6 +221,7 @@ import { rtssInstalled, readRtssInstall } from '../composables/rtssInstall.js'
import { rowKeywords, parseSettingsHash } from 'foundation-ui/settings/index.js'
import { hasUpdate } from '../composables/updateCheckError.js'
import { useI18n } from '../desktop/i18n/index.js'
import { PRODUCT_NAME } from '../config/brand.js'
import { useDualSenseStatus } from '../composables/useDualSenseStatus.js'
import { useDualSenseText } from '../composables/useDualSenseText.js'
let rtssRefresh = 0
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/components/m3e/DiagnosticsPage.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<MDiagnostics
:product="PRODUCT_NAME"
:title="diagnosticsTexts(locale).title"
:text="diag.text.value"
:records="diag.records.value"
Expand Down Expand Up @@ -54,6 +55,7 @@
</template>

<script setup>
import { PRODUCT_NAME } from '../../config/brand.js'
import { setVisibleInterval, clearVisibleInterval } from '../../composables/pageVisibility.js'
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
import { invoke } from '@tauri-apps/api/core'
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/components/m3e/DoctorPage.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<MDoctor
:product="PRODUCT_NAME"
:sources="sources"
:repair="repair"
:can-repair="canRepair"
Expand All @@ -26,6 +27,7 @@ import { MDoctor, DOCTOR_LOCAL_GROUPS, doctorHostSource } from 'foundation-ui/vu
import { useDiagnostics } from '../../composables/useDiagnostics.js'
import { openExternalUrl, sunshine } from '../../tauri-adapter.js'
import { useI18n } from '../../desktop/i18n/index.js'
import { PRODUCT_NAME } from '../../config/brand.js'

// 体检 of the control panel: the panel's own checks (doctor_local: the service, the installation, the processes and ports, the
// drivers; they answer when Sunshine is down) and Sunshine's (GET /api/doctor through the proxy), on the shared page (MDoctor).
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/config/brand.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// The product's name, passed to the components of foundation-ui that show it (they carry no default of their own).
export const PRODUCT_NAME = 'Foundation Sunshine'
2 changes: 2 additions & 0 deletions src/renderer/desktop/main.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import '../../../src-tauri/inject-traces.js' // no trace of a browser: drag ghosts, browser keys and menus, zoom, selected chrome
import { createApp } from 'vue'
import 'foundation-ui/all.css'
import { registerViviAssets } from 'foundation-ui/brand-assets' // 薇薇 and her wallpapers: the library draws none until a product registers them
import '../styles/global.less'
import './desktop.less'
import App from './DesktopApp.vue'
import { i18nReady } from './i18n/index.js'

registerViviAssets()
const app = createApp(App)
i18nReady.then(() => app.mount('#app'))

2 changes: 2 additions & 0 deletions src/renderer/installer/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import '../../../src-tauri/inject-traces.js' // no trace of a browser: drag ghosts, browser keys and menus, zoom
import { createApp } from 'vue'
import 'foundation-ui/all.css'
import { registerViviAssets } from 'foundation-ui/brand-assets' // the logo of the rail
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
import { createBridge } from 'foundation-ui/vue/installer/bridge.js'
import MInstaller from 'installer-root'

registerViviAssets()
createApp(MInstaller, { bridge: createBridge(), windowed: true }).mount('#app')
2 changes: 2 additions & 0 deletions vite.installer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export default defineConfig(() => ({
alias: [
{ find: /^foundation-ui\/vue$/, replacement: join(foundationUi, 'src/vue/index.js') },
{ find: /^foundation-ui\/all\.css$/, replacement: join(foundationUi, 'src/css/all.css') },
// the brand artwork is its own directory at the package root, not under src/
{ find: /^foundation-ui\/brand-assets$/, replacement: join(foundationUi, 'brand-assets/index.js') },
{ find: /^foundation-ui\/(.*)$/, replacement: join(foundationUi, 'src/$1') },
{ find: /^installer-root$/, replacement: installerRoot },
{ find: /^vue$/, replacement: join(__dirname, 'node_modules/vue/dist/vue.runtime.esm-bundler.js') },
Expand Down
Loading