1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-11-27 14:28:53 +09:00

Merge remote-branch 'misskey/develop'

This commit is contained in:
NoriDev 2024-04-02 15:41:00 +09:00
commit 22c8f9cd6f
56 changed files with 1124 additions and 268 deletions

View File

@ -92,6 +92,6 @@ jobs:
- run: pnpm i --frozen-lockfile - run: pnpm i --frozen-lockfile
- run: pnpm --filter cherrypick-js run build - run: pnpm --filter cherrypick-js run build
if: ${{ matrix.workspace == 'backend' }} if: ${{ matrix.workspace == 'backend' }}
- run: pnpm --filter misskey-reversi run build:tsc - run: pnpm --filter misskey-reversi run build
if: ${{ matrix.workspace == 'backend' }} if: ${{ matrix.workspace == 'backend' }}
- run: pnpm --filter ${{ matrix.workspace }} run typecheck - run: pnpm --filter ${{ matrix.workspace }} run typecheck

View File

@ -45,6 +45,8 @@ jobs:
with: with:
version: 8 version: 8
run_install: false run_install: false
- name: Install FFmpeg
uses: FedericoCarboni/setup-ffmpeg@v3
- name: Use Node.js ${{ matrix.node-version }} - name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4.0.2 uses: actions/setup-node@v4.0.2
with: with:

View File

@ -19,6 +19,10 @@
- Enhance: ページのデザインを変更 - Enhance: ページのデザインを変更
- Enhance: 2要素認証ワンタイムパスワードの入力欄を改善 - Enhance: 2要素認証ワンタイムパスワードの入力欄を改善
- Enhance: 「今日誕生日のフォロー中ユーザー」ウィジェットを手動でリロードできるように - Enhance: 「今日誕生日のフォロー中ユーザー」ウィジェットを手動でリロードできるように
- Enhance: 映像・音声の再生にブラウザのネイティブプレイヤーを使用できるように
- Enhance: 映像・音声の再生メニューに「再生速度」「ループ再生」「ピクチャインピクチャ」を追加
- Enhance: 映像・音声の再生にキーボードショートカットが使えるように
- Enhance: ノートについているリアクションの「もっと!」から、リアクションの一覧を表示できるように
- Fix: 一部のページ内リンクが正しく動作しない問題を修正 - Fix: 一部のページ内リンクが正しく動作しない問題を修正
- Fix: 周年の実績が閏年を考慮しない問題を修正 - Fix: 周年の実績が閏年を考慮しない問題を修正
- Fix: ローカルURLのプレビューポップアップが左上に表示される - Fix: ローカルURLのプレビューポップアップが左上に表示される
@ -35,6 +39,9 @@
- Enhance: misskey-dev/summaly@5.1.0の取り込み(プレビュー生成処理の効率化) - Enhance: misskey-dev/summaly@5.1.0の取り込み(プレビュー生成処理の効率化)
- Fix: フォローリクエストを作成する際に既存のものは削除するように - Fix: フォローリクエストを作成する際に既存のものは削除するように
(Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/440) (Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/440)
- Fix: エンドポイント`notes/translate`のエラーを改善
- Fix: CleanRemoteFilesProcessorService report progress from 100% (#13632)
- Fix: 一部の音声ファイルが映像ファイルとして扱われる問題を修正
## 2024.3.1 ## 2024.3.1

View File

@ -33,6 +33,7 @@ Misskey의 전체 변경 사항을 확인하려면, [CHANGELOG.md#2024xx](CHANGE
### Server ### Server
- Enhance: 디버깅을 보다 편하게 할 수 있도록 vite 생성 파일의 이름 개선 - Enhance: 디버깅을 보다 편하게 할 수 있도록 vite 생성 파일의 이름 개선
- Fix: 엔드포인트 `users/translate` 에러 개선
--- ---

36
locales/index.d.ts vendored
View File

@ -5383,6 +5383,14 @@ export interface Locale extends ILocale {
* 使 * 使
*/ */
"useBackupCode": string; "useBackupCode": string;
/**
*
*/
"launchApp": string;
/**
* UIを使用する
*/
"useNativeUIForVideoAudioPlayer": string;
/** /**
* *
*/ */
@ -8772,13 +8780,9 @@ export interface Locale extends ILocale {
*/ */
"step1": ParameterizedString<"a" | "b">; "step1": ParameterizedString<"a" | "b">;
/** /**
* QRコードをアプリでスキャンします * QRコードをアプリでスキャンするか
*/ */
"step2": string; "step2": string;
/**
* QRコードをクリックすると使
*/
"step2Click": string;
/** /**
* 使URIを入力します * 使URIを入力します
*/ */
@ -10064,6 +10068,14 @@ export interface Locale extends ILocale {
* *
*/ */
"button": string; "button": string;
/**
*
*/
"dynamic": string;
/**
* {play}
*/
"dynamicDescription": ParameterizedString<"play">;
/** /**
* *
*/ */
@ -11088,6 +11100,20 @@ export interface Locale extends ILocale {
*/ */
"summaryProxyDescription2": string; "summaryProxyDescription2": string;
}; };
"_mediaControls": {
/**
*
*/
"pip": string;
/**
*
*/
"playbackRate": string;
/**
*
*/
"loop": string;
};
"_abuse": { "_abuse": {
"_resolver": { "_resolver": {
/** /**

View File

@ -1340,6 +1340,8 @@ gameRetry: "リトライ"
notUsePleaseLeaveBlank: "使用しない場合は空欄にしてください" notUsePleaseLeaveBlank: "使用しない場合は空欄にしてください"
useTotp: "ワンタイムパスワードを使う" useTotp: "ワンタイムパスワードを使う"
useBackupCode: "バックアップコードを使う" useBackupCode: "バックアップコードを使う"
launchApp: "アプリを起動"
useNativeUIForVideoAudioPlayer: "動画・音声の再生にブラウザのUIを使用する"
showUnreadNotificationsCount: "未読の通知の数を表示する" showUnreadNotificationsCount: "未読の通知の数を表示する"
showCatOnly: "キャット付きのみ" showCatOnly: "キャット付きのみ"
additionalPermissionsForFlash: "Playへの追加許可" additionalPermissionsForFlash: "Playへの追加許可"
@ -2307,8 +2309,7 @@ _2fa:
alreadyRegistered: "既に設定は完了しています。" alreadyRegistered: "既に設定は完了しています。"
registerTOTP: "認証アプリの設定を開始" registerTOTP: "認証アプリの設定を開始"
step1: "まず、{a}や{b}などの認証アプリをお使いのデバイスにインストールします。" step1: "まず、{a}や{b}などの認証アプリをお使いのデバイスにインストールします。"
step2: "次に、表示されているQRコードをアプリでスキャンします。" step2: "次に、表示されているQRコードをアプリでスキャンするか、ボタンをクリックして端末上でアプリを開きます。"
step2Click: "QRコードをクリックすると、お使いの端末にインストールされている認証アプリやキーリングに登録できます。"
step2Uri: "デスクトップアプリを使用する場合は次のURIを入力します" step2Uri: "デスクトップアプリを使用する場合は次のURIを入力します"
step3Title: "確認コードを入力" step3Title: "確認コードを入力"
step3: "アプリに表示されている確認コード(トークン)を入力します。" step3: "アプリに表示されている確認コード(トークン)を入力します。"
@ -2656,6 +2657,8 @@ _pages:
section: "セクション" section: "セクション"
image: "画像" image: "画像"
button: "ボタン" button: "ボタン"
dynamic: "動的ブロック"
dynamicDescription: "このブロックは廃止されています。今後は{play}を利用してください。"
note: "ノート埋め込み" note: "ノート埋め込み"
_note: _note:
@ -2950,6 +2953,11 @@ _urlPreviewSetting:
summaryProxyDescription: "CherryPick本体ではなく、サマリープロキシを使用してプレビューを生成します。" summaryProxyDescription: "CherryPick本体ではなく、サマリープロキシを使用してプレビューを生成します。"
summaryProxyDescription2: "プロキシには下記パラメータがクエリ文字列として連携されます。プロキシ側がこれらをサポートしない場合、設定値は無視されます。" summaryProxyDescription2: "プロキシには下記パラメータがクエリ文字列として連携されます。プロキシ側がこれらをサポートしない場合、設定値は無視されます。"
_mediaControls:
pip: "ピクチャインピクチャ"
playbackRate: "再生速度"
loop: "ループ再生"
_abuse: _abuse:
_resolver: _resolver:
1hour: "一時間" 1hour: "一時間"

View File

@ -60,7 +60,9 @@
"postcss": "8.4.35", "postcss": "8.4.35",
"tar": "6.2.0", "tar": "6.2.0",
"terser": "5.28.1", "terser": "5.28.1",
"typescript": "5.3.3" "typescript": "5.3.3",
"esbuild": "0.19.11",
"glob": "10.3.10"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^20.11.28", "@types/node": "^20.11.28",

View File

@ -19,5 +19,6 @@
}, },
"target": "es2022" "target": "es2022"
}, },
"minify": false "minify": false,
"sourceMaps": "inline"
} }

View File

@ -14,11 +14,12 @@ import FFmpeg from 'fluent-ffmpeg';
import isSvg from 'is-svg'; import isSvg from 'is-svg';
import probeImageSize from 'probe-image-size'; import probeImageSize from 'probe-image-size';
import { type predictionType } from 'nsfwjs'; import { type predictionType } from 'nsfwjs';
import sharp from 'sharp';
import { sharpBmp } from '@misskey-dev/sharp-read-bmp'; import { sharpBmp } from '@misskey-dev/sharp-read-bmp';
import { encode } from 'blurhash'; import { encode } from 'blurhash';
import { createTempDir } from '@/misc/create-temp.js'; import { createTempDir } from '@/misc/create-temp.js';
import { AiService } from '@/core/AiService.js'; import { AiService } from '@/core/AiService.js';
import { LoggerService } from '@/core/LoggerService.js';
import type Logger from '@/logger.js';
import { bindThis } from '@/decorators.js'; import { bindThis } from '@/decorators.js';
export type FileInfo = { export type FileInfo = {
@ -49,9 +50,13 @@ const TYPE_SVG = {
@Injectable() @Injectable()
export class FileInfoService { export class FileInfoService {
private logger: Logger;
constructor( constructor(
private aiService: AiService, private aiService: AiService,
private loggerService: LoggerService,
) { ) {
this.logger = this.loggerService.getLogger('file-info');
} }
/** /**
@ -317,6 +322,34 @@ export class FileInfoService {
return mime; return mime;
} }
/**
*
* m4a, webmなど
*
* @param path
* @returns `true`
*/
@bindThis
private hasVideoTrackOnVideoFile(path: string): Promise<boolean> {
const sublogger = this.logger.createSubLogger('ffprobe');
sublogger.info(`Checking the video file. File path: ${path}`);
return new Promise((resolve) => {
try {
FFmpeg.ffprobe(path, (err, metadata) => {
if (err) {
sublogger.warn(`Could not check the video file. Returns true. File path: ${path}`, err);
resolve(true);
return;
}
resolve(metadata.streams.some((stream) => stream.codec_type === 'video'));
});
} catch (err) {
sublogger.warn(`Could not check the video file. Returns true. File path: ${path}`, err as Error);
resolve(true);
}
});
}
/** /**
* Detect MIME Type and extension * Detect MIME Type and extension
*/ */
@ -339,6 +372,20 @@ export class FileInfoService {
return TYPE_SVG; return TYPE_SVG;
} }
if ((type.mime.startsWith('video') || type.mime === 'application/ogg') && !(await this.hasVideoTrackOnVideoFile(path))) {
const newMime = `audio/${type.mime.split('/')[1]}`;
if (newMime === 'audio/mp4') {
return {
mime: 'audio/mp4',
ext: 'm4a',
};
}
return {
mime: newMime,
ext: type.ext,
};
}
return { return {
mime: this.fixMime(type.mime), mime: this.fixMime(type.mime),
ext: type.ext, ext: type.ext,

View File

@ -63,7 +63,7 @@ export class CleanRemoteFilesProcessorService {
isLink: false, isLink: false,
}); });
job.updateProgress(deletedCount / total); job.updateProgress(100 / total * deletedCount);
} }
this.logger.succ('All cached remote files has been deleted.'); this.logger.succ('All cached remote files has been deleted.');

View File

@ -25,7 +25,7 @@ export const meta = {
res: { res: {
type: 'object', type: 'object',
optional: false, nullable: false, optional: true, nullable: false,
properties: { properties: {
sourceLang: { type: 'string' }, sourceLang: { type: 'string' },
text: { type: 'string' }, text: { type: 'string' },
@ -43,6 +43,11 @@ export const meta = {
code: 'NO_SUCH_NOTE', code: 'NO_SUCH_NOTE',
id: 'bea9b03f-36e0-49c5-a4db-627a029f8971', id: 'bea9b03f-36e0-49c5-a4db-627a029f8971',
}, },
cannotTranslateInvisibleNote: {
message: 'Cannot translate invisible note.',
code: 'CANNOT_TRANSLATE_INVISIBLE_NOTE',
id: 'ea29f2ca-c368-43b3-aaf1-5ac3e74bbe5d',
},
noTranslateService: { noTranslateService: {
message: 'Translate service is not available.', message: 'Translate service is not available.',
code: 'NO_TRANSLATE_SERVICE', code: 'NO_TRANSLATE_SERVICE',
@ -81,11 +86,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}); });
if (!(await this.noteEntityService.isVisibleForMe(note, me.id))) { if (!(await this.noteEntityService.isVisibleForMe(note, me.id))) {
return 204; // TODO: 良い感じのエラー返す throw new ApiError(meta.errors.cannotTranslateInvisibleNote);
} }
if (note.text == null) { if (note.text == null) {
return 204; return;
} }
const instance = await this.metaService.fetch(); const instance = await this.metaService.fetch();
@ -106,7 +111,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
let translationResult; let translationResult;
if (instance.translatorType === 'deepl') { if (instance.translatorType === 'deepl') {
if (instance.deeplAuthKey == null) { if (instance.deeplAuthKey == null) {
return 204; // TODO: 良い感じのエラー返す throw new ApiError(meta.errors.unavailable);
} }
translationResult = await this.translateDeepL((note.cw ? note.cw + '\n' : '') + note.text, targetLang, instance.deeplAuthKey, instance.deeplIsPro, instance.translatorType); translationResult = await this.translateDeepL((note.cw ? note.cw + '\n' : '') + note.text, targetLang, instance.deeplAuthKey, instance.deeplIsPro, instance.translatorType);
} else if (instance.translatorType === 'google_no_api') { } else if (instance.translatorType === 'google_no_api') {

View File

@ -24,7 +24,7 @@ export const meta = {
res: { res: {
type: 'object', type: 'object',
optional: false, nullable: false, optional: true, nullable: false,
properties: { properties: {
sourceLang: { type: 'string' }, sourceLang: { type: 'string' },
text: { type: 'string' }, text: { type: 'string' },
@ -79,7 +79,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}); });
if (target.description == null) { if (target.description == null) {
return 204; return;
} }
const instance = await this.metaService.fetch(); const instance = await this.metaService.fetch();
@ -100,7 +100,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
let translationResult; let translationResult;
if (instance.translatorType === 'deepl') { if (instance.translatorType === 'deepl') {
if (instance.deeplAuthKey == null) { if (instance.deeplAuthKey == null) {
return 204; // TODO: 良い感じのエラー返す throw new ApiError(meta.errors.unavailable);
} }
translationResult = await this.translateDeepL(target.description, targetLang, instance.deeplAuthKey, instance.deeplIsPro, instance.translatorType); translationResult = await this.translateDeepL(target.description, targetLang, instance.deeplAuthKey, instance.deeplIsPro, instance.translatorType);
} else if (instance.translatorType === 'google_no_api') { } else if (instance.translatorType === 'google_no_api') {

View File

@ -8,12 +8,13 @@ process.env.NODE_ENV = 'test';
import * as assert from 'assert'; import * as assert from 'assert';
import { MiNote } from '@/models/Note.js'; import { MiNote } from '@/models/Note.js';
import { MAX_NOTE_TEXT_LENGTH } from '@/const.js'; import { MAX_NOTE_TEXT_LENGTH } from '@/const.js';
import { api, initTestDb, post, signup, uploadFile, uploadUrl } from '../utils.js'; import { api, initTestDb, post, role, signup, uploadFile, uploadUrl } from '../utils.js';
import type * as misskey from 'cherrypick-js'; import type * as misskey from 'cherrypick-js';
describe('Note', () => { describe('Note', () => {
let Notes: any; let Notes: any;
let root: misskey.entities.SignupResponse;
let alice: misskey.entities.SignupResponse; let alice: misskey.entities.SignupResponse;
let bob: misskey.entities.SignupResponse; let bob: misskey.entities.SignupResponse;
let tom: misskey.entities.SignupResponse; let tom: misskey.entities.SignupResponse;
@ -21,6 +22,7 @@ describe('Note', () => {
beforeAll(async () => { beforeAll(async () => {
const connection = await initTestDb(true); const connection = await initTestDb(true);
Notes = connection.getRepository(MiNote); Notes = connection.getRepository(MiNote);
root = await signup({ username: 'root' });
alice = await signup({ username: 'alice' }); alice = await signup({ username: 'alice' });
bob = await signup({ username: 'bob' }); bob = await signup({ username: 'bob' });
tom = await signup({ username: 'tom', host: 'example.com' }); tom = await signup({ username: 'tom', host: 'example.com' });
@ -473,14 +475,14 @@ describe('Note', () => {
value: true, value: true,
}, },
} as any, } as any,
}, alice); }, root);
assert.strictEqual(res.status, 200); assert.strictEqual(res.status, 200);
const assign = await api('admin/roles/assign', { const assign = await api('admin/roles/assign', {
userId: alice.id, userId: alice.id,
roleId: res.body.id, roleId: res.body.id,
}, alice); }, root);
assert.strictEqual(assign.status, 204); assert.strictEqual(assign.status, 204);
assert.strictEqual(file.body!.isSensitive, false); assert.strictEqual(file.body!.isSensitive, false);
@ -508,11 +510,11 @@ describe('Note', () => {
await api('admin/roles/unassign', { await api('admin/roles/unassign', {
userId: alice.id, userId: alice.id,
roleId: res.body.id, roleId: res.body.id,
}); }, root);
await api('admin/roles/delete', { await api('admin/roles/delete', {
roleId: res.body.id, roleId: res.body.id,
}, alice); }, root);
}); });
}); });
@ -644,7 +646,7 @@ describe('Note', () => {
sensitiveWords: [ sensitiveWords: [
'test', 'test',
], ],
}, alice); }, root);
assert.strictEqual(sensitive.status, 204); assert.strictEqual(sensitive.status, 204);
@ -663,7 +665,7 @@ describe('Note', () => {
sensitiveWords: [ sensitiveWords: [
'/Test/i', '/Test/i',
], ],
}, alice); }, root);
assert.strictEqual(sensitive.status, 204); assert.strictEqual(sensitive.status, 204);
@ -680,7 +682,7 @@ describe('Note', () => {
sensitiveWords: [ sensitiveWords: [
'Test hoge', 'Test hoge',
], ],
}, alice); }, root);
assert.strictEqual(sensitive.status, 204); assert.strictEqual(sensitive.status, 204);
@ -697,7 +699,7 @@ describe('Note', () => {
prohibitedWords: [ prohibitedWords: [
'test', 'test',
], ],
}, alice); }, root);
assert.strictEqual(prohibited.status, 204); assert.strictEqual(prohibited.status, 204);
@ -716,7 +718,7 @@ describe('Note', () => {
prohibitedWords: [ prohibitedWords: [
'/Test/i', '/Test/i',
], ],
}, alice); }, root);
assert.strictEqual(prohibited.status, 204); assert.strictEqual(prohibited.status, 204);
@ -733,7 +735,7 @@ describe('Note', () => {
prohibitedWords: [ prohibitedWords: [
'Test hoge', 'Test hoge',
], ],
}, alice); }, root);
assert.strictEqual(prohibited.status, 204); assert.strictEqual(prohibited.status, 204);
@ -750,7 +752,7 @@ describe('Note', () => {
prohibitedWords: [ prohibitedWords: [
'test', 'test',
], ],
}, alice); }, root);
assert.strictEqual(prohibited.status, 204); assert.strictEqual(prohibited.status, 204);
@ -785,7 +787,7 @@ describe('Note', () => {
value: 0, value: 0,
}, },
} as any, } as any,
}, alice); }, root);
assert.strictEqual(res.status, 200); assert.strictEqual(res.status, 200);
@ -794,7 +796,7 @@ describe('Note', () => {
const assign = await api('admin/roles/assign', { const assign = await api('admin/roles/assign', {
userId: alice.id, userId: alice.id,
roleId: res.body.id, roleId: res.body.id,
}, alice); }, root);
assert.strictEqual(assign.status, 204); assert.strictEqual(assign.status, 204);
@ -810,11 +812,11 @@ describe('Note', () => {
await api('admin/roles/unassign', { await api('admin/roles/unassign', {
userId: alice.id, userId: alice.id,
roleId: res.body.id, roleId: res.body.id,
}); }, root);
await api('admin/roles/delete', { await api('admin/roles/delete', {
roleId: res.body.id, roleId: res.body.id,
}, alice); }, root);
}); });
test('ダイレクト投稿もエラーになる', async () => { test('ダイレクト投稿もエラーになる', async () => {
@ -839,7 +841,7 @@ describe('Note', () => {
value: 0, value: 0,
}, },
} as any, } as any,
}, alice); }, root);
assert.strictEqual(res.status, 200); assert.strictEqual(res.status, 200);
@ -848,7 +850,7 @@ describe('Note', () => {
const assign = await api('admin/roles/assign', { const assign = await api('admin/roles/assign', {
userId: alice.id, userId: alice.id,
roleId: res.body.id, roleId: res.body.id,
}, alice); }, root);
assert.strictEqual(assign.status, 204); assert.strictEqual(assign.status, 204);
@ -866,11 +868,11 @@ describe('Note', () => {
await api('admin/roles/unassign', { await api('admin/roles/unassign', {
userId: alice.id, userId: alice.id,
roleId: res.body.id, roleId: res.body.id,
}); }, root);
await api('admin/roles/delete', { await api('admin/roles/delete', {
roleId: res.body.id, roleId: res.body.id,
}, alice); }, root);
}); });
test('ダイレクトの宛先とメンションが同じ場合は重複してカウントしない', async () => { test('ダイレクトの宛先とメンションが同じ場合は重複してカウントしない', async () => {
@ -895,7 +897,7 @@ describe('Note', () => {
value: 1, value: 1,
}, },
} as any, } as any,
}, alice); }, root);
assert.strictEqual(res.status, 200); assert.strictEqual(res.status, 200);
@ -904,7 +906,7 @@ describe('Note', () => {
const assign = await api('admin/roles/assign', { const assign = await api('admin/roles/assign', {
userId: alice.id, userId: alice.id,
roleId: res.body.id, roleId: res.body.id,
}, alice); }, root);
assert.strictEqual(assign.status, 204); assert.strictEqual(assign.status, 204);
@ -921,11 +923,11 @@ describe('Note', () => {
await api('admin/roles/unassign', { await api('admin/roles/unassign', {
userId: alice.id, userId: alice.id,
roleId: res.body.id, roleId: res.body.id,
}); }, root);
await api('admin/roles/delete', { await api('admin/roles/delete', {
roleId: res.body.id, roleId: res.body.id,
}, alice); }, root);
}); });
}); });
@ -960,4 +962,61 @@ describe('Note', () => {
assert.strictEqual(mainNote.repliesCount, 0); assert.strictEqual(mainNote.repliesCount, 0);
}); });
}); });
describe('notes/translate', () => {
describe('翻訳機能の利用が許可されていない場合', () => {
let cannotTranslateRole: misskey.entities.Role;
beforeAll(async () => {
cannotTranslateRole = await role(root, {}, { canUseTranslator: false });
await api('admin/roles/assign', { roleId: cannotTranslateRole.id, userId: alice.id }, root);
});
test('翻訳機能の利用が許可されていない場合翻訳できない', async () => {
const aliceNote = await post(alice, { text: 'Hello' });
const res = await api('notes/translate', {
noteId: aliceNote.id,
targetLang: 'ja',
}, alice);
assert.strictEqual(res.status, 400);
assert.strictEqual(res.body.error.code, 'UNAVAILABLE');
});
afterAll(async () => {
await api('admin/roles/unassign', { roleId: cannotTranslateRole.id, userId: alice.id }, root);
});
});
test('存在しないノートは翻訳できない', async () => {
const res = await api('notes/translate', { noteId: 'foo', targetLang: 'ja' }, alice);
assert.strictEqual(res.status, 400);
assert.strictEqual(res.body.error.code, 'NO_SUCH_NOTE');
});
test('不可視なノートは翻訳できない', async () => {
const aliceNote = await post(alice, { visibility: 'followers', text: 'Hello' });
const bobTranslateAttempt = await api('notes/translate', { noteId: aliceNote.id, targetLang: 'ja' }, bob);
assert.strictEqual(bobTranslateAttempt.status, 400);
assert.strictEqual(bobTranslateAttempt.body.error.code, 'CANNOT_TRANSLATE_INVISIBLE_NOTE');
});
test('text: null なノートを翻訳すると空のレスポンスが返ってくる', async () => {
const aliceNote = await post(alice, { text: null, poll: { choices: ['kinoko', 'takenoko'] } });
const res = await api('notes/translate', { noteId: aliceNote.id, targetLang: 'ja' }, alice);
assert.strictEqual(res.status, 204);
});
test('サーバーに DeepL 認証キーが登録されていない場合翻訳できない', async () => {
const aliceNote = await post(alice, { text: 'Hello' });
const res = await api('notes/translate', { noteId: aliceNote.id, targetLang: 'ja' }, alice);
// NOTE: デフォルトでは登録されていないので落ちる
assert.strictEqual(res.status, 400);
assert.strictEqual(res.body.error.code, 'UNAVAILABLE');
});
});
}); });

