This commit is contained in:
tamaina 2022-04-23 01:50:20 +09:00
parent 5b4d75c2b4
commit f5f8843022
10 changed files with 30 additions and 40 deletions

View file

@ -37,7 +37,6 @@ gulp.task('copy:client:locales', cb => {
gulp.task('build:backend:script', () => {
return gulp.src(['./packages/backend/src/server/web/boot.js', './packages/backend/src/server/web/bios.js', './packages/backend/src/server/web/cli.js'])
.pipe(replace('VERSION', JSON.stringify(meta.version)))
.pipe(replace('LANGS', JSON.stringify(Object.keys(locales))))
.pipe(terser({
toplevel: true

View file

@ -25,6 +25,7 @@ const path = process.env.NODE_ENV === 'test'
export default function load() {
const meta = JSON.parse(fs.readFileSync(`${_dirname}/../../../../built/meta.json`, 'utf-8'));
const clientManifest = JSON.parse(fs.readFileSync(`${_dirname}/../../../../built/manifest.json`, 'utf-8'));
const config = yaml.load(fs.readFileSync(path, 'utf-8')) as Source;
const mixin = {} as Mixin;
@ -45,6 +46,7 @@ export default function load() {
mixin.authUrl = `${mixin.scheme}://${mixin.host}/auth`;
mixin.driveUrl = `${mixin.scheme}://${mixin.host}/files`;
mixin.userAgent = `Misskey/${meta.version} (${config.url})`;
mixin.clientEntry = clientManifest['src/init.ts'].file.replace(/^_client_dist_\//, '');
if (!config.redis.prefix) config.redis.prefix = mixin.host;

View file

@ -80,6 +80,7 @@ export type Mixin = {
authUrl: string;
driveUrl: string;
userAgent: string;
clientEntry: string;
};
export type Config = Source & Mixin;

View file

@ -59,9 +59,10 @@
: '';
const script = document.createElement('script');
script.setAttribute('src', `/assets/app.${v}.js${salt}`);
script.setAttribute('src', `/assets/${CLIENT_ENTRY}${salt}`);
script.setAttribute('async', 'true');
script.setAttribute('defer', 'true');
script.setAttribute('type', 'module');
script.addEventListener('error', async () => {
await checkUpdate();
renderError('APP_FETCH_FAILED');

View file

@ -50,6 +50,10 @@ html
style
include ../style.css
script.
var VERSION = "#{version}";
var CLIENT_ENTRY = "#{config.clientEntry}";
script
include ../boot.js

5
packages/client/@types/theme.d.ts vendored Normal file
View file

@ -0,0 +1,5 @@
import { Theme } from '../src/scripts/theme';
declare module '@/themes/*.json5' {
export = Theme;
}

View file

@ -1,8 +1,8 @@
{
"private": true,
"scripts": {
"watch": "vite build --emptyOutDir --watch",
"build": "vite build --emptyOutDir",
"watch": "vite build --watch",
"build": "vite build",
"lint": "eslint --quiet 'src/**/*.{ts,vue}'"
},
"resolutions": {

View file

@ -255,10 +255,13 @@ type Plugin = {
/**
* ()
*/
import lightTheme from '@/themes/l-light.json5';
import darkTheme from '@/themes/l-dark.json5';
export class ColdDeviceStorage {
public static default = {
lightTheme: require('@/themes/l-light.json5') as Theme,
darkTheme: require('@/themes/d-dark.json5') as Theme,
lightTheme,
darkTheme,
syncDeviceDarkMode: true,
plugins: [] as Plugin[],
mediaVolume: 0.5,

View file

@ -45,7 +45,11 @@ export default defineConfig(({ command, mode }) => {
},
build: {
target: 'esnext',
target: [
'chrome100',
'firefox100',
'safari15',
],
manifest: true,
rollupOptions: {
input: {
@ -57,8 +61,9 @@ export default defineConfig(({ command, mode }) => {
},
},
},
outDir: __dirname + '/../../built/_client_dist_',
assetsDir: 'dest',
outDir: __dirname + '/../../built',
assetsDir: '_client_dist_',
emptyOutDir: false,
},
}
});

View file

@ -56,11 +56,6 @@
lodash "^4.17.19"
to-fast-properties "^2.0.0"
"@cush/relative@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@cush/relative/-/relative-1.0.0.tgz#8cd1769bf9bde3bb27dac356b1bc94af40f6cc16"
integrity sha512-RpfLEtTlyIxeNPGKcokS+p3BZII/Q3bYxryFRglh5H3A3T8q9fsLYm72VYAMEOOIBLEa8o93kFLiBDUWKrwXZA==
"@cypress/request@^2.88.10":
version "2.88.10"
resolved "https://registry.yarnpkg.com/@cypress/request/-/request-2.88.10.tgz#b66d76b07f860d3a4b8d7a0604d020c662752cce"
@ -3058,11 +3053,6 @@ glob-parent@^6.0.1:
dependencies:
is-glob "^4.0.3"
glob-regex@^0.3.0:
version "0.3.2"
resolved "https://registry.yarnpkg.com/glob-regex/-/glob-regex-0.3.2.tgz#27348f2f60648ec32a4a53137090b9fb934f3425"
integrity sha512-m5blUd3/OqDTWwzBBtWBPrGlAzatRywHameHeekAZyZrskYouOGdNB8T/q6JucucvJXtOuyHIn0/Yia7iDasDw==
glob-to-regexp@^0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e"
@ -3145,11 +3135,6 @@ globby@^11.0.4:
merge2 "^1.3.0"
slash "^3.0.0"
globrex@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/globrex/-/globrex-0.1.2.tgz#dd5d9ec826232730cd6793a5e33a9302985e6098"
integrity sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==
graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.4:
version "4.2.4"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb"
@ -5054,16 +5039,6 @@ reconnecting-websocket@^4.4.0:
resolved "https://registry.yarnpkg.com/reconnecting-websocket/-/reconnecting-websocket-4.4.0.tgz#3b0e5b96ef119e78a03135865b8bb0af1b948783"
integrity sha512-D2E33ceRPga0NvTDhJmphEgJ7FUYF0v4lr1ki0csq06OdlxKfugGzN0dSkxM/NfqCxYELK4KcaTOUOjTV6Dcng==
recrawl-sync@^2.0.3:
version "2.2.2"
resolved "https://registry.yarnpkg.com/recrawl-sync/-/recrawl-sync-2.2.2.tgz#a5a8664c77267d603d601825af544d6716d69e15"
integrity sha512-E2sI4F25Fu2nrfV+KsnC7/qfk/spQIYXlonfQoS4rwxeNK5BjxnLPbWiRXHVXPwYBOTWtPX5765kTm/zJiL+LQ==
dependencies:
"@cush/relative" "^1.0.0"
glob-regex "^0.3.0"
slash "^3.0.0"
tslib "^1.9.3"
reflect-metadata@0.1.13:
version "0.1.13"
resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.13.tgz#67ae3ca57c972a2aa1642b10fe363fe32d49dc08"
@ -5776,7 +5751,7 @@ tsc-alias@1.5.0:
mylas "^2.1.6"
normalize-path "^3.0.0"
tsconfig-paths@3.14.1, tsconfig-paths@^3.14.1, tsconfig-paths@^3.9.0:
tsconfig-paths@3.14.1, tsconfig-paths@^3.14.1:
version "3.14.1"
resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz#ba0734599e8ea36c862798e920bcf163277b137a"
integrity sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ==
@ -5791,11 +5766,6 @@ tslib@^1.8.1, tslib@^1.9.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.1.tgz#eb15d128827fbee2841549e171f45ed338ac7e35"
integrity sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==
tslib@^1.9.3:
version "1.14.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
tslib@~2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.1.0.tgz#da60860f1c2ecaa5703ab7d39bc05b6bf988b97a"