revert embed dev
This commit is contained in:
parent
a8dca26788
commit
7a5fa3b9a7
|
@ -4,7 +4,6 @@
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"watch": "vite",
|
"watch": "vite",
|
||||||
"dev": "vite --config vite.config.local-dev.ts --debug hmr",
|
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"typecheck": "vue-tsc --noEmit",
|
"typecheck": "vue-tsc --noEmit",
|
||||||
"eslint": "eslint --quiet \"src/**/*.{ts,vue}\"",
|
"eslint": "eslint --quiet \"src/**/*.{ts,vue}\"",
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
<!--
|
|
||||||
SPDX-FileCopyrightText: syuilo and misskey-project
|
|
||||||
SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!--
|
|
||||||
開発モードのviteはこのファイルを起点にサーバーを起動します。
|
|
||||||
このファイルに書かれた [t]js のリンクと (s)cssのリンクと、その依存関係にあるファイルはビルドされます
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<title>[DEV] Loading...</title>
|
|
||||||
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
|
|
||||||
<meta
|
|
||||||
http-equiv="Content-Security-Policy"
|
|
||||||
content="default-src 'self' https://newassets.hcaptcha.com/ https://challenges.cloudflare.com/ http://localhost:7493/;
|
|
||||||
worker-src 'self';
|
|
||||||
script-src 'self' 'unsafe-eval' https://*.hcaptcha.com https://challenges.cloudflare.com https://esm.sh;
|
|
||||||
style-src 'self' 'unsafe-inline';
|
|
||||||
img-src 'self' data: blob: www.google.com xn--931a.moe localhost:3000 localhost:5173 127.0.0.1:5173 127.0.0.1:3000;
|
|
||||||
media-src 'self' localhost:3000 localhost:5173 127.0.0.1:5173 127.0.0.1:3000;
|
|
||||||
connect-src 'self' localhost:3000 localhost:5173 127.0.0.1:5173 127.0.0.1:3000 https://newassets.hcaptcha.com;
|
|
||||||
frame-src *;"
|
|
||||||
/>
|
|
||||||
<meta property="og:site_name" content="[DEV BUILD] Misskey" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div id="misskey_app"></div>
|
|
||||||
<script type="module" src="./boot.ts"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,96 +0,0 @@
|
||||||
import dns from 'dns';
|
|
||||||
import { readFile } from 'node:fs/promises';
|
|
||||||
import type { IncomingMessage } from 'node:http';
|
|
||||||
import { defineConfig } from 'vite';
|
|
||||||
import type { UserConfig } from 'vite';
|
|
||||||
import * as yaml from 'js-yaml';
|
|
||||||
import locales from '../../locales/index.js';
|
|
||||||
import { getConfig } from './vite.config.js';
|
|
||||||
|
|
||||||
dns.setDefaultResultOrder('ipv4first');
|
|
||||||
|
|
||||||
const defaultConfig = getConfig();
|
|
||||||
|
|
||||||
const { port } = yaml.load(await readFile('../../.config/default.yml', 'utf-8'));
|
|
||||||
|
|
||||||
const httpUrl = `http://localhost:${port}/`;
|
|
||||||
const websocketUrl = `ws://localhost:${port}/`;
|
|
||||||
|
|
||||||
// activitypubリクエストはProxyを通し、それ以外はViteの開発サーバーを返す
|
|
||||||
function varyHandler(req: IncomingMessage) {
|
|
||||||
if (req.headers.accept?.includes('application/activity+json')) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return '/index.html';
|
|
||||||
}
|
|
||||||
|
|
||||||
const devConfig: UserConfig = {
|
|
||||||
// 基本の設定は vite.config.js から引き継ぐ
|
|
||||||
...defaultConfig,
|
|
||||||
root: 'src',
|
|
||||||
publicDir: '../assets',
|
|
||||||
base: '/embed',
|
|
||||||
server: {
|
|
||||||
host: 'localhost',
|
|
||||||
port: 5174,
|
|
||||||
proxy: {
|
|
||||||
'/api': {
|
|
||||||
changeOrigin: true,
|
|
||||||
target: httpUrl,
|
|
||||||
},
|
|
||||||
'/assets': httpUrl,
|
|
||||||
'/static-assets': httpUrl,
|
|
||||||
'/client-assets': httpUrl,
|
|
||||||
'/files': httpUrl,
|
|
||||||
'/twemoji': httpUrl,
|
|
||||||
'/fluent-emoji': httpUrl,
|
|
||||||
'/sw.js': httpUrl,
|
|
||||||
'/streaming': {
|
|
||||||
target: websocketUrl,
|
|
||||||
ws: true,
|
|
||||||
},
|
|
||||||
'/favicon.ico': httpUrl,
|
|
||||||
'/robots.txt': httpUrl,
|
|
||||||
'/embed.js': httpUrl,
|
|
||||||
'/identicon': {
|
|
||||||
target: httpUrl,
|
|
||||||
rewrite(path) {
|
|
||||||
return path.replace('@localhost:5173', '');
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'/url': httpUrl,
|
|
||||||
'/proxy': httpUrl,
|
|
||||||
'/_info_card_': httpUrl,
|
|
||||||
'/bios': httpUrl,
|
|
||||||
'/cli': httpUrl,
|
|
||||||
'/inbox': httpUrl,
|
|
||||||
'/emoji/': httpUrl,
|
|
||||||
'/notes': {
|
|
||||||
target: httpUrl,
|
|
||||||
bypass: varyHandler,
|
|
||||||
},
|
|
||||||
'/users': {
|
|
||||||
target: httpUrl,
|
|
||||||
bypass: varyHandler,
|
|
||||||
},
|
|
||||||
'/.well-known': {
|
|
||||||
target: httpUrl,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
build: {
|
|
||||||
...defaultConfig.build,
|
|
||||||
rollupOptions: {
|
|
||||||
...defaultConfig.build?.rollupOptions,
|
|
||||||
input: 'index.html',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
define: {
|
|
||||||
...defaultConfig.define,
|
|
||||||
_LANGS_FULL_: JSON.stringify(Object.entries(locales)),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default defineConfig(({ command, mode }) => devConfig);
|
|
||||||
|
|
Loading…
Reference in New Issue