Binary file not shown.

View File

@ -15,6 +15,7 @@ import { GlobalModule } from '@/GlobalModule.js';
import { FileInfoService } from '@/core/FileInfoService.js'; import { FileInfoService } from '@/core/FileInfoService.js';
//import { DI } from '@/di-symbols.js'; //import { DI } from '@/di-symbols.js';
import { AiService } from '@/core/AiService.js'; import { AiService } from '@/core/AiService.js';
import { LoggerService } from '@/core/LoggerService.js';
import type { TestingModule } from '@nestjs/testing'; import type { TestingModule } from '@nestjs/testing';
import type { MockFunctionMetadata } from 'jest-mock'; import type { MockFunctionMetadata } from 'jest-mock';
@ -35,6 +36,7 @@ describe('FileInfoService', () => {
], ],
providers: [ providers: [
AiService, AiService,
LoggerService,
FileInfoService, FileInfoService,
], ],
}) })
@ -323,8 +325,26 @@ describe('FileInfoService', () => {
}); });
}); });
/* test('MPEG-4 AUDIO (M4A)', async () => {
* video/webmとして検出されてしまう const path = `${resources}/kick_gaba7.m4a`;
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
delete info.warnings;
delete info.blurhash;
delete info.sensitive;
delete info.porn;
delete info.width;
delete info.height;
delete info.orientation;
assert.deepStrictEqual(info, {
size: 9817,
md5: '74c9279a4abe98789565f1dc1a541a42',
type: {
mime: 'audio/mp4',
ext: 'm4a',
},
});
});
test('WEBM AUDIO', async () => { test('WEBM AUDIO', async () => {
const path = `${resources}/kick_gaba7.webm`; const path = `${resources}/kick_gaba7.webm`;
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any; const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
@ -337,13 +357,12 @@ describe('FileInfoService', () => {
delete info.orientation; delete info.orientation;
assert.deepStrictEqual(info, { assert.deepStrictEqual(info, {
size: 8879, size: 8879,
md5: '3350083dec312419cfdc06c16413aca7', md5: '53bc1adcb6acbbda67ff9bd484896438',
type: { type: {
mime: 'audio/webm', mime: 'audio/webm',
ext: 'webm', ext: 'webm',
}, },
}); });
}); });
*/
}); });
}); });

