From 4b98b446bee6eefb05141d6d400271ba131e709d Mon Sep 17 00:00:00 2001
From: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>
Date: Sat, 8 Feb 2025 17:31:28 +0900
Subject: enhance(frontend): クライアントエラー画面の多言語対応 (#15411)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* enhance(frontend): クライアントエラー画面のマルチリンガル対応
* Update Changelog
* update message
---
packages/backend/src/server/web/boot.embed.js | 12 ++++++---
packages/backend/src/server/web/boot.js | 38 +++++++++++++++++++--------
2 files changed, 35 insertions(+), 15 deletions(-)
(limited to 'packages/backend/src/server/web')
diff --git a/packages/backend/src/server/web/boot.embed.js b/packages/backend/src/server/web/boot.embed.js
index 48d1cd262b..9de1275380 100644
--- a/packages/backend/src/server/web/boot.embed.js
+++ b/packages/backend/src/server/web/boot.embed.js
@@ -114,13 +114,17 @@
if (document.readyState === 'loading') {
await new Promise(resolve => window.addEventListener('DOMContentLoaded', resolve));
}
+
+ const locale = JSON.parse(localStorage.getItem('locale') || '{}');
+
+ const title = locale?._bootErrors?.title || 'Failed to initialize Misskey';
+ const reload = locale?.reload || 'Reload';
+
document.body.innerHTML = `
-
読み込みに失敗しました
- Failed to initialize Misskey
+ ${title}
Error Code: ${code}
`;
addStyle(`
#misskey_app,
diff --git a/packages/backend/src/server/web/boot.js b/packages/backend/src/server/web/boot.js
index a04640d993..b55d327f86 100644
--- a/packages/backend/src/server/web/boot.js
+++ b/packages/backend/src/server/web/boot.js
@@ -151,6 +151,22 @@
await new Promise(resolve => window.addEventListener('DOMContentLoaded', resolve));
}
+ const locale = JSON.parse(localStorage.getItem('locale') || '{}');
+
+ const messages = Object.assign({
+ title: 'Failed to initialize Misskey',
+ solution: 'The following actions may solve the problem.',
+ solution1: 'Update your os and browser',
+ solution2: 'Disable an adblocker',
+ solution3: 'Clear the browser cache',
+ solution4: '(Tor Browser) Set dom.webaudio.enabled to true',
+ otherOption: 'Other options',
+ otherOption1: 'Clear preferences and cache',
+ otherOption2: 'Start the simple client',
+ otherOption3: 'Start the repair tool',
+ }, locale?._bootErrors || {});
+ const reload = locale?.reload || 'Reload';
+
let errorsElement = document.getElementById('errors');
if (!errorsElement) {
@@ -160,32 +176,32 @@
- Failed to load
読み込みに失敗しました
+ ${messages.title}
- The following actions may solve the problem. / 以下を行うと解決する可能性があります。
- Update your os and browser / ブラウザおよびOSを最新バージョンに更新する
- Disable an adblocker / アドブロッカーを無効にする
- Clear the browser cache / ブラウザのキャッシュをクリアする
- (Tor Browser) Set dom.webaudio.enabled to true / dom.webaudio.enabledをtrueに設定する
+ ${messages.solution}
+ ${messages.solution1}
+ ${messages.solution2}
+ ${messages.solution3}
+ ${messages.solution4}
- Other options / その他のオプション
+ ${messages.otherOption}
--
cgit v1.2.3-freya
From 1b44954dcbca4c1d71f04ee384db8812811126c6 Mon Sep 17 00:00:00 2001
From: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>
Date: Mon, 24 Feb 2025 14:23:20 +0900
Subject: enhance(frontend): サーバーエラー画面の多言語対応 (#15549)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* enhance(frontend): サーバーエラー画面の多言語対応
* indent
---
packages/backend/src/server/web/error.css | 107 +++++++++++-------------
packages/backend/src/server/web/error.js | 40 +++++++++
packages/backend/src/server/web/views/error.pug | 52 +++++++-----
scripts/build-assets.mjs | 3 +-
4 files changed, 122 insertions(+), 80 deletions(-)
create mode 100644 packages/backend/src/server/web/error.js
(limited to 'packages/backend/src/server/web')
diff --git a/packages/backend/src/server/web/error.css b/packages/backend/src/server/web/error.css
index f2b63296eb..803bd1b4b5 100644
--- a/packages/backend/src/server/web/error.css
+++ b/packages/backend/src/server/web/error.css
@@ -5,112 +5,107 @@
*/
* {
- font-family: BIZ UDGothic, Roboto, HelveticaNeue, Arial, sans-serif;
+ font-family: BIZ UDGothic, Roboto, HelveticaNeue, Arial, sans-serif;
}
#misskey_app,
#splash {
- display: none !important;
+ display: none !important;
}
body,
html {
- background-color: #222;
- color: #dfddcc;
- justify-content: center;
- margin: auto;
- padding: 10px;
- text-align: center;
+ background-color: #222;
+ color: #dfddcc;
+ justify-content: center;
+ margin: auto;
+ padding: 10px;
+ text-align: center;
}
button {
- border-radius: 999px;
- padding: 0px 12px 0px 12px;
- border: none;
- cursor: pointer;
- margin-bottom: 12px;
+ border-radius: 999px;
+ padding: 0px 12px 0px 12px;
+ border: none;
+ cursor: pointer;
+ margin-bottom: 12px;
}
.button-big {
- background: linear-gradient(90deg, rgb(134, 179, 0), rgb(74, 179, 0));
- line-height: 50px;
+ background: linear-gradient(90deg, rgb(134, 179, 0), rgb(74, 179, 0));
+ line-height: 50px;
}
.button-big:hover {
- background: rgb(153, 204, 0);
+ background: rgb(153, 204, 0);
}
.button-small {
- background: #444;
- line-height: 40px;
+ background: #444;
+ line-height: 40px;
}
.button-small:hover {
- background: #555;
+ background: #555;
}
.button-label-big {
- color: #222;
- font-weight: bold;
- font-size: 20px;
- padding: 12px;
+ color: #222;
+ font-weight: bold;
+ font-size: 1.2em;
+ padding: 12px;
}
.button-label-small {
- color: rgb(153, 204, 0);
- font-size: 16px;
- padding: 12px;
+ color: rgb(153, 204, 0);
+ font-size: 16px;
+ padding: 12px;
}
a {
- color: rgb(134, 179, 0);
- text-decoration: none;
+ color: rgb(134, 179, 0);
+ text-decoration: none;
}
p,
li {
- font-size: 16px;
-}
-
-.dont-worry,
-#msg {
- font-size: 18px;
+ font-size: 16px;
}
.icon-warning {
- color: #dec340;
- height: 4rem;
- padding-top: 2rem;
+ color: #dec340;
+ height: 4rem;
+ padding-top: 2rem;
}
h1 {
- font-size: 32px;
+ font-size: 1.5em;
+ margin: 1em;
}
code {
- display: block;
- font-family: Fira, FiraCode, monospace;
- background: #333;
- padding: 0.5rem 1rem;
- max-width: 40rem;
- border-radius: 10px;
- justify-content: center;
- margin: auto;
- white-space: pre-wrap;
- word-break: break-word;
+ display: block;
+ font-family: Fira, FiraCode, monospace;
+ background: #333;
+ padding: 0.5rem 1rem;
+ max-width: 40rem;
+ border-radius: 10px;
+ justify-content: center;
+ margin: auto;
+ white-space: pre-wrap;
+ word-break: break-word;
}
-summary {
- cursor: pointer;
+#errorInfo summary {
+ cursor: pointer;
}
-summary > * {
- display: inline;
- white-space: pre-wrap;
+#errorInfo summary>* {
+ display: inline;
}
@media screen and (max-width: 500px) {
- details {
- width: 50%;
- }
+ #errorInfo {
+ width: 50%;
+ }
}
diff --git a/packages/backend/src/server/web/error.js b/packages/backend/src/server/web/error.js
new file mode 100644
index 0000000000..4838dd6ef3
--- /dev/null
+++ b/packages/backend/src/server/web/error.js
@@ -0,0 +1,40 @@
+/*
+ * SPDX-FileCopyrightText: syuilo and misskey-project
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+'use strict';
+
+(() => {
+ document.addEventListener('DOMContentLoaded', () => {
+ const locale = JSON.parse(localStorage.getItem('locale') || '{}');
+
+ const messages = Object.assign({
+ title: 'Failed to initialize Misskey',
+ serverError: 'If reloading after a period of time does not resolve the problem, contact the server administrator with the following ERROR ID.',
+ solution: 'The following actions may solve the problem.',
+ solution1: 'Update your os and browser',
+ solution2: 'Disable an adblocker',
+ solution3: 'Clear the browser cache',
+ solution4: '(Tor Browser) Set dom.webaudio.enabled to true',
+ otherOption: 'Other options',
+ otherOption1: 'Clear preferences and cache',
+ otherOption2: 'Start the simple client',
+ otherOption3: 'Start the repair tool',
+ }, locale?._bootErrors || {});
+ const reload = locale?.reload || 'Reload';
+
+ const reloadEls = document.querySelectorAll('[data-i18n-reload]');
+ for (const el of reloadEls) {
+ el.textContent = reload;
+ }
+
+ const i18nEls = document.querySelectorAll('[data-i18n]');
+ for (const el of i18nEls) {
+ const key = el.dataset.i18n;
+ if (key && messages[key]) {
+ el.textContent = messages[key];
+ }
+ }
+ });
+})();
diff --git a/packages/backend/src/server/web/views/error.pug b/packages/backend/src/server/web/views/error.pug
index 44ebf53cf7..6a78d1878c 100644
--- a/packages/backend/src/server/web/views/error.pug
+++ b/packages/backend/src/server/web/views/error.pug
@@ -2,15 +2,15 @@ doctype html
//
-
- _____ _ _
- | |_|___ ___| |_ ___ _ _
+ _____ _ _
+ | |_|___ ___| |_ ___ _ _
| | | | |_ -|_ -| '_| -_| | |
|_|_|_|_|___|___|_,_|___|_ |
- |___|
+ |___|
Thank you for using Misskey!
If you are reading this message... how about joining the development?
https://github.com/misskey-dev/misskey
-
+
html
@@ -27,39 +27,45 @@ html
style
include ../error.css
+ script
+ include ../error.js
+
body
svg.icon-warning(xmlns="http://www.w3.org/2000/svg", viewBox="0 0 24 24", stroke-width="2", stroke="currentColor", fill="none", stroke-linecap="round", stroke-linejoin="round")
path(stroke="none", d="M0 0h24v24H0z", fill="none")
path(d="M12 9v2m0 4v.01")
path(d="M5 19h14a2 2 0 0 0 1.84 -2.75l-7.1 -12.25a2 2 0 0 0 -3.5 0l-7.1 12.25a2 2 0 0 0 1.75 2.75")
- h1 An error has occurred!
+ h1(data-i18n="title") Failed to initialize Misskey
button.button-big(onclick="location.reload();")
- span.button-label-big Refresh
-
- p.dont-worry Don't worry, it's (probably) not your fault.
+ span.button-label-big(data-i18n-reload) Reload
- p If reloading after a period of time does not resolve the problem, contact the server administrator with the following ERROR ID.
+ p(data-i18n="serverError") If reloading after a period of time does not resolve the problem, contact the server administrator with the following ERROR ID.
div#errors
code.
ERROR CODE: #{code}
ERROR ID: #{id}
- p You may also try the following options:
+ p
+ b(data-i18n="solution") The following actions may solve the problem.
- p Update your os and browser.
- p Disable an adblocker.
+ p(data-i18n="solution1") Update your os and browser
+ p(data-i18n="solution2") Disable an adblocker
+ p(data-i18n="solution3") Clear your browser cache
+ p(data-i18n="solution4") (Tor Browser) Set dom.webaudio.enabled to true
- a(href="/flush")
- button.button-small
- span.button-label-small Clear preferences and cache
- br
- a(href="/cli")
- button.button-small
- span.button-label-small Start the simple client
- br
- a(href="/bios")
- button.button-small
- span.button-label-small Start the repair tool
+ details(style="color: #86b300;")
+ summary(data-i18n="otherOption") Other options
+ a(href="/flush")
+ button.button-small
+ span.button-label-small(data-i18n="otherOption1") Clear preferences and cache
+ br
+ a(href="/cli")
+ button.button-small
+ span.button-label-small(data-i18n="otherOption2") Start the simple client
+ br
+ a(href="/bios")
+ button.button-small
+ span.button-label-small(data-i18n="otherOption3") Start the repair tool
diff --git a/scripts/build-assets.mjs b/scripts/build-assets.mjs
index 421d4a6d1b..8ab341795c 100644
--- a/scripts/build-assets.mjs
+++ b/scripts/build-assets.mjs
@@ -60,7 +60,8 @@ async function buildBackendScript() {
'./packages/backend/src/server/web/boot.js',
'./packages/backend/src/server/web/boot.embed.js',
'./packages/backend/src/server/web/bios.js',
- './packages/backend/src/server/web/cli.js'
+ './packages/backend/src/server/web/cli.js',
+ './packages/backend/src/server/web/error.js',
]) {
let source = await fs.readFile(file, { encoding: 'utf-8' });
source = source.replaceAll('LANGS', JSON.stringify(Object.keys(locales)));
--
cgit v1.2.3-freya
From 22228b6756ff534a94930774d9b6744dfb5961fe Mon Sep 17 00:00:00 2001
From: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>
Date: Thu, 6 Mar 2025 17:05:14 +0900
Subject: enhance: OAuth2 (IndieAuth)
でロゴが提供されている場合は表示するように (#15578)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* enhance: OAuthでロゴが提供されている場合は表示するように
* Update Changelog
* refactor
* fix
* fix test
---
CHANGELOG.md | 2 +
.../src/server/oauth/OAuth2ProviderService.ts | 17 +++++--
packages/backend/src/server/web/views/oauth.pug | 2 +
packages/backend/test/e2e/oauth.ts | 56 +++++++++++++++++++++-
packages/frontend/src/pages/oauth.vue | 2 +
5 files changed, 75 insertions(+), 4 deletions(-)
(limited to 'packages/backend/src/server/web')
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 21c589376b..197de5aec7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,8 @@
### General
- Enhance: プロキシアカウントをシステムアカウントとして作成するように
+- Enhance: OAuthで外部アプリからロゴが提供されている場合、それを表示できるように
+ 書式は https://indieauth.spec.indieweb.org/20220212/#example-2 に準じます。
- Fix: システムアカウントが削除できる問題を修正
### Client
diff --git a/packages/backend/src/server/oauth/OAuth2ProviderService.ts b/packages/backend/src/server/oauth/OAuth2ProviderService.ts
index e065c451f1..cdd7102666 100644
--- a/packages/backend/src/server/oauth/OAuth2ProviderService.ts
+++ b/packages/backend/src/server/oauth/OAuth2ProviderService.ts
@@ -95,6 +95,7 @@ interface ClientInformation {
id: string;
redirectUris: string[];
name: string;
+ logo: string | null;
}
// https://indieauth.spec.indieweb.org/#client-information-discovery
@@ -124,11 +125,19 @@ async function discoverClientInformation(logger: Logger, httpRequestService: Htt
redirectUris.push(...[...fragment.querySelectorAll('link[rel=redirect_uri][href]')].map(el => el.href));
let name = id;
+ let logo: string | null = null;
if (text) {
const microformats = mf2(text, { baseUrl: res.url });
- const nameProperty = microformats.items.find(item => item.type?.includes('h-app') && item.properties.url.includes(id))?.properties.name[0];
- if (typeof nameProperty === 'string') {
- name = nameProperty;
+ const correspondingProperties = microformats.items.find(item => item.type?.includes('h-app') && item.properties.url.includes(id));
+ if (correspondingProperties) {
+ const nameProperty = correspondingProperties.properties.name?.[0];
+ if (typeof nameProperty === 'string') {
+ name = nameProperty;
+ }
+ const logoProperty = correspondingProperties.properties.logo?.[0];
+ if (typeof logoProperty === 'string') {
+ logo = logoProperty;
+ }
}
}
@@ -136,6 +145,7 @@ async function discoverClientInformation(logger: Logger, httpRequestService: Htt
id,
redirectUris: redirectUris.map(uri => new URL(uri, res.url).toString()),
name: typeof name === 'string' ? name : id,
+ logo,
};
} catch (err) {
console.error(err);
@@ -379,6 +389,7 @@ export class OAuth2ProviderService {
return await reply.view('oauth', {
transactionId: oauth2.transactionID,
clientName: oauth2.client.name,
+ clientLogo: oauth2.client.logo,
scope: oauth2.req.scope.join(' '),
});
});
diff --git a/packages/backend/src/server/web/views/oauth.pug b/packages/backend/src/server/web/views/oauth.pug
index 1470dbfbdf..4195ccc3a3 100644
--- a/packages/backend/src/server/web/views/oauth.pug
+++ b/packages/backend/src/server/web/views/oauth.pug
@@ -6,4 +6,6 @@ block meta
//- XXX: Remove navigation bar in auth page?
meta(name='misskey:oauth:transaction-id' content=transactionId)
meta(name='misskey:oauth:client-name' content=clientName)
+ if clientLogo
+ meta(name='misskey:oauth:client-logo' content=clientLogo)
meta(name='misskey:oauth:scope' content=scope)
diff --git a/packages/backend/test/e2e/oauth.ts b/packages/backend/test/e2e/oauth.ts
index ef7a6a579d..f639f90ea6 100644
--- a/packages/backend/test/e2e/oauth.ts
+++ b/packages/backend/test/e2e/oauth.ts
@@ -72,11 +72,12 @@ const clientConfig: ModuleOptions<'client_id'> = {
},
};
-function getMeta(html: string): { transactionId: string | undefined, clientName: string | undefined } {
+function getMeta(html: string): { transactionId: string | undefined, clientName: string | undefined, clientLogo: string | undefined } {
const fragment = JSDOM.fragment(html);
return {
transactionId: fragment.querySelector('meta[name="misskey:oauth:transaction-id"]')?.content,
clientName: fragment.querySelector('meta[name="misskey:oauth:client-name"]')?.content,
+ clientLogo: fragment.querySelector('meta[name="misskey:oauth:client-logo"]')?.content,
};
}
@@ -915,6 +916,59 @@ describe('OAuth', () => {
assert.strictEqual(getMeta(await response.text()).clientName, `http://127.0.0.1:${clientPort}/`);
});
+ test('With Logo', async () => {
+ sender = (reply): void => {
+ reply.header('Link', '; rel="redirect_uri"');
+ reply.send(`
+
+
+ `);
+ reply.send();
+ };
+
+ const client = new AuthorizationCode(clientConfig);
+
+ const response = await fetch(client.authorizeURL({
+ redirect_uri,
+ scope: 'write:notes',
+ state: 'state',
+ code_challenge: 'code',
+ code_challenge_method: 'S256',
+ } as AuthorizationParamsExtended));
+ assert.strictEqual(response.status, 200);
+ const meta = getMeta(await response.text());
+ assert.strictEqual(meta.clientName, 'Misklient');
+ assert.strictEqual(meta.clientLogo, `http://127.0.0.1:${clientPort}/logo.png`);
+ });
+
+ test('Missing Logo', async () => {
+ sender = (reply): void => {
+ reply.header('Link', '; rel="redirect_uri"');
+ reply.send(`
+
+ Misklient
+ `);
+ reply.send();
+ };
+
+ const client = new AuthorizationCode(clientConfig);
+
+ const response = await fetch(client.authorizeURL({
+ redirect_uri,
+ scope: 'write:notes',
+ state: 'state',
+ code_challenge: 'code',
+ code_challenge_method: 'S256',
+ } as AuthorizationParamsExtended));
+ assert.strictEqual(response.status, 200);
+ const meta = getMeta(await response.text());
+ assert.strictEqual(meta.clientName, 'Misklient');
+ assert.strictEqual(meta.clientLogo, undefined);
+ });
+
test('Mismatching URL in h-app', async () => {
sender = (reply): void => {
reply.header('Link', '; rel="redirect_uri"');
diff --git a/packages/frontend/src/pages/oauth.vue b/packages/frontend/src/pages/oauth.vue
index 8719a769e5..860c884d13 100644
--- a/packages/frontend/src/pages/oauth.vue
+++ b/packages/frontend/src/pages/oauth.vue
@@ -11,6 +11,7 @@ SPDX-License-Identifier: AGPL-3.0-only
('meta[name="misskey:oauth:client-name"]')?.content;
+const logo = document.querySelector('meta[name="misskey:oauth:client-logo"]')?.content;
const permissions = document.querySelector('meta[name="misskey:oauth:scope"]')?.content.split(' ').filter((p): p is typeof Misskey.permissions[number] => (Misskey.permissions as readonly string[]).includes(p)) ?? [];
function doPost(token: string, decision: 'accept' | 'deny') {
--
cgit v1.2.3-freya
From 7bfada9792bc4d29d47d3895643543cbe15191cd Mon Sep 17 00:00:00 2001
From: syuilo <4439005+syuilo@users.noreply.github.com>
Date: Sun, 16 Mar 2025 13:03:02 +0900
Subject: enhance: remove bull-board support
---
.github/dependabot.yml | 3 -
CHANGELOG.md | 3 +-
packages/backend/package.json | 3 -
.../backend/src/server/api/ApiServerService.ts | 3 -
.../backend/src/server/web/ClientServerService.ts | 62 -------------------
packages/backend/test/e2e/fetch-resource.ts | 32 +++-------
packages/backend/test/utils.ts | 6 +-
packages/frontend/src/pages/admin/queue.vue | 13 +---
pnpm-lock.yaml | 72 ----------------------
9 files changed, 13 insertions(+), 184 deletions(-)
(limited to 'packages/backend/src/server/web')
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index b1c256225d..b93080278d 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -24,9 +24,6 @@ updates:
aws-sdk:
patterns:
- "@aws-sdk/*"
- bull-board:
- patterns:
- - "@bull-board/*"
nestjs:
patterns:
- "@nestjs/*"
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 812e0b5d34..b6fcbba1b5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,7 +1,8 @@
## 2025.3.2
### General
--
+- セキュリティを強化するため、ジョブキューのダッシュボード(bull-board)統合が削除されました。
+ - Misskeyネイティブでダッシュボードを実装予定です
### Client
- Feat: 設定の管理が強化されました
diff --git a/packages/backend/package.json b/packages/backend/package.json
index cee5c7205b..502323bf61 100644
--- a/packages/backend/package.json
+++ b/packages/backend/package.json
@@ -69,9 +69,6 @@
"dependencies": {
"@aws-sdk/client-s3": "3.749.0",
"@aws-sdk/lib-storage": "3.749.0",
- "@bull-board/api": "6.7.7",
- "@bull-board/fastify": "6.7.7",
- "@bull-board/ui": "6.7.7",
"@discordapp/twemoji": "15.1.0",
"@fastify/accepts": "5.0.2",
"@fastify/cookie": "11.0.2",
diff --git a/packages/backend/src/server/api/ApiServerService.ts b/packages/backend/src/server/api/ApiServerService.ts
index 3a8cb19f01..32818003ad 100644
--- a/packages/backend/src/server/api/ApiServerService.ts
+++ b/packages/backend/src/server/api/ApiServerService.ts
@@ -6,7 +6,6 @@
import { Inject, Injectable } from '@nestjs/common';
import cors from '@fastify/cors';
import multipart from '@fastify/multipart';
-import fastifyCookie from '@fastify/cookie';
import { ModuleRef } from '@nestjs/core';
import { AuthenticationResponseJSON } from '@simplewebauthn/types';
import type { Config } from '@/config.js';
@@ -57,8 +56,6 @@ export class ApiServerService {
},
});
- fastify.register(fastifyCookie, {});
-
// Prevent cache
fastify.addHook('onRequest', (request, reply, done) => {
reply.header('Cache-Control', 'private, max-age=0, must-revalidate');
diff --git a/packages/backend/src/server/web/ClientServerService.ts b/packages/backend/src/server/web/ClientServerService.ts
index f8b3843cac..927970e2e2 100644
--- a/packages/backend/src/server/web/ClientServerService.ts
+++ b/packages/backend/src/server/web/ClientServerService.ts
@@ -7,16 +7,12 @@ import { randomUUID } from 'node:crypto';
import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { Inject, Injectable } from '@nestjs/common';
-import { createBullBoard } from '@bull-board/api';
-import { BullMQAdapter } from '@bull-board/api/bullMQAdapter.js';
-import { FastifyAdapter as BullBoardFastifyAdapter } from '@bull-board/fastify';
import ms from 'ms';
import sharp from 'sharp';
import pug from 'pug';
import { In, IsNull } from 'typeorm';
import fastifyStatic from '@fastify/static';
import fastifyView from '@fastify/view';
-import fastifyCookie from '@fastify/cookie';
import fastifyProxy from '@fastify/http-proxy';
import vary from 'vary';
import htmlSafeJsonStringify from 'htmlescape';
@@ -221,64 +217,6 @@ export class ClientServerService {
@bindThis
public createServer(fastify: FastifyInstance, options: FastifyPluginOptions, done: (err?: Error) => void) {
- fastify.register(fastifyCookie, {});
-
- //#region Bull Dashboard
- const bullBoardPath = '/queue';
-
- // Authenticate
- fastify.addHook('onRequest', async (request, reply) => {
- if (request.routeOptions.url == null) {
- reply.code(404).send('Not found');
- return;
- }
-
- // %71ueueとかでリクエストされたら困るため
- const url = decodeURI(request.routeOptions.url);
- if (url === bullBoardPath || url.startsWith(bullBoardPath + '/')) {
- if (!url.startsWith(bullBoardPath + '/static/')) {
- reply.header('Cache-Control', 'private, max-age=0, must-revalidate');
- }
-
- const token = request.cookies.token;
- if (token == null) {
- reply.code(401).send('Login required');
- return;
- }
- const user = await this.usersRepository.findOneBy({ token });
- if (user == null) {
- reply.code(403).send('No such user');
- return;
- }
- const isAdministrator = await this.roleService.isAdministrator(user);
- if (!isAdministrator) {
- reply.code(403).send('Access denied');
- return;
- }
- }
- });
-
- const bullBoardServerAdapter = new BullBoardFastifyAdapter();
-
- createBullBoard({
- queues: [
- this.systemQueue,
- this.endedPollNotificationQueue,
- this.deliverQueue,
- this.inboxQueue,
- this.dbQueue,
- this.relationshipQueue,
- this.objectStorageQueue,
- this.userWebhookDeliverQueue,
- this.systemWebhookDeliverQueue,
- ].map(q => new BullMQAdapter(q)),
- serverAdapter: bullBoardServerAdapter,
- });
-
- bullBoardServerAdapter.setBasePath(bullBoardPath);
- (fastify.register as any)(bullBoardServerAdapter.registerPlugin(), { prefix: bullBoardPath });
- //#endregion
-
fastify.register(fastifyView, {
root: _dirname + '/views',
engine: {
diff --git a/packages/backend/test/e2e/fetch-resource.ts b/packages/backend/test/e2e/fetch-resource.ts
index b85cebf724..740295bda8 100644
--- a/packages/backend/test/e2e/fetch-resource.ts
+++ b/packages/backend/test/e2e/fetch-resource.ts
@@ -6,7 +6,7 @@
process.env.NODE_ENV = 'test';
import * as assert from 'assert';
-import { channel, clip, cookie, galleryPost, page, play, post, signup, simpleGet, uploadFile } from '../utils.js';
+import { channel, clip, galleryPost, page, play, post, signup, simpleGet, uploadFile } from '../utils.js';
import type { SimpleGetResponse } from '../utils.js';
import type * as misskey from 'misskey-js';
@@ -156,20 +156,20 @@ describe('Webリソース', () => {
describe(' has entry such ', () => {
beforeEach(() => {
- post(alice, { text: "**a**" })
+ post(alice, { text: '**a**' });
});
test('MFMを含まない。', async () => {
- const content = await simpleGet(path(alice.username), "*/*", undefined, res => res.text());
+ const content = await simpleGet(path(alice.username), '*/*', undefined, res => res.text());
const _body: unknown = content.body;
// JSONフィードのときは改めて文字列化する
- const body: string = typeof (_body) === "object" ? JSON.stringify(_body) : _body as string;
+ const body: string = typeof (_body) === 'object' ? JSON.stringify(_body) : _body as string;
- if (body.includes("**a**")) {
- throw new Error("MFM shouldn't be included");
+ if (body.includes('**a**')) {
+ throw new Error('MFM shouldn\'t be included');
}
});
- })
+ });
});
describe.each([{ path: '/api/foo' }])('$path', ({ path }) => {
@@ -180,24 +180,6 @@ describe('Webリソース', () => {
}));
});
- describe.each([{ path: '/queue' }])('$path', ({ path }) => {
- test('はログインしないとGETできない。', async () => await notOk({
- path,
- status: 401,
- }));
-
- test('はadminでなければGETできない。', async () => await notOk({
- path,
- cookie: cookie(bob),
- status: 403,
- }));
-
- test('はadminならGETできる。', async () => await ok({
- path,
- cookie: cookie(alice),
- }));
- });
-
describe.each([{ path: '/streaming' }])('$path', ({ path }) => {
test('はGETできない。', async () => await notOk({
path,
diff --git a/packages/backend/test/utils.ts b/packages/backend/test/utils.ts
index 26de19eaf1..7eecf8bb0d 100644
--- a/packages/backend/test/utils.ts
+++ b/packages/backend/test/utils.ts
@@ -35,7 +35,7 @@ export type SystemWebhookPayload = {
createdAt: string;
type: string;
body: any;
-}
+};
const config = loadConfig();
export const port = config.port;
@@ -45,10 +45,6 @@ export const host = new URL(config.url).host;
export const WEBHOOK_HOST = 'http://localhost:15080';
export const WEBHOOK_PORT = 15080;
-export const cookie = (me: UserToken): string => {
- return `token=${me.token};`;
-};
-
export type ApiRequest = {
endpoint: E,
parameters: P,
diff --git a/packages/frontend/src/pages/admin/queue.vue b/packages/frontend/src/pages/admin/queue.vue
index 65d728e776..b5aee1e51e 100644
--- a/packages/frontend/src/pages/admin/queue.vue
+++ b/packages/frontend/src/pages/admin/queue.vue
@@ -17,11 +17,11 @@ SPDX-License-Identifier: AGPL-3.0-only