Skip to content

Commit

Permalink
Tabler iconsのセルフホスティングをやめる (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
adzukimame authored Oct 18, 2024
1 parent 719b570 commit 22046d5
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 26 deletions.
2 changes: 1 addition & 1 deletion packages/backend/src/server/SecurityHeaderService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class SecurityHeaderService {
...(this.config.contentSecurityPolicy?.frameSrc ?? []),
].join(' ');

this.basePolicy = `default-src 'self'; script-src ${baseScriptSrc}; style-src 'self' 'unsafe-inline' https://hcaptcha.com https://*.hcaptcha.com; img-src ${imgSrc}; media-src ${mediaSrc}; connect-src 'self' https://hcaptcha.com https://*.hcaptcha.com https://cloudflareinsights.com/cdn-cgi/rum; frame-src ${frameSrc}; object-src 'none'; base-uri 'none'; form-action 'self'; frame-ancestors 'none';${this.reportEnabled ? ' report-to csp;' : ''}`;
this.basePolicy = `default-src 'self'; script-src ${baseScriptSrc}; style-src 'self' 'unsafe-inline' https://hcaptcha.com https://*.hcaptcha.com https://cdn.jsdelivr.net/npm/@tabler/[email protected]/dist/tabler-icons.min.css; font-src 'self' https://cdn.jsdelivr.net/npm/@tabler/[email protected]/dist/fonts/; img-src ${imgSrc}; media-src ${mediaSrc}; connect-src 'self' https://hcaptcha.com https://*.hcaptcha.com https://cloudflareinsights.com/cdn-cgi/rum; frame-src ${frameSrc}; object-src 'none'; base-uri 'none'; form-action 'self'; frame-ancestors 'none';${this.reportEnabled ? ' report-to csp;' : ''}`;
//#endregion

//#region bios.pug, cli.pug, flush.pug
Expand Down
4 changes: 2 additions & 2 deletions packages/backend/src/server/web/views/base.pug
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ html
link(rel='prefetch' href=serverErrorImageUrl)
link(rel='prefetch' href=infoImageUrl)
link(rel='prefetch' href=notFoundImageUrl)
//- https://github.com/misskey-dev/misskey/issues/9842
link(rel='stylesheet' href='/assets/tabler-icons/tabler-icons.min.css?v3.3.0')
link(rel='preconnect' href='https://cdn.jsdelivr.net')
link(rel='stylesheet' href='https://cdn.jsdelivr.net/npm/@tabler/icons[email protected]/dist/tabler-icons.min.css')
link(rel='modulepreload' href=`/vite/${clientEntry.file}`)

if !config.clientManifestExists
Expand Down
1 change: 0 additions & 1 deletion packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"@rollup/plugin-replace": "5.0.7",
"@rollup/pluginutils": "5.1.0",
"@syuilo/aiscript": "0.19.0",
"@tabler/icons-webfont": "3.3.0",
"@vitejs/plugin-vue": "5.1.0",
"@vue/compiler-sfc": "3.4.37",
"aiscript-vscode": "github:aiscript-dev/aiscript-vscode#v0.1.11",
Expand Down
1 change: 0 additions & 1 deletion packages/frontend/src/_dev_boot_.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// devモードで起動される際(index.htmlを使うとき)はrouterが暴発してしまってうまく読み込めない。
// よって、devモードとして起動されるときはビルド時に組み込む形としておく。
// (pnpm start時はpugファイルの中で静的リソースとして読み込むようになっており、この問題は起こっていない)
import '@tabler/icons-webfont/dist/tabler-icons.scss';

await main();

Expand Down
5 changes: 4 additions & 1 deletion packages/frontend/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@
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';
style-src 'self' 'unsafe-inline' cdn.jsdelivr.net;
font-src 'self' cdn.jsdelivr.net;
img-src 'self' data: blob: www.google.com xn--931a.moe cdn.jsdelivr.net 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">
<link rel="preconnect" href="https://cdn.jsdelivr.net" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tabler/[email protected]/dist/tabler-icons.min.css" />
</head>

<body>
Expand Down
15 changes: 0 additions & 15 deletions pnpm-lock.yaml

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

5 changes: 0 additions & 5 deletions scripts/build-assets.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ async function loadConfig() {
return fs.readFile(configPath, 'utf-8').then(data => yaml.load(data)).catch(() => null);
}

async function copyFrontendTablerIcons() {
await fs.cp('./packages/frontend/node_modules/@tabler/icons-webfont/dist', './built/_frontend_dist_/tabler-icons', { dereference: true, recursive: true });
}

async function copyFrontendLocales() {
generateDTS();

Expand Down Expand Up @@ -81,7 +77,6 @@ async function buildBackendStyle() {

async function build() {
await Promise.all([
copyFrontendTablerIcons(),
copyFrontendLocales(),
copyBackendViews(),
buildBackendScript(),
Expand Down

0 comments on commit 22046d5

Please sign in to comment.