View File

@ -5,3 +5,4 @@ node_modules
/jest.config.ts /jest.config.ts
/test /test
/test-d /test-d
build.js

View File

@ -45,7 +45,7 @@
* *
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName> * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
*/ */
"mainEntryPointFilePath": "<projectFolder>/built/dts/index.d.ts", "mainEntryPointFilePath": "<projectFolder>/built/index.d.ts",
/** /**
* A list of NPM package names whose exports should be treated as part of this package. * A list of NPM package names whose exports should be treated as part of this package.

View File

@ -0,0 +1,105 @@
import * as esbuild from "esbuild";
import { build } from "esbuild";
import { globSync } from "glob";
import { execa } from "execa";
import fs from "node:fs";
import { fileURLToPath } from "node:url";
import { dirname } from "node:path";
const _filename = fileURLToPath(import.meta.url);
const _dirname = dirname(_filename);
const _package = JSON.parse(fs.readFileSync(_dirname + '/package.json', 'utf-8'));
const entryPoints = globSync("./src/**/**.{ts,tsx}");
/** @type {import('esbuild').BuildOptions} */
const options = {
entryPoints,
minify: process.env.NODE_ENV === 'production',
outdir: "./built",
target: "es2022",
platform: "browser",
format: "esm",
sourcemap: 'linked',
};
// built配下をすべて削除する
fs.rmSync('./built', { recursive: true, force: true });
if (process.argv.map(arg => arg.toLowerCase()).includes("--watch")) {
await watchSrc();
} else {
await buildSrc();
}
async function buildSrc() {
console.log(`[${_package.name}] start building...`);
await build(options)
.then(it => {
console.log(`[${_package.name}] build succeeded.`);
})
.catch((err) => {
process.stderr.write(err.stderr);
process.exit(1);
});
if (process.env.NODE_ENV === 'production') {
console.log(`[${_package.name}] skip building d.ts because NODE_ENV is production.`);
} else {
await buildDts();
}
console.log(`[${_package.name}] finish building.`);
}
function buildDts() {
return execa(
'tsc',
[
'--project', 'tsconfig.json',
'--outDir', 'built',
'--declaration', 'true',
'--emitDeclarationOnly', 'true',
],
{
stdout: process.stdout,
stderr: process.stderr,
}
);
}
async function watchSrc() {
const plugins = [{
name: 'gen-dts',
setup(build) {
build.onStart(() => {
console.log(`[${_package.name}] detect changed...`);
});
build.onEnd(async result => {
if (result.errors.length > 0) {
console.error(`[${_package.name}] watch build failed:`, result);
return;
}
await buildDts();
});
},
}];
console.log(`[${_package.name}] start watching...`)
const context = await esbuild.context({ ...options, plugins });
await context.watch();
await new Promise((resolve, reject) => {
process.on('SIGHUP', resolve);
process.on('SIGINT', resolve);
process.on('SIGTERM', resolve);
process.on('SIGKILL', resolve);
process.on('uncaughtException', reject);
process.on('exit', resolve);
}).finally(async () => {
await context.dispose();
console.log(`[${_package.name}] finish watching.`);
});
}

View File

@ -4,23 +4,21 @@
"version": "4.8.0-beta.1", "version": "4.8.0-beta.1",
"basedMisskeyVersion": "2024.3.1", "basedMisskeyVersion": "2024.3.1",
"description": "CherryPick SDK for JavaScript", "description": "CherryPick SDK for JavaScript",
"types": "./built/dts/index.d.ts", "main": "./built/index.js",
"types": "./built/index.d.ts",
"exports": { "exports": {
".": { ".": {
"import": "./built/esm/index.js", "import": "./built/index.js",
"types": "./built/dts/index.d.ts" "types": "./built/index.d.ts"
}, },
"./*": { "./*": {
"import": "./built/esm/*", "import": "./built/*",
"types": "./built/dts/*" "types": "./built/*"
} }
}, },
"scripts": { "scripts": {
"build": "npm run ts", "build": "node ./build.js",
"ts": "npm run ts-esm && npm run ts-dts", "watch": "nodemon -w package.json -e json --exec \"node ./build.js --watch\"",
"ts-esm": "tsc --outDir built/esm",
"ts-dts": "tsc --outDir built/dts --declaration true --emitDeclarationOnly true --declarationMap true",
"watch": "nodemon -w src -e ts,js,cjs,mjs,json --exec \"pnpm run ts\"",
"tsd": "tsd", "tsd": "tsd",
"api": "pnpm api-extractor run --local --verbose", "api": "pnpm api-extractor run --local --verbose",
"api-prod": "pnpm api-extractor run --verbose", "api-prod": "pnpm api-extractor run --verbose",
@ -50,17 +48,16 @@
"mock-socket": "9.3.1", "mock-socket": "9.3.1",
"ncp": "2.0.0", "ncp": "2.0.0",
"nodemon": "3.1.0", "nodemon": "3.1.0",
"execa": "8.0.1",
"tsd": "0.30.7", "tsd": "0.30.7",
"typescript": "5.3.3" "typescript": "5.3.3",
"esbuild": "0.19.11",
"glob": "10.3.10"
}, },
"files": [ "files": [
"built", "built"
"built/esm",
"built/dts"
], ],
"dependencies": { "dependencies": {
"@swc/cli": "0.1.63",
"@swc/core": "1.3.105",
"eventemitter3": "5.0.1", "eventemitter3": "5.0.1",
"reconnecting-websocket": "4.4.0" "reconnecting-websocket": "4.4.0"
} }

View File

@ -3,7 +3,7 @@ import './autogen/apiClientJSDoc.js';
import { SwitchCaseResponseType } from './api.types.js'; import { SwitchCaseResponseType } from './api.types.js';
import type { Endpoints } from './api.types.js'; import type { Endpoints } from './api.types.js';
export { export type {
SwitchCaseResponseType, SwitchCaseResponseType,
} from './api.types.js'; } from './api.types.js';

View File

@ -23257,6 +23257,10 @@ export type operations = {
}; };
}; };
}; };
/** @description OK (without any results) */
204: {
content: never;
};
/** @description Client error */ /** @description Client error */
400: { 400: {
content: { content: {
@ -28229,6 +28233,10 @@ export type operations = {
}; };
}; };
}; };
/** @description OK (without any results) */
204: {
content: never;
};
/** @description Client error */ /** @description Client error */
400: { 400: {
content: { content: {

View File

@ -1,17 +1,20 @@
import { Endpoints } from './api.types.js'; import { type Endpoints } from './api.types.js';
import Stream, { Connection } from './streaming.js'; import Stream, { Connection } from './streaming.js';
import { Channels } from './streaming.types.js'; import { type Channels } from './streaming.types.js';
import { Acct } from './acct.js'; import { type Acct } from './acct.js';
import * as consts from './consts.js'; import * as consts from './consts.js';
export { export type {
Endpoints, Endpoints,
Stream,
Connection as ChannelConnection,
Channels, Channels,
Acct, Acct,
}; };
export {
Stream,
Connection as ChannelConnection,
};
export const permissions = consts.permissions; export const permissions = consts.permissions;
export const notificationTypes = consts.notificationTypes; export const notificationTypes = consts.notificationTypes;
export const noteVisibilities = consts.noteVisibilities; export const noteVisibilities = consts.noteVisibilities;

View File

@ -6,7 +6,7 @@
"moduleResolution": "nodenext", "moduleResolution": "nodenext",
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,
"sourceMap": true, "sourceMap": false,
"outDir": "./built/", "outDir": "./built/",
"removeComments": true, "removeComments": true,
"strict": true, "strict": true,

View File

@ -23,6 +23,7 @@ SPDX-License-Identifier: AGPL-3.0-only
v-else class="_button" v-else class="_button"
:class="[$style.root, { [$style.inline]: inline, [$style.primary]: primary, [$style.gradate]: gradate, [$style.danger]: danger, [$style.rounded]: rounded, [$style.full]: full, [$style.small]: small, [$style.large]: large, [$style.transparent]: transparent, [$style.asLike]: asLike }]" :class="[$style.root, { [$style.inline]: inline, [$style.primary]: primary, [$style.gradate]: gradate, [$style.danger]: danger, [$style.rounded]: rounded, [$style.full]: full, [$style.small]: small, [$style.large]: large, [$style.transparent]: transparent, [$style.asLike]: asLike }]"
:to="to ?? '#'" :to="to ?? '#'"
:behavior="linkBehavior"
@mousedown="onMousedown" @mousedown="onMousedown"
> >
<div ref="ripples" :class="$style.ripples" :data-children-class="$style.ripple"></div> <div ref="ripples" :class="$style.ripples" :data-children-class="$style.ripple"></div>
@ -45,6 +46,7 @@ const props = defineProps<{
inline?: boolean; inline?: boolean;
link?: boolean; link?: boolean;
to?: string; to?: string;
linkBehavior?: null | 'window' | 'browser';
autofocus?: boolean; autofocus?: boolean;
wait?: boolean; wait?: boolean;
danger?: boolean; danger?: boolean;

View File

@ -80,7 +80,6 @@ function copy() {
.codePlaceholderRoot { .codePlaceholderRoot {
display: block; display: block;
width: 100%; width: 100%;
background: none;
border: none; border: none;
outline: none; outline: none;
font: inherit; font: inherit;

View File

@ -5,11 +5,15 @@ SPDX-License-Identifier: AGPL-3.0-only
<template> <template>
<div <div
ref="playerEl"
v-hotkey="keymap"
tabindex="0"
:class="[ :class="[
$style.audioContainer, $style.audioContainer,
(audio.isSensitive && defaultStore.state.highlightSensitiveMedia) && $style.sensitive, (audio.isSensitive && defaultStore.state.highlightSensitiveMedia) && $style.sensitive,
]" ]"
@contextmenu.stop @contextmenu.stop
@keydown.stop
> >
<button v-if="hide" :class="$style.hidden" @click="hide = false"> <button v-if="hide" :class="$style.hidden" @click="hide = false">
<div :class="$style.hiddenTextWrapper"> <div :class="$style.hiddenTextWrapper">
@ -18,6 +22,19 @@ SPDX-License-Identifier: AGPL-3.0-only
<span style="display: block;">{{ i18n.ts.clickToShow }}</span> <span style="display: block;">{{ i18n.ts.clickToShow }}</span>
</div> </div>
</button> </button>
<div v-else-if="defaultStore.reactiveState.useNativeUIForVideoAudioPlayer.value" :class="$style.nativeAudioContainer">
<audio
ref="audioEl"
preload="metadata"
controls
:class="$style.nativeAudio"
@keydown.prevent
>
<source :src="audio.url">
</audio>
</div>
<div v-else :class="$style.audioControls"> <div v-else :class="$style.audioControls">
<audio <audio
ref="audioEl" ref="audioEl"
@ -72,6 +89,41 @@ const props = defineProps<{
audio: Misskey.entities.DriveFile; audio: Misskey.entities.DriveFile;
}>(); }>();
const keymap = {
'up': () => {
if (hasFocus() && audioEl.value) {
volume.value = Math.min(volume.value + 0.1, 1);
}
},
'down': () => {
if (hasFocus() && audioEl.value) {
volume.value = Math.max(volume.value - 0.1, 0);
}
},
'left': () => {
if (hasFocus() && audioEl.value) {
audioEl.value.currentTime = Math.max(audioEl.value.currentTime - 5, 0);
}
},
'right': () => {
if (hasFocus() && audioEl.value) {
audioEl.value.currentTime = Math.min(audioEl.value.currentTime + 5, audioEl.value.duration);
}
},
'space': () => {
if (hasFocus()) {
togglePlayPause();
}
},
};
// PlayerEl
function hasFocus() {
if (!playerEl.value) return false;
return playerEl.value === document.activeElement || playerEl.value.contains(document.activeElement);
}
const playerEl = shallowRef<HTMLDivElement>();
const audioEl = shallowRef<HTMLAudioElement>(); const audioEl = shallowRef<HTMLAudioElement>();
// eslint-disable-next-line vue/no-setup-props-destructure // eslint-disable-next-line vue/no-setup-props-destructure
@ -85,6 +137,30 @@ function showMenu(ev: MouseEvent) {
menu = [ menu = [
// TODO: // TODO:
{
type: 'switch',
text: i18n.ts._mediaControls.loop,
icon: 'ti ti-repeat',
ref: loop,
},
{
type: 'radio',
text: i18n.ts._mediaControls.playbackRate,
icon: 'ti ti-clock-play',
ref: speed,
options: {
'0.25x': 0.25,
'0.5x': 0.5,
'0.75x': 0.75,
'1.0x': 1,
'1.25x': 1.25,
'1.5x': 1.5,
'2.0x': 2,
},
},
{
type: 'divider',
},
{ {
text: i18n.ts.hide, text: i18n.ts.hide,
icon: 'ti ti-eye-off', icon: 'ti ti-eye-off',
@ -147,6 +223,8 @@ const rangePercent = computed({
}, },
}); });
const volume = ref(.25); const volume = ref(.25);
const speed = ref(1);
const loop = ref(false); // TODO:
const bufferedEnd = ref(0); const bufferedEnd = ref(0);
const bufferedDataRatio = computed(() => { const bufferedDataRatio = computed(() => {
if (!audioEl.value) return 0; if (!audioEl.value) return 0;
@ -176,6 +254,7 @@ function toggleMute() {
} }
let onceInit = false; let onceInit = false;
let mediaTickFrameId: number | null = null;
let stopAudioElWatch: () => void; let stopAudioElWatch: () => void;
function init() { function init() {
@ -195,8 +274,12 @@ function init() {
} }
elapsedTimeMs.value = audioEl.value.currentTime * 1000; elapsedTimeMs.value = audioEl.value.currentTime * 1000;
if (audioEl.value.loop !== loop.value) {
loop.value = audioEl.value.loop;
}
} }
window.requestAnimationFrame(updateMediaTick); mediaTickFrameId = window.requestAnimationFrame(updateMediaTick);
} }
updateMediaTick(); updateMediaTick();
@ -234,6 +317,14 @@ watch(volume, (to) => {
if (audioEl.value) audioEl.value.volume = to; if (audioEl.value) audioEl.value.volume = to;
}); });
watch(speed, (to) => {
if (audioEl.value) audioEl.value.playbackRate = to;
});
watch(loop, (to) => {
if (audioEl.value) audioEl.value.loop = to;
});
onMounted(() => { onMounted(() => {
init(); init();
}); });
@ -252,6 +343,10 @@ onDeactivated(() => {
hide.value = (defaultStore.state.nsfw === 'force' || defaultStore.state.dataSaver.media) ? true : (props.audio.isSensitive && defaultStore.state.nsfw !== 'ignore'); hide.value = (defaultStore.state.nsfw === 'force' || defaultStore.state.dataSaver.media) ? true : (props.audio.isSensitive && defaultStore.state.nsfw !== 'ignore');
stopAudioElWatch(); stopAudioElWatch();
onceInit = false; onceInit = false;
if (mediaTickFrameId) {
window.cancelAnimationFrame(mediaTickFrameId);
mediaTickFrameId = null;
}
}); });
</script> </script>
@ -262,6 +357,10 @@ onDeactivated(() => {
border: .5px solid var(--divider); border: .5px solid var(--divider);
border-radius: var(--radius); border-radius: var(--radius);
overflow: clip; overflow: clip;
&:focus {
outline: none;
}
} }
.sensitive { .sensitive {
@ -367,4 +466,15 @@ onDeactivated(() => {
} }
} }
} }
.nativeAudioContainer {
display: flex;
align-items: center;
padding: 6px;
}
.nativeAudio {
display: block;
width: 100%;
}
</style> </style>

View File

@ -6,6 +6,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<template> <template>
<div <div
ref="playerEl" ref="playerEl"
v-hotkey="keymap"
tabindex="0"
:class="[ :class="[
$style.videoContainer, $style.videoContainer,
controlsShowing && $style.active, controlsShowing && $style.active,
@ -14,15 +16,37 @@ SPDX-License-Identifier: AGPL-3.0-only
@mouseover="onMouseOver" @mouseover="onMouseOver"
@mouseleave="onMouseLeave" @mouseleave="onMouseLeave"
@contextmenu.stop @contextmenu.stop
@keydown.stop
> >
<button v-if="hide" :class="$style.hidden" @click="onClick" @dblclick="defaultStore.state.nsfwOpenBehavior === 'doubleClick' ? hide = false : ''"> <button v-if="hide" :class="$style.hidden" @click="onClick" @dblclick="defaultStore.state.nsfwOpenBehavior === 'doubleClick' ? hide = false : ''">
<div :class="$style.hiddenTextWrapper"> <div :class="$style.hiddenTextWrapper">
<b v-if="video.isSensitive" style="display: block;"><i class="ti ti-eye-exclamation"></i> {{ i18n.ts.sensitive }}{{ defaultStore.state.dataSaver.media ? ` (${i18n.ts.video}${video.size ? ' ' + bytes(video.size) : ''})` : '' }}</b> <b v-if="video.isSensitive" style="display: block;"><i class="ti ti-eye-exclamation"></i> {{ i18n.ts.sensitive }}{{ defaultStore.state.dataSaver.media ? ` (${i18n.ts.video}${video.size ? ' ' + bytes(video.size) : ''})` : '' }}</b>
<b v-else style="display: block;"><i class="ti ti-photo"></i> {{ defaultStore.state.dataSaver.media && video.size ? bytes(video.size) : i18n.ts.video }}</b> <b v-else style="display: block;"><i class="ti ti-movie"></i> {{ defaultStore.state.dataSaver.media && video.size ? bytes(video.size) : i18n.ts.video }}</b>
<span style="display: block;">{{ clickToShowMessage }}</span> <span style="display: block;">{{ clickToShowMessage }}</span>
</div> </div>
</button> </button>
<div v-else :class="$style.videoRoot" @click.self="togglePlayPause">
<div v-else-if="defaultStore.reactiveState.useNativeUIForVideoAudioPlayer.value" :class="$style.videoRoot">
<video
ref="videoEl"
:class="$style.video"
:poster="video.thumbnailUrl ?? undefined"
:title="video.comment ?? undefined"
:alt="video.comment"
preload="metadata"
controls
@keydown.prevent
>
<source :src="video.url">
</video>
<i class="ti ti-eye-off" :class="$style.hide" @click="hide = true"></i>
<div :class="$style.indicators">
<div v-if="video.comment" :class="$style.indicator">ALT</div>
<div v-if="video.isSensitive" :class="$style.indicator" style="color: var(--warn);" :title="i18n.ts.sensitive"><i class="ti ti-eye-exclamation"></i></div>
</div>
</div>
<div v-else :class="$style.videoRoot">
<video <video
ref="videoEl" ref="videoEl"
:class="$style.video" :class="$style.video"
@ -31,6 +55,8 @@ SPDX-License-Identifier: AGPL-3.0-only
:alt="video.comment" :alt="video.comment"
preload="metadata" preload="metadata"
playsinline playsinline
@keydown.prevent
@click.self="togglePlayPause"
> >
<source :src="video.url"> <source :src="video.url">
</video> </video>
@ -101,6 +127,40 @@ const props = defineProps<{
video: Misskey.entities.DriveFile; video: Misskey.entities.DriveFile;
}>(); }>();
const keymap = {
'up': () => {
if (hasFocus() && videoEl.value) {
volume.value = Math.min(volume.value + 0.1, 1);
}
},
'down': () => {
if (hasFocus() && videoEl.value) {
volume.value = Math.max(volume.value - 0.1, 0);
}
},
'left': () => {
if (hasFocus() && videoEl.value) {
videoEl.value.currentTime = Math.max(videoEl.value.currentTime - 5, 0);
}
},
'right': () => {
if (hasFocus() && videoEl.value) {
videoEl.value.currentTime = Math.min(videoEl.value.currentTime + 5, videoEl.value.duration);
}
},
'space': () => {
if (hasFocus()) {
togglePlayPause();
}
},
};
// PlayerEl
function hasFocus() {
if (!playerEl.value) return false;
return playerEl.value === document.activeElement || playerEl.value.contains(document.activeElement);
}
// eslint-disable-next-line vue/no-setup-props-destructure // eslint-disable-next-line vue/no-setup-props-destructure
const hide = ref((defaultStore.state.nsfw === 'force' || defaultStore.state.dataSaver.media) ? true : (props.video.isSensitive && defaultStore.state.nsfw !== 'ignore')); const hide = ref((defaultStore.state.nsfw === 'force' || defaultStore.state.dataSaver.media) ? true : (props.video.isSensitive && defaultStore.state.nsfw !== 'ignore'));
@ -127,6 +187,35 @@ function showMenu(ev: MouseEvent) {
menu = [ menu = [
// TODO: // TODO:
{
type: 'switch',
text: i18n.ts._mediaControls.loop,
icon: 'ti ti-repeat',
ref: loop,
},
{
type: 'radio',
text: i18n.ts._mediaControls.playbackRate,
icon: 'ti ti-clock-play',
ref: speed,
options: {
'0.25x': 0.25,
'0.5x': 0.5,
'0.75x': 0.75,
'1.0x': 1,
'1.25x': 1.25,
'1.5x': 1.5,
'2.0x': 2,
},
},
...(document.pictureInPictureEnabled ? [{
text: i18n.ts._mediaControls.pip,
icon: 'ti ti-picture-in-picture',
action: togglePictureInPicture,
}] : []),
{
type: 'divider',
},
{ {
text: i18n.ts.hide, text: i18n.ts.hide,
icon: 'ti ti-eye-off', icon: 'ti ti-eye-off',
@ -202,6 +291,8 @@ const rangePercent = computed({
}, },
}); });
const volume = ref(.25); const volume = ref(.25);
const speed = ref(1);
const loop = ref(false); // TODO:
const bufferedEnd = ref(0); const bufferedEnd = ref(0);
const bufferedDataRatio = computed(() => { const bufferedDataRatio = computed(() => {
if (!videoEl.value) return 0; if (!videoEl.value) return 0;
@ -259,6 +350,16 @@ function toggleFullscreen() {
} }
} }
function togglePictureInPicture() {
if (videoEl.value) {
if (document.pictureInPictureElement) {
document.exitPictureInPicture();
} else {
videoEl.value.requestPictureInPicture();
}
}
}
function toggleMute() { function toggleMute() {
if (volume.value === 0) { if (volume.value === 0) {
volume.value = .25; volume.value = .25;
@ -268,6 +369,7 @@ function toggleMute() {
} }
let onceInit = false; let onceInit = false;
let mediaTickFrameId: number | null = null;
let stopVideoElWatch: () => void; let stopVideoElWatch: () => void;
function init() { function init() {
@ -287,8 +389,12 @@ function init() {
} }
elapsedTimeMs.value = videoEl.value.currentTime * 1000; elapsedTimeMs.value = videoEl.value.currentTime * 1000;
if (videoEl.value.loop !== loop.value) {
loop.value = videoEl.value.loop;
}
} }
window.requestAnimationFrame(updateMediaTick); mediaTickFrameId = window.requestAnimationFrame(updateMediaTick);
} }
updateMediaTick(); updateMediaTick();
@ -332,6 +438,14 @@ watch(volume, (to) => {
if (videoEl.value) videoEl.value.volume = to; if (videoEl.value) videoEl.value.volume = to;
}); });
watch(speed, (to) => {
if (videoEl.value) videoEl.value.playbackRate = to;
});
watch(loop, (to) => {
if (videoEl.value) videoEl.value.loop = to;
});
watch(hide, (to) => { watch(hide, (to) => {
if (to && isFullscreen.value) { if (to && isFullscreen.value) {
document.exitFullscreen(); document.exitFullscreen();
@ -357,6 +471,10 @@ onDeactivated(() => {
hide.value = (defaultStore.state.nsfw === 'force' || defaultStore.state.dataSaver.media) ? true : (props.video.isSensitive && defaultStore.state.nsfw !== 'ignore'); hide.value = (defaultStore.state.nsfw === 'force' || defaultStore.state.dataSaver.media) ? true : (props.video.isSensitive && defaultStore.state.nsfw !== 'ignore');
stopVideoElWatch(); stopVideoElWatch();
onceInit = false; onceInit = false;
if (mediaTickFrameId) {
window.cancelAnimationFrame(mediaTickFrameId);
mediaTickFrameId = null;
}
}); });
</script> </script>
@ -365,6 +483,10 @@ onDeactivated(() => {
container-type: inline-size; container-type: inline-size;
position: relative; position: relative;
overflow: clip; overflow: clip;
&:focus {
outline: none;
}
} }
.sensitive { .sensitive {
@ -428,7 +550,7 @@ onDeactivated(() => {
font: inherit; font: inherit;
color: inherit; color: inherit;
cursor: pointer; cursor: pointer;
padding: 120px 0; padding: 60px 0;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
@ -454,7 +576,6 @@ onDeactivated(() => {
display: block; display: block;
height: 100%; height: 100%;
width: 100%; width: 100%;
pointer-events: none;
} }
.videoOverlayPlayButton { .videoOverlayPlayButton {

View File

@ -43,9 +43,26 @@ SPDX-License-Identifier: AGPL-3.0-only
</div> </div>
</button> </button>
<button v-else-if="item.type === 'switch'" role="menuitemcheckbox" :tabindex="i" class="_button" :class="[$style.item, $style.switch, { [$style.switchDisabled]: item.disabled } ]" @click="switchItem(item)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)"> <button v-else-if="item.type === 'switch'" role="menuitemcheckbox" :tabindex="i" class="_button" :class="[$style.item, $style.switch, { [$style.switchDisabled]: item.disabled } ]" @click="switchItem(item)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
<MkSwitchButton :class="$style.switchButton" :checked="item.ref" :disabled="item.disabled" @toggle="switchItem(item)"/> <i v-if="item.icon" class="ti-fw" :class="[$style.icon, item.icon]"></i>
<MkSwitchButton v-else :class="$style.switchButton" :checked="item.ref" :disabled="item.disabled" @toggle="switchItem(item)"/>
<div :class="$style.item_content"> <div :class="$style.item_content">
<span :class="[$style.item_content_text, $style.switchText]">{{ item.text }}</span> <span :class="[$style.item_content_text, { [$style.switchText]: !item.icon }]">{{ item.text }}</span>
<MkSwitchButton v-if="item.icon" :class="[$style.switchButton, $style.caret]" :checked="item.ref" :disabled="item.disabled" @toggle="switchItem(item)"/>
</div>
</button>
<button v-else-if="item.type === 'radio'" class="_button" role="menuitem" :tabindex="i" :class="[$style.item, $style.parent, { [$style.childShowing]: childShowingItem === item }]" @mouseenter="preferClick ? null : showRadioOptions(item, $event)" @click="!preferClick ? null : showRadioOptions(item, $event)">
<i v-if="item.icon" class="ti-fw" :class="[$style.icon, item.icon]" style="pointer-events: none;"></i>
<div :class="$style.item_content">
<span :class="$style.item_content_text" style="pointer-events: none;">{{ item.text }}</span>
<span :class="$style.caret" style="pointer-events: none;"><i class="ti ti-chevron-right ti-fw"></i></span>
</div>
</button>
<button v-else-if="item.type === 'radioOption'" :tabindex="i" class="_button" role="menuitem" :class="[$style.item, { [$style.radioActive]: item.active }]" @click="clicked(item.action, $event, false)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
<div :class="$style.icon">
<span :class="[$style.radio, { [$style.radioChecked]: item.active }]"></span>
</div>
<div :class="$style.item_content">
<span :class="$style.item_content_text">{{ item.text }}</span>
</div> </div>
</button> </button>
<button v-else-if="item.type === 'parent'" class="_button" role="menuitem" :tabindex="i" :class="[$style.item, $style.parent, { [$style.childShowing]: childShowingItem === item }]" @mouseenter="preferClick ? null : showChildren(item, $event)" @click="!preferClick ? null : showChildren(item, $event)"> <button v-else-if="item.type === 'parent'" class="_button" role="menuitem" :tabindex="i" :class="[$style.item, $style.parent, { [$style.childShowing]: childShowingItem === item }]" @mouseenter="preferClick ? null : showChildren(item, $event)" @click="!preferClick ? null : showChildren(item, $event)">
@ -78,7 +95,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { ComputedRef, computed, defineAsyncComponent, isRef, nextTick, onBeforeUnmount, onMounted, ref, shallowRef, watch } from 'vue'; import { ComputedRef, computed, defineAsyncComponent, isRef, nextTick, onBeforeUnmount, onMounted, ref, shallowRef, watch } from 'vue';
import { focusPrev, focusNext } from '@/scripts/focus.js'; import { focusPrev, focusNext } from '@/scripts/focus.js';
import MkSwitchButton from '@/components/MkSwitch.button.vue'; import MkSwitchButton from '@/components/MkSwitch.button.vue';
import { MenuItem, InnerMenuItem, MenuPending, MenuAction, MenuSwitch, MenuParent } from '@/types/menu.js'; import { MenuItem, InnerMenuItem, MenuPending, MenuAction, MenuSwitch, MenuRadio, MenuRadioOption, MenuParent } from '@/types/menu.js';
import * as os from '@/os.js'; import * as os from '@/os.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { isTouchUsing } from '@/scripts/touch.js'; import { isTouchUsing } from '@/scripts/touch.js';
@ -170,6 +187,31 @@ function onItemMouseLeave(item) {
if (childCloseTimer) window.clearTimeout(childCloseTimer); if (childCloseTimer) window.clearTimeout(childCloseTimer);
} }
async function showRadioOptions(item: MenuRadio, ev: MouseEvent) {
const children: MenuItem[] = Object.keys(item.options).map<MenuRadioOption>(key => {
const value = item.options[key];
return {
type: 'radioOption',
text: key,
action: () => {
item.ref = value;
},
active: computed(() => item.ref === value),
};
});
if (props.asDrawer) {
os.popupMenu(children, ev.currentTarget ?? ev.target).finally(() => {
emit('close');
});
emit('hide');
} else {
childTarget.value = (ev.currentTarget ?? ev.target) as HTMLElement;
childMenu.value = children;
childShowingItem.value = item;
}
}
async function showChildren(item: MenuParent, ev: MouseEvent) { async function showChildren(item: MenuParent, ev: MouseEvent) {
const children: MenuItem[] = await (async () => { const children: MenuItem[] = await (async () => {
if (childrenCache.has(item)) { if (childrenCache.has(item)) {
@ -198,8 +240,10 @@ async function showChildren(item: MenuParent, ev: MouseEvent) {
} }
} }
function clicked(fn: MenuAction, ev: MouseEvent) { function clicked(fn: MenuAction, ev: MouseEvent, doClose = true) {
fn(ev); fn(ev);
if (!doClose) return;
close(true); close(true);
} }
@ -352,6 +396,15 @@ onBeforeUnmount(() => {
} }
} }
&.radioActive {
color: var(--accent) !important;
opacity: 1;
&:before {
background-color: var(--accentedBg) !important;
}
}
&:not(:active):focus-visible { &:not(:active):focus-visible {
box-shadow: 0 0 0 2px var(--focus) inset; box-shadow: 0 0 0 2px var(--focus) inset;
} }
@ -419,11 +472,11 @@ onBeforeUnmount(() => {
.switchButton { .switchButton {
margin-left: -2px; margin-left: -2px;
--height: 1.35em;
} }
.switchText { .switchText {
margin-left: 8px; margin-left: 8px;
margin-top: 2px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
@ -463,4 +516,32 @@ onBeforeUnmount(() => {
margin: 8px 0; margin: 8px 0;
border-top: solid 0.5px var(--divider); border-top: solid 0.5px var(--divider);
} }
.radio {
display: inline-block;
position: relative;
width: 1em;
height: 1em;
vertical-align: -.125em;
border-radius: 50%;
border: solid 2px var(--divider);
background-color: var(--panel);
&.radioChecked {
border-color: var(--accent);
&::after {
content: "";
display: block;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 50%;
height: 50%;
border-radius: 50%;
background-color: var(--accent);
}
}
}
</style> </style>

View File

@ -130,7 +130,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<div> <div>
<MkReactionsViewer v-if="appearNote.reactionAcceptance !== 'likeOnly'" :note="appearNote" :maxNumber="16" @click.stop @contextmenu.prevent.stop @mockUpdateMyReaction="emitUpdReaction"> <MkReactionsViewer v-if="appearNote.reactionAcceptance !== 'likeOnly'" :note="appearNote" :maxNumber="16" @click.stop @contextmenu.prevent.stop @mockUpdateMyReaction="emitUpdReaction">
<template #more> <template #more>
<div :class="$style.reactionOmitted">{{ i18n.ts.more }}</div> <MkA :to="`/notes/${appearNote.id}/reactions`" :class="[$style.reactionOmitted]">{{ i18n.ts.more }}</MkA>
</template> </template>
</MkReactionsViewer> </MkReactionsViewer>
<footer :class="$style.footer"> <footer :class="$style.footer">
@ -1256,9 +1256,8 @@ function emitUpdReaction(emoji: string, delta: number) {
.reactionOmitted { .reactionOmitted {
display: inline-block; display: inline-block;
height: 32px; margin-left: 8px;
margin: 2px;
padding: 0 6px;
opacity: .8; opacity: .8;
font-size: 95%;
} }
</style> </style>

View File

@ -327,9 +327,12 @@ import detectLanguage from '@/scripts/detect-language.js';
const MOBILE_THRESHOLD = 500; const MOBILE_THRESHOLD = 500;
const isMobile = ref(deviceKind === 'smartphone' || window.innerWidth <= MOBILE_THRESHOLD); const isMobile = ref(deviceKind === 'smartphone' || window.innerWidth <= MOBILE_THRESHOLD);
const props = defineProps<{ const props = withDefaults(defineProps<{
note: Misskey.entities.Note; note: Misskey.entities.Note;
}>(); initialTab: string;
}>(), {
initialTab: 'replies',
});
const inChannel = inject('inChannel', null); const inChannel = inject('inChannel', null);
@ -401,7 +404,7 @@ provide('react', (reaction: string) => {
}); });
}); });
const tab = ref('replies'); const tab = ref(props.initialTab);
const reactionTabType = ref<string | null>(null); const reactionTabType = ref<string | null>(null);
const renotesPagination = computed<Paging>(() => ({ const renotesPagination = computed<Paging>(() => ({

View File

@ -100,6 +100,9 @@ watch([() => props.note.reactions, () => props.maxNumber], ([newSource, maxNumbe
} }
.root { .root {
display: flex;
flex-wrap: wrap;
align-items: center;
margin: 10px -2px 10px -2px; margin: 10px -2px 10px -2px;
&:empty { &:empty {

View File

@ -62,7 +62,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<div v-if="showSubNoteFooterButton"> <div v-if="showSubNoteFooterButton">
<MkReactionsViewer v-show="note.cw == null || showContent" :note="note" :maxNumber="16" @click.stop @contextmenu.prevent.stop @mockUpdateMyReaction="emitUpdReaction"> <MkReactionsViewer v-show="note.cw == null || showContent" :note="note" :maxNumber="16" @click.stop @contextmenu.prevent.stop @mockUpdateMyReaction="emitUpdReaction">
<template #more> <template #more>
<div :class="$style.reactionOmitted">{{ i18n.ts.more }}</div> <MkA :to="`/notes/${note.id}/reactions`" :class="[$style.reactionOmitted]">{{ i18n.ts.more }}</MkA>
</template> </template>
</MkReactionsViewer> </MkReactionsViewer>
<footer :class="$style.footer"> <footer :class="$style.footer">
@ -590,4 +590,11 @@ function emitUpdReaction(emoji: string, delta: number) {
border-radius: 999px; border-radius: 999px;
box-shadow: 0 2px 6px rgb(0 0 0 / 20%); box-shadow: 0 2px 6px rgb(0 0 0 / 20%);
} }
.reactionOmitted {
display: inline-block;
margin-left: 8px;
opacity: .8;
font-size: 95%;
}
</style> </style>

View File

@ -43,13 +43,15 @@ const toggle = () => {
<style lang="scss" module> <style lang="scss" module>
.button { .button {
--height: 21px;
position: relative; position: relative;
display: inline-flex; display: inline-flex;
flex-shrink: 0; flex-shrink: 0;
margin: 0; margin: 0;
box-sizing: border-box; box-sizing: border-box;
width: 32px; width: calc(var(--height) * 1.6);
height: 23px; height: calc(var(--height) + 2px); //
outline: none; outline: none;
background: var(--switchOffBg); background: var(--switchOffBg);
background-clip: content-box; background-clip: content-box;
@ -71,9 +73,10 @@ const toggle = () => {
.knob { .knob {
position: absolute; position: absolute;
box-sizing: border-box;
top: 3px; top: 3px;
width: 15px; width: calc(var(--height) - 6px);
height: 15px; height: calc(var(--height) - 6px);
border-radius: 999px; border-radius: 999px;
transition: all 0.2s ease; transition: all 0.2s ease;
@ -84,7 +87,7 @@ const toggle = () => {
} }
.knobChecked { .knobChecked {
left: 12px; left: calc(calc(100% - var(--height)) + 3px);
background: var(--switchOnFg); background: var(--switchOnFg);
} }
</style> </style>

View File

@ -14,6 +14,7 @@ import XText from './page.text.vue';
import XSection from './page.section.vue'; import XSection from './page.section.vue';
import XImage from './page.image.vue'; import XImage from './page.image.vue';
import XNote from './page.note.vue'; import XNote from './page.note.vue';
import XDynamic from './page.dynamic.vue';
function getComponent(type: string) { function getComponent(type: string) {
switch (type) { switch (type) {
@ -21,6 +22,20 @@ function getComponent(type: string) {
case 'section': return XSection; case 'section': return XSection;
case 'image': return XImage; case 'image': return XImage;
case 'note': return XNote; case 'note': return XNote;
//
case 'button':
case 'if':
case 'textarea':
case 'post':
case 'canvas':
case 'numberInput':
case 'textInput':
case 'switch':
case 'radioButton':
case 'counter':
return XDynamic;
default: return null; default: return null;
} }
} }

View File

@ -0,0 +1,43 @@
<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->
<!-- 動的ページのブロックの代替利用できないということを表示する -->
<template>
<div :class="$style.root">
<div :class="$style.heading"><i class="ti ti-dice-5"></i> {{ i18n.ts._pages.blocks.dynamic }}</div>
<I18n :src="i18n.ts._pages.blocks.dynamicDescription" tag="div" :class="$style.text">
<template #play>
<MkA to="/play" class="_link">Play</MkA>
</template>
</I18n>
</div>
</template>
<script lang="ts" setup>
import * as Misskey from 'cherrypick-js';
import { i18n } from '@/i18n.js';
const props = defineProps<{
block: Misskey.entities.PageBlock,
page: Misskey.entities.Page,
}>();
</script>
<style lang="scss" module>
.root {
border: 1px solid var(--divider);
border-radius: var(--radius);
padding: var(--margin);
text-align: center;
}
.heading {
font-weight: 700;
}
.text {
font-size: 90%;
}
</style>

View File

@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template> <template>
<div class="_gaps" :class="$style.textRoot"> <div class="_gaps" :class="$style.textRoot">
<Mfm :text="block.text ?? ''" :isNote="false"/> <Mfm :text="block.text ?? ''" :isNote="false"/>
<div v-if="isEnabledUrlPreview"> <div v-if="isEnabledUrlPreview" class="_gaps_s">
<MkUrlPreview v-for="url in urls" :key="url" :url="url"/> <MkUrlPreview v-for="url in urls" :key="url" :url="url"/>
</div> </div>
</div> </div>

View File

@ -21,7 +21,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</div> </div>
<div class="_margin _gaps_s"> <div class="_margin _gaps_s">
<MkRemoteCaution v-if="note.user.host != null" :href="note.url ?? note.uri"/> <MkRemoteCaution v-if="note.user.host != null" :href="note.url ?? note.uri"/>
<MkNoteDetailed :key="note.id" v-model:note="note" :class="$style.note"/> <MkNoteDetailed :key="note.id" v-model:note="note" :initialTab="initialTab" :class="$style.note"/>
</div> </div>
<div v-if="clips && clips.length > 0" class="_margin"> <div v-if="clips && clips.length > 0" class="_margin">
<div style="font-weight: bold; padding: 12px;">{{ i18n.ts.clip }}</div> <div style="font-weight: bold; padding: 12px;">{{ i18n.ts.clip }}</div>
@ -66,6 +66,7 @@ import { defaultStore } from '@/store.js';
const props = defineProps<{ const props = defineProps<{
noteId: string; noteId: string;
initialTab?: string;
}>(); }>();
const note = ref<null | Misskey.entities.Note>(); const note = ref<null | Misskey.entities.Note>();

View File

@ -33,8 +33,12 @@ SPDX-License-Identifier: AGPL-3.0-only
<a href="https://support.google.com/accounts/answer/1066447" rel="noopener" target="_blank" class="_link">Google Authenticator</a> <a href="https://support.google.com/accounts/answer/1066447" rel="noopener" target="_blank" class="_link">Google Authenticator</a>
</template> </template>
</I18n> </I18n>
<div>{{ i18n.ts._2fa.step2 }}<br>{{ i18n.ts._2fa.step2Click }}</div> <div>{{ i18n.ts._2fa.step2 }}</div>
<a :href="twoFactorData.url"><img :class="$style.qr" :src="twoFactorData.qr"></a> <div>
<a :class="$style.qrRoot" :href="twoFactorData.url"><img :class="$style.qr" :src="twoFactorData.qr"></a>
<!-- QRコード側にマージンが入っているので直下でOK -->
<div><MkButton inline rounded link :to="twoFactorData.url" :linkBehavior="'browser'">{{ i18n.ts.launchApp }}</MkButton></div>
</div>
<MkKeyValue :copy="twoFactorData.url"> <MkKeyValue :copy="twoFactorData.url">
<template #key>{{ i18n.ts._2fa.step2Uri }}</template> <template #key>{{ i18n.ts._2fa.step2Uri }}</template>
<template #value>{{ twoFactorData.url }}</template> <template #value>{{ twoFactorData.url }}</template>
@ -177,8 +181,14 @@ function allDone() {
transform: translateX(-50px); transform: translateX(-50px);
} }
.qr { .qrRoot {
display: block;
margin: 0 auto;
width: 200px; width: 200px;
max-width: 100%; max-width: 100%;
} }
.qr {
width: 100%;
}
</style> </style>

View File

@ -172,6 +172,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkSwitch v-model="disableDrawer">{{ i18n.ts.disableDrawer }}</MkSwitch> <MkSwitch v-model="disableDrawer">{{ i18n.ts.disableDrawer }}</MkSwitch>
<MkSwitch v-model="forceShowAds">{{ i18n.ts.forceShowAds }}</MkSwitch> <MkSwitch v-model="forceShowAds">{{ i18n.ts.forceShowAds }}</MkSwitch>
<MkSwitch v-model="enableSeasonalScreenEffect">{{ i18n.ts.seasonalScreenEffect }}</MkSwitch> <MkSwitch v-model="enableSeasonalScreenEffect">{{ i18n.ts.seasonalScreenEffect }}</MkSwitch>
<MkSwitch v-model="useNativeUIForVideoAudioPlayer">{{ i18n.ts.useNativeUIForVideoAudioPlayer }}</MkSwitch>
<MkSwitch v-model="showUnreadNotificationsCount">{{ i18n.ts.showUnreadNotificationsCount }}</MkSwitch> <MkSwitch v-model="showUnreadNotificationsCount">{{ i18n.ts.showUnreadNotificationsCount }}</MkSwitch>
</div> </div>
<div> <div>
@ -436,6 +437,7 @@ const disableStreamingTimeline = computed(defaultStore.makeGetterSetter('disable
const useGroupedNotifications = computed(defaultStore.makeGetterSetter('useGroupedNotifications')); const useGroupedNotifications = computed(defaultStore.makeGetterSetter('useGroupedNotifications'));
const enableSeasonalScreenEffect = computed(defaultStore.makeGetterSetter('enableSeasonalScreenEffect')); const enableSeasonalScreenEffect = computed(defaultStore.makeGetterSetter('enableSeasonalScreenEffect'));
const enableHorizontalSwipe = computed(defaultStore.makeGetterSetter('enableHorizontalSwipe')); const enableHorizontalSwipe = computed(defaultStore.makeGetterSetter('enableHorizontalSwipe'));
const useNativeUIForVideoAudioPlayer = computed(defaultStore.makeGetterSetter('useNativeUIForVideoAudioPlayer'));
const showUnreadNotificationsCount = computed(defaultStore.makeGetterSetter('showUnreadNotificationsCount')); const showUnreadNotificationsCount = computed(defaultStore.makeGetterSetter('showUnreadNotificationsCount'));
const newNoteReceivedNotificationBehavior = computed(defaultStore.makeGetterSetter('newNoteReceivedNotificationBehavior')); const newNoteReceivedNotificationBehavior = computed(defaultStore.makeGetterSetter('newNoteReceivedNotificationBehavior'));
const fontSize = computed(defaultStore.makeGetterSetter('fontSize')); const fontSize = computed(defaultStore.makeGetterSetter('fontSize'));

View File

@ -35,7 +35,7 @@ const routes: RouteDef[] = [{
component: page(() => import('@/pages/user/index.vue')), component: page(() => import('@/pages/user/index.vue')),
}, { }, {
name: 'note', name: 'note',
path: '/notes/:noteId', path: '/notes/:noteId/:initialTab?',
component: page(() => import('@/pages/note.vue')), component: page(() => import('@/pages/note.vue')),
}, { }, {
name: 'list', name: 'list',

View File

@ -15,6 +15,7 @@ export default (input: string): string[] => {
export const aliases = { export const aliases = {
'esc': 'Escape', 'esc': 'Escape',
'enter': ['Enter', 'NumpadEnter'], 'enter': ['Enter', 'NumpadEnter'],
'space': [' ', 'Spacebar'],
'up': 'ArrowUp', 'up': 'ArrowUp',
'down': 'ArrowDown', 'down': 'ArrowDown',
'left': 'ArrowLeft', 'left': 'ArrowLeft',

View File

@ -26,8 +26,8 @@ export function calcPopupPosition(el: HTMLElement, props: {
let top: number; let top: number;
if (props.anchorElement) { if (props.anchorElement) {
left = rect.left + window.pageXOffset + (props.anchorElement.offsetWidth / 2); left = rect.left + window.scrollX + (props.anchorElement.offsetWidth / 2);
top = (rect.top + window.pageYOffset - contentHeight) - props.innerMargin; top = (rect.top + window.scrollY - contentHeight) - props.innerMargin;
} else { } else {
left = props.x; left = props.x;
top = (props.y - contentHeight) - props.innerMargin; top = (props.y - contentHeight) - props.innerMargin;
@ -35,8 +35,8 @@ export function calcPopupPosition(el: HTMLElement, props: {
left -= (el.offsetWidth / 2); left -= (el.offsetWidth / 2);
if (left + contentWidth - window.pageXOffset > window.innerWidth) { if (left + contentWidth - window.scrollX > window.innerWidth) {
left = window.innerWidth - contentWidth + window.pageXOffset - 1; left = window.innerWidth - contentWidth + window.scrollX - 1;
} }
return [left, top]; return [left, top];
@ -47,8 +47,8 @@ export function calcPopupPosition(el: HTMLElement, props: {
let top: number; let top: number;
if (props.anchorElement) { if (props.anchorElement) {
left = rect.left + window.pageXOffset + (props.anchorElement.offsetWidth / 2); left = rect.left + window.scrollX + (props.anchorElement.offsetWidth / 2);
top = (rect.top + window.pageYOffset + props.anchorElement.offsetHeight) + props.innerMargin; top = (rect.top + window.scrollY + props.anchorElement.offsetHeight) + props.innerMargin;
} else { } else {
left = props.x; left = props.x;
top = (props.y) + props.innerMargin; top = (props.y) + props.innerMargin;
@ -56,8 +56,8 @@ export function calcPopupPosition(el: HTMLElement, props: {
left -= (el.offsetWidth / 2); left -= (el.offsetWidth / 2);
if (left + contentWidth - window.pageXOffset > window.innerWidth) { if (left + contentWidth - window.scrollX > window.innerWidth) {
left = window.innerWidth - contentWidth + window.pageXOffset - 1; left = window.innerWidth - contentWidth + window.scrollX - 1;
} }
return [left, top]; return [left, top];
@ -68,8 +68,8 @@ export function calcPopupPosition(el: HTMLElement, props: {
let top: number; let top: number;
if (props.anchorElement) { if (props.anchorElement) {
left = (rect.left + window.pageXOffset - contentWidth) - props.innerMargin; left = (rect.left + window.scrollX - contentWidth) - props.innerMargin;
top = rect.top + window.pageYOffset + (props.anchorElement.offsetHeight / 2); top = rect.top + window.scrollY + (props.anchorElement.offsetHeight / 2);
} else { } else {
left = (props.x - contentWidth) - props.innerMargin; left = (props.x - contentWidth) - props.innerMargin;
top = props.y; top = props.y;
@ -77,8 +77,8 @@ export function calcPopupPosition(el: HTMLElement, props: {
top -= (el.offsetHeight / 2); top -= (el.offsetHeight / 2);
if (top + contentHeight - window.pageYOffset > window.innerHeight) { if (top + contentHeight - window.scrollY > window.innerHeight) {
top = window.innerHeight - contentHeight + window.pageYOffset - 1; top = window.innerHeight - contentHeight + window.scrollY - 1;
} }
return [left, top]; return [left, top];
@ -89,15 +89,15 @@ export function calcPopupPosition(el: HTMLElement, props: {
let top: number; let top: number;
if (props.anchorElement) { if (props.anchorElement) {
left = (rect.left + props.anchorElement.offsetWidth + window.pageXOffset) + props.innerMargin; left = (rect.left + props.anchorElement.offsetWidth + window.scrollX) + props.innerMargin;
if (props.align === 'top') { if (props.align === 'top') {
top = rect.top + window.pageYOffset; top = rect.top + window.scrollY;
if (props.alignOffset != null) top += props.alignOffset; if (props.alignOffset != null) top += props.alignOffset;
} else if (props.align === 'bottom') { } else if (props.align === 'bottom') {
// TODO // TODO
} else { // center } else { // center
top = rect.top + window.pageYOffset + (props.anchorElement.offsetHeight / 2); top = rect.top + window.scrollY + (props.anchorElement.offsetHeight / 2);
top -= (el.offsetHeight / 2); top -= (el.offsetHeight / 2);
} }
} else { } else {
@ -106,8 +106,8 @@ export function calcPopupPosition(el: HTMLElement, props: {
top -= (el.offsetHeight / 2); top -= (el.offsetHeight / 2);
} }
if (top + contentHeight - window.pageYOffset > window.innerHeight) { if (top + contentHeight - window.scrollY > window.innerHeight) {
top = window.innerHeight - contentHeight + window.pageYOffset - 1; top = window.innerHeight - contentHeight + window.scrollY - 1;
} }
return [left, top]; return [left, top];
@ -123,7 +123,7 @@ export function calcPopupPosition(el: HTMLElement, props: {
const [left, top] = calcPosWhenTop(); const [left, top] = calcPosWhenTop();
// ツールチップを上に向かって表示するスペースがなければ下に向かって出す // ツールチップを上に向かって表示するスペースがなければ下に向かって出す
if (top - window.pageYOffset < 0) { if (top - window.scrollY < 0) {
const [left, top] = calcPosWhenBottom(); const [left, top] = calcPosWhenBottom();
return { left, top, transformOrigin: 'center top' }; return { left, top, transformOrigin: 'center top' };
} }
@ -141,7 +141,7 @@ export function calcPopupPosition(el: HTMLElement, props: {
const [left, top] = calcPosWhenLeft(); const [left, top] = calcPosWhenLeft();
// ツールチップを左に向かって表示するスペースがなければ右に向かって出す // ツールチップを左に向かって表示するスペースがなければ右に向かって出す
if (left - window.pageXOffset < 0) { if (left - window.scrollX < 0) {
const [left, top] = calcPosWhenRight(); const [left, top] = calcPosWhenRight();
return { left, top, transformOrigin: 'left center' }; return { left, top, transformOrigin: 'left center' };
} }

View File

@ -53,11 +53,11 @@ export function useChartTooltip(opts: { position: 'top' | 'middle' } = { positio
const rect = context.chart.canvas.getBoundingClientRect(); const rect = context.chart.canvas.getBoundingClientRect();
tooltipShowing.value = true; tooltipShowing.value = true;
tooltipX.value = rect.left + window.pageXOffset + context.tooltip.caretX; tooltipX.value = rect.left + window.scrollX + context.tooltip.caretX;
if (opts.position === 'top') { if (opts.position === 'top') {
tooltipY.value = rect.top + window.pageYOffset; tooltipY.value = rect.top + window.scrollY;
} else if (opts.position === 'middle') { } else if (opts.position === 'middle') {
tooltipY.value = rect.top + window.pageYOffset + context.tooltip.caretY; tooltipY.value = rect.top + window.scrollY + context.tooltip.caretY;
} }
} }

View File

@ -460,6 +460,10 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'device', where: 'device',
default: true, default: true,
}, },
useNativeUIForVideoAudioPlayer: {
where: 'device',
default: false,
},
showUnreadNotificationsCount: { showUnreadNotificationsCount: {
where: 'deviceAccount', where: 'deviceAccount',
default: false, default: false,

View File

@ -6,6 +6,8 @@
import * as Misskey from 'cherrypick-js'; import * as Misskey from 'cherrypick-js';
import { ComputedRef, Ref } from 'vue'; import { ComputedRef, Ref } from 'vue';
interface MenuRadioOptionsDef extends Record<string, any> { }
export type MenuAction = (ev: MouseEvent) => void; export type MenuAction = (ev: MouseEvent) => void;
export type MenuDivider = { type: 'divider' }; export type MenuDivider = { type: 'divider' };
@ -14,13 +16,15 @@ export type MenuLabel = { type: 'label', text: string };
export type MenuLink = { type: 'link', to: string, text: string, icon?: string, indicate?: boolean, avatar?: Misskey.entities.User }; export type MenuLink = { type: 'link', to: string, text: string, icon?: string, indicate?: boolean, avatar?: Misskey.entities.User };
export type MenuA = { type: 'a', href: string, target?: string, download?: string, text: string, icon?: string, indicate?: boolean }; export type MenuA = { type: 'a', href: string, target?: string, download?: string, text: string, icon?: string, indicate?: boolean };
export type MenuUser = { type: 'user', user: Misskey.entities.User, active?: boolean, indicate?: boolean, action: MenuAction }; export type MenuUser = { type: 'user', user: Misskey.entities.User, active?: boolean, indicate?: boolean, action: MenuAction };
export type MenuSwitch = { type: 'switch', ref: Ref<boolean>, text: string, disabled?: boolean | Ref<boolean> }; export type MenuSwitch = { type: 'switch', ref: Ref<boolean>, text: string, icon?: string, disabled?: boolean | Ref<boolean> };
export type MenuButton = { type?: 'button', text: string, icon?: string, indicate?: boolean, danger?: boolean, active?: boolean | ComputedRef<boolean>, avatar?: Misskey.entities.User; action: MenuAction }; export type MenuButton = { type?: 'button', text: string, icon?: string, indicate?: boolean, danger?: boolean, active?: boolean | ComputedRef<boolean>, avatar?: Misskey.entities.User; action: MenuAction };
export type MenuRadio = { type: 'radio', text: string, icon?: string, ref: Ref<MenuRadioOptionsDef[keyof MenuRadioOptionsDef]>, options: MenuRadioOptionsDef, disabled?: boolean | Ref<boolean> };
export type MenuRadioOption = { type: 'radioOption', text: string, action: MenuAction; active?: boolean | ComputedRef<boolean> };
export type MenuParent = { type: 'parent', text: string, icon?: string, children: MenuItem[] | (() => Promise<MenuItem[]> | MenuItem[]) }; export type MenuParent = { type: 'parent', text: string, icon?: string, children: MenuItem[] | (() => Promise<MenuItem[]> | MenuItem[]) };
export type MenuPending = { type: 'pending' }; export type MenuPending = { type: 'pending' };
type OuterMenuItem = MenuDivider | MenuNull | MenuLabel | MenuLink | MenuA | MenuUser | MenuSwitch | MenuButton | MenuParent; type OuterMenuItem = MenuDivider | MenuNull | MenuLabel | MenuLink | MenuA | MenuUser | MenuSwitch | MenuButton | MenuRadio | MenuRadioOption | MenuParent;
type OuterPromiseMenuItem = Promise<MenuLabel | MenuLink | MenuA | MenuUser | MenuSwitch | MenuButton | MenuParent>; type OuterPromiseMenuItem = Promise<MenuLabel | MenuLink | MenuA | MenuUser | MenuSwitch | MenuButton | MenuParent>;
export type MenuItem = OuterMenuItem | OuterPromiseMenuItem; export type MenuItem = OuterMenuItem | OuterPromiseMenuItem;
export type InnerMenuItem = MenuDivider | MenuPending | MenuLabel | MenuLink | MenuA | MenuUser | MenuSwitch | MenuButton | MenuParent; export type InnerMenuItem = MenuDivider | MenuPending | MenuLabel | MenuLink | MenuA | MenuUser | MenuSwitch | MenuButton | MenuRadio | MenuRadioOption | MenuParent;

View File

@ -5,3 +5,4 @@ node_modules
/jest.config.ts /jest.config.ts
/test /test
/test-d /test-d
build.js

View File

@ -1,31 +1,105 @@
import * as esbuild from "esbuild";
import { build } from "esbuild"; import { build } from "esbuild";
import { globSync } from "glob"; import { globSync } from "glob";
import { execa } from "execa";
import fs from "node:fs";
import { fileURLToPath } from "node:url";
import { dirname } from "node:path";
const _filename = fileURLToPath(import.meta.url);
const _dirname = dirname(_filename);
const _package = JSON.parse(fs.readFileSync(_dirname + '/package.json', 'utf-8'));
const entryPoints = globSync("./src/**/**.{ts,tsx}"); const entryPoints = globSync("./src/**/**.{ts,tsx}");
/** @type {import('esbuild').BuildOptions} */ /** @type {import('esbuild').BuildOptions} */
const options = { const options = {
entryPoints, entryPoints,
minify: true, minify: process.env.NODE_ENV === 'production',
outdir: "./built/esm", outdir: "./built",
target: "es2022", target: "es2022",
platform: "browser", platform: "browser",
format: "esm", format: "esm",
sourcemap: 'linked',
}; };
if (process.env.WATCH === "true") { // built配下をすべて削除する
options.watch = { fs.rmSync('./built', { recursive: true, force: true });
onRebuild(error, result) {
if (error) { if (process.argv.map(arg => arg.toLowerCase()).includes("--watch")) {
console.error("watch build failed:", error); await watchSrc();
} else { } else {
console.log("watch build succeeded:", result); await buildSrc();
}
},
};
} }
build(options).catch((err) => { async function buildSrc() {
process.stderr.write(err.stderr); console.log(`[${_package.name}] start building...`);
process.exit(1);
}); await build(options)
.then(it => {
console.log(`[${_package.name}] build succeeded.`);
})
.catch((err) => {
process.stderr.write(err.stderr);
process.exit(1);
});
if (process.env.NODE_ENV === 'production') {
console.log(`[${_package.name}] skip building d.ts because NODE_ENV is production.`);
} else {
await buildDts();
}
console.log(`[${_package.name}] finish building.`);
}
function buildDts() {
return execa(
'tsc',
[
'--project', 'tsconfig.json',
'--outDir', 'built',
'--declaration', 'true',
'--emitDeclarationOnly', 'true',
],
{
stdout: process.stdout,
stderr: process.stderr,
}
);
}
async function watchSrc() {
const plugins = [{
name: 'gen-dts',
setup(build) {
build.onStart(() => {
console.log(`[${_package.name}] detect changed...`);
});
build.onEnd(async result => {
if (result.errors.length > 0) {
console.error(`[${_package.name}] watch build failed:`, result);
return;
}
await buildDts();
});
},
}];
console.log(`[${_package.name}] start watching...`)
const context = await esbuild.context({ ...options, plugins });
await context.watch();
await new Promise((resolve, reject) => {
process.on('SIGHUP', resolve);
process.on('SIGINT', resolve);
process.on('SIGTERM', resolve);
process.on('SIGKILL', resolve);
process.on('uncaughtException', reject);
process.on('exit', resolve);
}).finally(async () => {
await context.dispose();
console.log(`[${_package.name}] finish watching.`);
});
}

View File

@ -2,24 +2,21 @@
"type": "module", "type": "module",
"name": "misskey-bubble-game", "name": "misskey-bubble-game",
"version": "0.0.1", "version": "0.0.1",
"types": "./built/dts/index.d.ts", "main": "./built/index.js",
"types": "./built/index.d.ts",
"exports": { "exports": {
".": { ".": {
"import": "./built/esm/index.js", "import": "./built/index.js",
"types": "./built/dts/index.d.ts" "types": "./built/index.d.ts"
}, },
"./*": { "./*": {
"import": "./built/esm/*", "import": "./built/*",
"types": "./built/dts/*" "types": "./built/*"
} }
}, },
"scripts": { "scripts": {
"build": "node ./build.js", "build": "node ./build.js",
"build:tsc": "npm run tsc", "watch": "nodemon -w package.json -e json --exec \"node ./build.js --watch\"",
"tsc": "npm run tsc-esm && npm run tsc-dts",
"tsc-esm": "tsc --outDir built/esm",
"tsc-dts": "tsc --outDir built/dts --declaration true --emitDeclarationOnly true --declarationMap true",
"watch": "nodemon -w src -e ts,js,cjs,mjs,json --exec \"pnpm run build:tsc\"",
"eslint": "eslint . --ext .js,.jsx,.ts,.tsx", "eslint": "eslint . --ext .js,.jsx,.ts,.tsx",
"typecheck": "tsc --noEmit", "typecheck": "tsc --noEmit",
"lint": "pnpm typecheck && pnpm eslint" "lint": "pnpm typecheck && pnpm eslint"
@ -27,21 +24,22 @@
"devDependencies": { "devDependencies": {
"@misskey-dev/eslint-plugin": "1.0.0", "@misskey-dev/eslint-plugin": "1.0.0",
"@types/matter-js": "0.19.6", "@types/matter-js": "0.19.6",
"@types/node": "20.11.5",
"@types/seedrandom": "3.0.8", "@types/seedrandom": "3.0.8",
"@types/node": "20.11.5",
"@typescript-eslint/eslint-plugin": "7.1.0", "@typescript-eslint/eslint-plugin": "7.1.0",
"@typescript-eslint/parser": "7.1.0", "@typescript-eslint/parser": "7.1.0",
"eslint": "8.57.0", "eslint": "8.57.0",
"nodemon": "3.0.2", "nodemon": "3.0.2",
"typescript": "5.3.3" "execa": "8.0.1",
"typescript": "5.3.3",
"esbuild": "0.19.11",
"glob": "10.3.10"
}, },
"files": [ "files": [
"built" "built"
], ],
"dependencies": { "dependencies": {
"esbuild": "0.19.11",
"eventemitter3": "5.0.1", "eventemitter3": "5.0.1",
"glob": "^10.3.10",
"matter-js": "0.19.0", "matter-js": "0.19.0",
"seedrandom": "3.0.5" "seedrandom": "3.0.5"
} }

View File

@ -6,5 +6,9 @@
import { DropAndFusionGame, Mono } from './game.js'; import { DropAndFusionGame, Mono } from './game.js';
export { export {
DropAndFusionGame, Mono, DropAndFusionGame,
};
export type {
Mono,
}; };

View File

@ -6,7 +6,7 @@
"moduleResolution": "nodenext", "moduleResolution": "nodenext",
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,
"sourceMap": true, "sourceMap": false,
"outDir": "./built/", "outDir": "./built/",
"removeComments": true, "removeComments": true,
"strict": true, "strict": true,

View File

@ -5,3 +5,4 @@ node_modules
/jest.config.ts /jest.config.ts
/test /test
/test-d /test-d
build.js

View File

@ -1,31 +1,105 @@
import * as esbuild from "esbuild";
import { build } from "esbuild"; import { build } from "esbuild";
import { globSync } from "glob"; import { globSync } from "glob";
import { execa } from "execa";
import fs from "node:fs";
import { fileURLToPath } from "node:url";
import { dirname } from "node:path";
const _filename = fileURLToPath(import.meta.url);
const _dirname = dirname(_filename);
const _package = JSON.parse(fs.readFileSync(_dirname + '/package.json', 'utf-8'));
const entryPoints = globSync("./src/**/**.{ts,tsx}"); const entryPoints = globSync("./src/**/**.{ts,tsx}");
/** @type {import('esbuild').BuildOptions} */ /** @type {import('esbuild').BuildOptions} */
const options = { const options = {
entryPoints, entryPoints,
minify: true, minify: process.env.NODE_ENV === 'production',
outdir: "./built/esm", outdir: "./built",
target: "es2022", target: "es2022",
platform: "browser", platform: "browser",
format: "esm", format: "esm",
sourcemap: 'linked',
}; };
if (process.env.WATCH === "true") { // built配下をすべて削除する
options.watch = { fs.rmSync('./built', { recursive: true, force: true });
onRebuild(error, result) {
if (error) { if (process.argv.map(arg => arg.toLowerCase()).includes("--watch")) {
console.error("watch build failed:", error); await watchSrc();
} else { } else {
console.log("watch build succeeded:", result); await buildSrc();
}
},
};
} }
build(options).catch((err) => { async function buildSrc() {
process.stderr.write(err.stderr); console.log(`[${_package.name}] start building...`);
process.exit(1);
}); await build(options)
.then(it => {
console.log(`[${_package.name}] build succeeded.`);
})
.catch((err) => {
process.stderr.write(err.stderr);
process.exit(1);
});
if (process.env.NODE_ENV === 'production') {
console.log(`[${_package.name}] skip building d.ts because NODE_ENV is production.`);
} else {
await buildDts();
}
console.log(`[${_package.name}] finish building.`);
}
function buildDts() {
return execa(
'tsc',
[
'--project', 'tsconfig.json',
'--outDir', 'built',
'--declaration', 'true',
'--emitDeclarationOnly', 'true',
],
{
stdout: process.stdout,
stderr: process.stderr,
}
);
}
async function watchSrc() {
const plugins = [{
name: 'gen-dts',
setup(build) {
build.onStart(() => {
console.log(`[${_package.name}] detect changed...`);
});
build.onEnd(async result => {
if (result.errors.length > 0) {
console.error(`[${_package.name}] watch build failed:`, result);
return;
}
await buildDts();
});
},
}];
console.log(`[${_package.name}] start watching...`)
const context = await esbuild.context({ ...options, plugins });
await context.watch();
await new Promise((resolve, reject) => {
process.on('SIGHUP', resolve);
process.on('SIGINT', resolve);
process.on('SIGTERM', resolve);
process.on('SIGKILL', resolve);
process.on('uncaughtException', reject);
process.on('exit', resolve);
}).finally(async () => {
await context.dispose();
console.log(`[${_package.name}] finish watching.`);
});
}

View File

@ -2,24 +2,21 @@
"type": "module", "type": "module",
"name": "misskey-reversi", "name": "misskey-reversi",
"version": "0.0.1", "version": "0.0.1",
"types": "./built/dts/index.d.ts", "main": "./built/index.js",
"types": "./built/index.d.ts",
"exports": { "exports": {
".": { ".": {
"import": "./built/esm/index.js", "import": "./built/index.js",
"types": "./built/dts/index.d.ts" "types": "./built/index.d.ts"
}, },
"./*": { "./*": {
"import": "./built/esm/*", "import": "./built/*",
"types": "./built/dts/*" "types": "./built/*"
} }
}, },
"scripts": { "scripts": {
"build": "node ./build.js", "build": "node ./build.js",
"build:tsc": "npm run tsc", "watch": "nodemon -w package.json -e json --exec \"node ./build.js --watch\"",
"tsc": "npm run tsc-esm && npm run tsc-dts",
"tsc-esm": "tsc --outDir built/esm",
"tsc-dts": "tsc --outDir built/dts --declaration true --emitDeclarationOnly true --declarationMap true",
"watch": "nodemon -w src -e ts,js,cjs,mjs,json --exec \"pnpm run build:tsc\"",
"eslint": "eslint . --ext .js,.jsx,.ts,.tsx", "eslint": "eslint . --ext .js,.jsx,.ts,.tsx",
"typecheck": "tsc --noEmit", "typecheck": "tsc --noEmit",
"lint": "pnpm typecheck && pnpm eslint" "lint": "pnpm typecheck && pnpm eslint"
@ -30,15 +27,16 @@
"@typescript-eslint/eslint-plugin": "7.1.0", "@typescript-eslint/eslint-plugin": "7.1.0",
"@typescript-eslint/parser": "7.1.0", "@typescript-eslint/parser": "7.1.0",
"eslint": "8.57.0", "eslint": "8.57.0",
"execa": "8.0.1",
"nodemon": "3.0.2", "nodemon": "3.0.2",
"typescript": "5.3.3" "typescript": "5.3.3",
"esbuild": "0.19.11",
"glob": "10.3.10"
}, },
"files": [ "files": [
"built" "built"
], ],
"dependencies": { "dependencies": {
"crc-32": "1.2.2", "crc-32": "1.2.2"
"esbuild": "0.19.11",
"glob": "10.3.10"
} }
} }

View File

@ -6,7 +6,7 @@
"moduleResolution": "nodenext", "moduleResolution": "nodenext",
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,
"sourceMap": true, "sourceMap": false,
"outDir": "./built/", "outDir": "./built/",
"removeComments": true, "removeComments": true,
"strict": true, "strict": true,

View File

@ -15,12 +15,18 @@ importers:
cssnano: cssnano:
specifier: 6.0.5 specifier: 6.0.5
version: 6.0.5(postcss@8.4.35) version: 6.0.5(postcss@8.4.35)
esbuild:
specifier: 0.19.11
version: 0.19.11
execa: execa:
specifier: 8.0.1 specifier: 8.0.1
version: 8.0.1 version: 8.0.1
fast-glob: fast-glob:
specifier: 3.3.2 specifier: 3.3.2
version: 3.3.2 version: 3.3.2
glob:
specifier: 10.3.10
version: 10.3.10
ignore-walk: ignore-walk:
specifier: 6.0.4 specifier: 6.0.4
version: 6.0.4 version: 6.0.4
@ -691,12 +697,6 @@ importers:
packages/cherrypick-js: packages/cherrypick-js:
dependencies: dependencies:
'@swc/cli':
specifier: 0.1.63
version: 0.1.63(@swc/core@1.3.105)
'@swc/core':
specifier: 1.3.105
version: 1.3.105
eventemitter3: eventemitter3:
specifier: 5.0.1 specifier: 5.0.1
version: 5.0.1 version: 5.0.1
@ -725,9 +725,18 @@ importers:
'@typescript-eslint/parser': '@typescript-eslint/parser':
specifier: 7.1.0 specifier: 7.1.0
version: 7.1.0(eslint@8.57.0)(typescript@5.3.3) version: 7.1.0(eslint@8.57.0)(typescript@5.3.3)
esbuild:
specifier: 0.19.11
version: 0.19.11
eslint: eslint:
specifier: 8.57.0 specifier: 8.57.0
version: 8.57.0 version: 8.57.0
execa:
specifier: 8.0.1
version: 8.0.1
glob:
specifier: 10.3.10
version: 10.3.10
jest: jest:
specifier: 29.7.0 specifier: 29.7.0
version: 29.7.0(@types/node@20.11.22) version: 29.7.0(@types/node@20.11.22)
@ -1182,15 +1191,9 @@ importers:
packages/misskey-bubble-game: packages/misskey-bubble-game:
dependencies: dependencies:
esbuild:
specifier: 0.19.11
version: 0.19.11
eventemitter3: eventemitter3:
specifier: 5.0.1 specifier: 5.0.1
version: 5.0.1 version: 5.0.1
glob:
specifier: ^10.3.10
version: 10.3.10
matter-js: matter-js:
specifier: 0.19.0 specifier: 0.19.0
version: 0.19.0 version: 0.19.0
@ -1216,9 +1219,18 @@ importers:
'@typescript-eslint/parser': '@typescript-eslint/parser':
specifier: 7.1.0 specifier: 7.1.0
version: 7.1.0(eslint@8.57.0)(typescript@5.3.3) version: 7.1.0(eslint@8.57.0)(typescript@5.3.3)
esbuild:
specifier: 0.19.11
version: 0.19.11
eslint: eslint:
specifier: 8.57.0 specifier: 8.57.0
version: 8.57.0 version: 8.57.0
execa:
specifier: 8.0.1
version: 8.0.1
glob:
specifier: 10.3.10
version: 10.3.10
nodemon: nodemon:
specifier: 3.0.2 specifier: 3.0.2
version: 3.0.2 version: 3.0.2
@ -1231,12 +1243,6 @@ importers:
crc-32: crc-32:
specifier: 1.2.2 specifier: 1.2.2
version: 1.2.2 version: 1.2.2
esbuild:
specifier: 0.19.11
version: 0.19.11
glob:
specifier: 10.3.10
version: 10.3.10
devDependencies: devDependencies:
'@misskey-dev/eslint-plugin': '@misskey-dev/eslint-plugin':
specifier: 1.0.0 specifier: 1.0.0
@ -1250,9 +1256,18 @@ importers:
'@typescript-eslint/parser': '@typescript-eslint/parser':
specifier: 7.1.0 specifier: 7.1.0
version: 7.1.0(eslint@8.57.0)(typescript@5.3.3) version: 7.1.0(eslint@8.57.0)(typescript@5.3.3)
esbuild:
specifier: 0.19.11
version: 0.19.11
eslint: eslint:
specifier: 8.57.0 specifier: 8.57.0
version: 8.57.0 version: 8.57.0
execa:
specifier: 8.0.1
version: 8.0.1
glob:
specifier: 10.3.10
version: 10.3.10
nodemon: nodemon:
specifier: 3.0.2 specifier: 3.0.2
version: 3.0.2 version: 3.0.2
@ -7040,32 +7055,12 @@ packages:
ts-dedent: 2.2.0 ts-dedent: 2.2.0
type-fest: 2.19.0 type-fest: 2.19.0
vue: 3.4.21(typescript@5.3.3) vue: 3.4.21(typescript@5.3.3)
vue-component-type-helpers: 2.0.6 vue-component-type-helpers: 2.0.7
transitivePeerDependencies: transitivePeerDependencies:
- encoding - encoding
- supports-color - supports-color
dev: true dev: true
/@swc/cli@0.1.63(@swc/core@1.3.105):
resolution: {integrity: sha512-EM9oxxHzmmsprYRbGqsS2M4M/Gr5Gkcl0ROYYIdlUyTkhOiX822EQiRCpPCwdutdnzH2GyaTN7wc6i0Y+CKd3A==}
engines: {node: '>= 12.13'}
hasBin: true
peerDependencies:
'@swc/core': ^1.2.66
chokidar: 3.5.3
peerDependenciesMeta:
chokidar:
optional: true
dependencies:
'@mole-inc/bin-wrapper': 8.0.1
'@swc/core': 1.3.105
commander: 7.2.0
fast-glob: 3.3.2
semver: 7.5.4
slash: 3.0.0
source-map: 0.7.4
dev: false
/@swc/cli@0.1.63(@swc/core@1.3.107)(chokidar@3.5.3): /@swc/cli@0.1.63(@swc/core@1.3.107)(chokidar@3.5.3):
resolution: {integrity: sha512-EM9oxxHzmmsprYRbGqsS2M4M/Gr5Gkcl0ROYYIdlUyTkhOiX822EQiRCpPCwdutdnzH2GyaTN7wc6i0Y+CKd3A==} resolution: {integrity: sha512-EM9oxxHzmmsprYRbGqsS2M4M/Gr5Gkcl0ROYYIdlUyTkhOiX822EQiRCpPCwdutdnzH2GyaTN7wc6i0Y+CKd3A==}
engines: {node: '>= 12.13'} engines: {node: '>= 12.13'}
@ -7104,6 +7099,7 @@ packages:
cpu: [arm64] cpu: [arm64]
os: [darwin] os: [darwin]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@swc/core-darwin-arm64@1.3.107: /@swc/core-darwin-arm64@1.3.107:
@ -7129,6 +7125,7 @@ packages:
cpu: [x64] cpu: [x64]
os: [darwin] os: [darwin]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@swc/core-darwin-x64@1.3.107: /@swc/core-darwin-x64@1.3.107:
@ -7165,6 +7162,7 @@ packages:
cpu: [arm] cpu: [arm]
os: [linux] os: [linux]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@swc/core-linux-arm-gnueabihf@1.3.107: /@swc/core-linux-arm-gnueabihf@1.3.107:
@ -7190,6 +7188,7 @@ packages:
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@swc/core-linux-arm64-gnu@1.3.107: /@swc/core-linux-arm64-gnu@1.3.107:
@ -7215,6 +7214,7 @@ packages:
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@swc/core-linux-arm64-musl@1.3.107: /@swc/core-linux-arm64-musl@1.3.107:
@ -7240,6 +7240,7 @@ packages:
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@swc/core-linux-x64-gnu@1.3.107: /@swc/core-linux-x64-gnu@1.3.107:
@ -7265,6 +7266,7 @@ packages:
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@swc/core-linux-x64-musl@1.3.107: /@swc/core-linux-x64-musl@1.3.107:
@ -7290,6 +7292,7 @@ packages:
cpu: [arm64] cpu: [arm64]
os: [win32] os: [win32]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@swc/core-win32-arm64-msvc@1.3.107: /@swc/core-win32-arm64-msvc@1.3.107:
@ -7315,6 +7318,7 @@ packages:
cpu: [ia32] cpu: [ia32]
os: [win32] os: [win32]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@swc/core-win32-ia32-msvc@1.3.107: /@swc/core-win32-ia32-msvc@1.3.107:
@ -7340,6 +7344,7 @@ packages:
cpu: [x64] cpu: [x64]
os: [win32] os: [win32]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@swc/core-win32-x64-msvc@1.3.107: /@swc/core-win32-x64-msvc@1.3.107:
@ -7382,6 +7387,7 @@ packages:
'@swc/core-win32-arm64-msvc': 1.3.105 '@swc/core-win32-arm64-msvc': 1.3.105
'@swc/core-win32-ia32-msvc': 1.3.105 '@swc/core-win32-ia32-msvc': 1.3.105
'@swc/core-win32-x64-msvc': 1.3.105 '@swc/core-win32-x64-msvc': 1.3.105
dev: true
/@swc/core@1.3.107: /@swc/core@1.3.107:
resolution: {integrity: sha512-zKhqDyFcTsyLIYK1iEmavljZnf4CCor5pF52UzLAz4B6Nu/4GLU+2LQVAf+oRHjusG39PTPjd2AlRT3f3QWfsQ==} resolution: {integrity: sha512-zKhqDyFcTsyLIYK1iEmavljZnf4CCor5pF52UzLAz4B6Nu/4GLU+2LQVAf+oRHjusG39PTPjd2AlRT3f3QWfsQ==}
@ -20600,8 +20606,8 @@ packages:
resolution: {integrity: sha512-6bnLkn8O0JJyiFSIF0EfCogzeqNXpnjJ0vW/SZzNHfe6sPx30lTtTXlE5TFs2qhJlAtDFybStVNpL73cPe3OMQ==} resolution: {integrity: sha512-6bnLkn8O0JJyiFSIF0EfCogzeqNXpnjJ0vW/SZzNHfe6sPx30lTtTXlE5TFs2qhJlAtDFybStVNpL73cPe3OMQ==}
dev: true dev: true
/vue-component-type-helpers@2.0.6: /vue-component-type-helpers@2.0.7:
resolution: {integrity: sha512-qdGXCtoBrwqk1BT6r2+1Wcvl583ZVkuSZ3or7Y1O2w5AvWtlvvxwjGhmz5DdPJS9xqRdDlgTJ/38ehWnEi0tFA==} resolution: {integrity: sha512-7e12Evdll7JcTIocojgnCgwocX4WzIYStGClBQ+QuWPinZo/vQolv2EMq4a3lg16TKfwWafLimG77bxb56UauA==}
dev: true dev: true
/vue-demi@0.14.7(vue@3.4.21): /vue-demi@0.14.7(vue@3.4.21):

View File

@ -16,35 +16,36 @@ await execa('pnpm', ['clean'], {
stderr: process.stderr, stderr: process.stderr,
}); });
await execa('pnpm', ['build-pre'], { await Promise.all([
cwd: _dirname + '/../', execa('pnpm', ['build-pre'], {
stdout: process.stdout, cwd: _dirname + '/../',
stderr: process.stderr, stdout: process.stdout,
}); stderr: process.stderr,
}),
execa('pnpm', ['build-assets'], {
cwd: _dirname + '/../',
stdout: process.stdout,
stderr: process.stderr,
}),
execa('pnpm', ['--filter', 'cherrypick-js', 'build'], {
cwd: _dirname + '/../',
stdout: process.stdout,
stderr: process.stderr,
}),
]);
await execa('pnpm', ['build-assets'], { await Promise.all([
cwd: _dirname + '/../', execa('pnpm', ['--filter', 'misskey-reversi', 'build'], {
stdout: process.stdout, cwd: _dirname + '/../',
stderr: process.stderr, stdout: process.stdout,
}); stderr: process.stderr,
}),
await execa('pnpm', ['--filter', 'cherrypick-js', 'ts'], { execa('pnpm', ['--filter', 'misskey-bubble-game', 'build'], {
cwd: _dirname + '/../', cwd: _dirname + '/../',
stdout: process.stdout, stdout: process.stdout,
stderr: process.stderr, stderr: process.stderr,
}); }),
]);
await execa('pnpm', ['--filter', 'misskey-reversi', 'build:tsc'], {
cwd: _dirname + '/../',
stdout: process.stdout,
stderr: process.stderr,
});
await execa('pnpm', ['--filter', 'misskey-bubble-game', 'build:tsc'], {
cwd: _dirname + '/../',
stdout: process.stdout,
stderr: process.stderr,
});
execa('pnpm', ['build-pre', '--watch'], { execa('pnpm', ['build-pre', '--watch'], {
cwd: _dirname + '/../', cwd: _dirname + '/../',