Merge remote-tracking branch 'misskey-original/develop' into develop

This commit is contained in:
mattyatea 2024-03-18 15:10:24 +09:00
commit d2a02da432
58 changed files with 415 additions and 51 deletions

View File

@ -0,0 +1,75 @@
name: Check SPDX-License-Identifier
on:
push:
branches:
- master
- develop
pull_request:
jobs:
check-spdx-license-id:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Check
run: |
counter=0
search() {
local directory="$1"
find "$directory" -type f \
'(' \
-name "*.cjs" -and -not -name '*.config.cjs' -o \
-name "*.html" -o \
-name "*.js" -and -not -name '*.config.js' -o \
-name "*.mjs" -and -not -name '*.config.mjs' -o \
-name "*.scss" -o \
-name "*.ts" -and -not -name '*.config.ts' -o \
-name "*.vue" \
')' -and \
-not -name '*eslint*'
}
check() {
local file="$1"
if ! (
grep -q "SPDX-FileCopyrightText: syuilo and misskey-project" "$file" ||
grep -q "SPDX-License-Identifier: AGPL-3.0-only" "$file"
); then
echo "Missing: $file"
((counter++))
fi
}
directories=(
"cypress/e2e"
"packages/backend/migration"
"packages/backend/src"
"packages/backend/test"
"packages/frontend/.storybook"
"packages/frontend/@types"
"packages/frontend/lib"
"packages/frontend/public"
"packages/frontend/src"
"packages/frontend/test"
"packages/misskey-bubble-game/src"
"packages/misskey-reversi/src"
"packages/sw/src"
"scripts"
)
for directory in "${directories[@]}"; do
for file in $(search $directory); do
check "$file"
done
done
if [ $counter -gt 0 ]; then
echo "SPDX-License-Identifier is missing in $counter files."
exit 1
else
echo "SPDX-License-Identifier is certainly described in all target files!"
exit 0
fi

View File

@ -4,7 +4,6 @@
"dbaeumer.vscode-eslint", "dbaeumer.vscode-eslint",
"Vue.volar", "Vue.volar",
"Orta.vscode-jest", "Orta.vscode-jest",
"dbaeumer.vscode-eslint",
"mrmlnc.vscode-json5" "mrmlnc.vscode-json5"
] ]
} }

View File

@ -7,7 +7,7 @@
"*.test.ts": "typescript" "*.test.ts": "typescript"
}, },
"jest.jestCommandLine": "pnpm run jest", "jest.jestCommandLine": "pnpm run jest",
"jest.autoRun": "off", "jest.runMode": "on-demand",
"editor.codeActionsOnSave": { "editor.codeActionsOnSave": {
"source.fixAll": "explicit" "source.fixAll": "explicit"
}, },

View File

@ -1,19 +1,25 @@
## Unreleased ## Unreleased
### General ### General
- - Fix: Play作成時に設定した公開範囲が機能していない問題を修正
### Client ### Client
- Enhance: 自分のノートの添付ファイルから直接ファイルの詳細ページに飛べるように - Enhance: 自分のノートの添付ファイルから直接ファイルの詳細ページに飛べるように
- Enhance: 広告がMisskeyと同一ドメインの場合はRouterで遷移するように - Enhance: 広告がMisskeyと同一ドメインの場合はRouterで遷移するように
- Enhance: リアクション・いいねの総数を表示するように - Enhance: リアクション・いいねの総数を表示するように
- Enhance: リアクション受け入れが「いいねのみ」の場合はリアクション絵文字一覧を表示しないように - Enhance: リアクション受け入れが「いいねのみ」の場合はリアクション絵文字一覧を表示しないように
- Enhance: 設定>プラグインのページからプラグインの簡易的なログやエラーを見られるように
- 実装の都合により、プラグインは1つエラーを起こした時に即時停止するようになりました
- Fix: 一部のページ内リンクが正しく動作しない問題を修正 - Fix: 一部のページ内リンクが正しく動作しない問題を修正
- Fix: 周年の実績が閏年を考慮しない問題を修正 - Fix: 周年の実績が閏年を考慮しない問題を修正
- Fix: ローカルURLのプレビューポップアップが左上に表示される - Fix: ローカルURLのプレビューポップアップが左上に表示される
- Fix: WebGL2をサポートしないブラウザで「季節に応じた画面の演出」が有効になっているとき、Misskeyが起動できなくなる問題を修正
(Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/459)
### Server ### Server
- Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに - Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに
- Fix: フォローリクエストを作成する際に既存のものは削除するように
(Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/440)
## 2024.3.1 ## 2024.3.1

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
describe('Before setup instance', () => { describe('Before setup instance', () => {
beforeEach(() => { beforeEach(() => {
cy.resetState(); cy.resetState();

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
describe('Router transition', () => { describe('Router transition', () => {
describe('Redirect', () => { describe('Redirect', () => {
// サーバの初期化。ルートのテストに関しては各describeごとに1度だけ実行で十分だと思う使いまわした方が早い // サーバの初期化。ルートのテストに関しては各describeごとに1度だけ実行で十分だと思う使いまわした方が早い

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
/* flaky /* flaky
describe('After user signed in', () => { describe('After user signed in', () => {
beforeEach(() => { beforeEach(() => {

8
locales/index.d.ts vendored
View File

@ -7057,6 +7057,10 @@ export interface Locale extends ILocale {
* *
*/ */
"viewSource": string; "viewSource": string;
/**
*
*/
"viewLog": string;
}; };
"_preferencesBackups": { "_preferencesBackups": {
/** /**
@ -8945,6 +8949,10 @@ export interface Locale extends ILocale {
* *
*/ */
"summary": string; "summary": string;
/**
* URLを知っている人は引き続きアクセスできます
*/
"visibilityDescription": string;
}; };
"_pages": { "_pages": {
/** /**

View File

@ -1835,6 +1835,7 @@ _plugin:
installWarn: "信頼できないプラグインはインストールしないでください。" installWarn: "信頼できないプラグインはインストールしないでください。"
manage: "プラグインの管理" manage: "プラグインの管理"
viewSource: "ソースを表示" viewSource: "ソースを表示"
viewLog: "ログを表示"
_preferencesBackups: _preferencesBackups:
list: "作成したバックアップ" list: "作成したバックアップ"
@ -2359,6 +2360,7 @@ _play:
title: "タイトル" title: "タイトル"
script: "スクリプト" script: "スクリプト"
summary: "説明" summary: "説明"
visibilityDescription: "非公開に設定するとプロフィールに表示されなくなりますが、URLを知っている人は引き続きアクセスできます。"
_pages: _pages:
newPage: "ページの作成" newPage: "ページの作成"

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { loadConfig } from './built/config.js' import { loadConfig } from './built/config.js'
import { genOpenapiSpec } from './built/server/api/openapi/gen-spec.js' import { genOpenapiSpec } from './built/server/api/openapi/gen-spec.js'
import { writeFileSync } from "node:fs"; import { writeFileSync } from "node:fs";

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export class UserBlacklistAnntena1689325027964 { export class UserBlacklistAnntena1689325027964 {
name = 'UserBlacklistAnntena1689325027964' name = 'UserBlacklistAnntena1689325027964'

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export class FixRenoteMuting1690417561185 { export class FixRenoteMuting1690417561185 {
name = 'FixRenoteMuting1690417561185' name = 'FixRenoteMuting1690417561185'

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export class ChangeCacheRemoteFilesDefault1690417561186 { export class ChangeCacheRemoteFilesDefault1690417561186 {
name = 'ChangeCacheRemoteFilesDefault1690417561186' name = 'ChangeCacheRemoteFilesDefault1690417561186'

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export class Fix1690417561187 { export class Fix1690417561187 {
name = 'Fix1690417561187' name = 'Fix1690417561187'

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export class User2faBackupCodes1690569881926 { export class User2faBackupCodes1690569881926 {
name = 'User2faBackupCodes1690569881926' name = 'User2faBackupCodes1690569881926'

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export class RefineAnnouncement1691649257651 { export class RefineAnnouncement1691649257651 {
name = 'RefineAnnouncement1691649257651' name = 'RefineAnnouncement1691649257651'

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export class RefineAnnouncement21691657412740 { export class RefineAnnouncement21691657412740 {
name = 'RefineAnnouncement21691657412740' name = 'RefineAnnouncement21691657412740'

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export class VerifiedLinks1695260774117 { export class VerifiedLinks1695260774117 {
name = 'VerifiedLinks1695260774117' name = 'VerifiedLinks1695260774117'

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export class FollowingNotify1695288787870 { export class FollowingNotify1695288787870 {
name = 'FollowingNotify1695288787870' name = 'FollowingNotify1695288787870'

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export class ShortName1695440131671 { export class ShortName1695440131671 {
name = 'ShortName1695440131671' name = 'ShortName1695440131671'

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export class MutingNotificationTypes1695605508898 { export class MutingNotificationTypes1695605508898 {
name = 'MutingNotificationTypes1695605508898' name = 'MutingNotificationTypes1695605508898'

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export class NoteUpdatedAt1695901659683 { export class NoteUpdatedAt1695901659683 {
name = 'NoteUpdatedAt1695901659683' name = 'NoteUpdatedAt1695901659683'

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export class UserListMembership1696323464251 { export class UserListMembership1696323464251 {
name = 'UserListMembership1696323464251' name = 'UserListMembership1696323464251'

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export class Hibernation1696331570827 { export class Hibernation1696331570827 {
name = 'Hibernation1696331570827' name = 'Hibernation1696331570827'

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export class Clean1696332072038 { export class Clean1696332072038 {
name = 'Clean1696332072038' name = 'Clean1696332072038'

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export class HardMute1700383825690 { export class HardMute1700383825690 {
name = 'HardMute1700383825690' name = 'HardMute1700383825690'

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { Inject, Injectable, OnModuleInit } from '@nestjs/common'; import { Inject, Injectable, OnModuleInit } from '@nestjs/common';
import Redis from 'ioredis'; import Redis from 'ioredis';
import { DI } from '@/di-symbols.js'; import { DI } from '@/di-symbols.js';

View File

@ -511,6 +511,12 @@ export class UserFollowingService implements OnModuleInit {
if (blocking) throw new Error('blocking'); if (blocking) throw new Error('blocking');
if (blocked) throw new Error('blocked'); if (blocked) throw new Error('blocked');
// Remove old follow requests before creating a new one.
await this.followRequestsRepository.delete({
followeeId: followee.id,
followerId: follower.id,
});
const followRequest = await this.followRequestsRepository.insert({ const followRequest = await this.followRequestsRepository.insert({
id: this.idService.gen(), id: this.idService.gen(),
followerId: follower.id, followerId: follower.id,

View File

@ -459,13 +459,15 @@ export default abstract class Chart<T extends Schema> {
} }
} }
// bake unique count // bake cardinality
for (const [k, v] of Object.entries(finalDiffs)) { for (const [k, v] of Object.entries(finalDiffs)) {
if (this.schema[k].uniqueIncrement) { if (this.schema[k].uniqueIncrement) {
const name = COLUMN_PREFIX + k.replaceAll('.', COLUMN_DELIMITER) as keyof Columns<T>; const name = COLUMN_PREFIX + k.replaceAll('.', COLUMN_DELIMITER) as keyof Columns<T>;
const tempColumnName = UNIQUE_TEMP_COLUMN_PREFIX + k.replaceAll('.', COLUMN_DELIMITER) as keyof TempColumnsForUnique<T>; const tempColumnName = UNIQUE_TEMP_COLUMN_PREFIX + k.replaceAll('.', COLUMN_DELIMITER) as keyof TempColumnsForUnique<T>;
queryForHour[name] = new Set([...(v as string[]), ...(logHour[tempColumnName] as unknown as string[])]).size; const cardinalityOfHour = new Set([...(v as string[]), ...(logHour[tempColumnName] as unknown as string[])]).size;
queryForDay[name] = new Set([...(v as string[]), ...(logDay[tempColumnName] as unknown as string[])]).size; const cardinalityOfDay = new Set([...(v as string[]), ...(logDay[tempColumnName] as unknown as string[])]).size;
queryForHour[name] = cardinalityOfHour;
queryForDay[name] = cardinalityOfDay;
} }
} }
@ -637,7 +639,7 @@ export default abstract class Chart<T extends Schema> {
// 要求された範囲にログがひとつもなかったら // 要求された範囲にログがひとつもなかったら
if (logs.length === 0) { if (logs.length === 0) {
// もっとも新しいログを持ってくる // もっとも新しいログを持ってくる
// (すくなくともひとつログが無いと隙間埋めできないため) // (すくなくともひとつログが無いと補間できないため)
const recentLog = await repository.findOne({ const recentLog = await repository.findOne({
where: group ? { where: group ? {
group: group, group: group,
@ -654,7 +656,7 @@ export default abstract class Chart<T extends Schema> {
// 要求された範囲の最も古い箇所に位置するログが存在しなかったら // 要求された範囲の最も古い箇所に位置するログが存在しなかったら
} else if (!isTimeSame(new Date(logs.at(-1)!.date * 1000), gt)) { } else if (!isTimeSame(new Date(logs.at(-1)!.date * 1000), gt)) {
// 要求された範囲の最も古い箇所時点での最も新しいログを持ってきて末尾に追加する // 要求された範囲の最も古い箇所時点での最も新しいログを持ってきて末尾に追加する
// (隙間埋めできないため) // (補間できないため)
const outdatedLog = await repository.findOne({ const outdatedLog = await repository.findOne({
where: { where: {
date: LessThan(Chart.dateToTimestamp(gt)), date: LessThan(Chart.dateToTimestamp(gt)),
@ -683,7 +685,7 @@ export default abstract class Chart<T extends Schema> {
if (log) { if (log) {
chart.unshift(this.convertRawRecord(log)); chart.unshift(this.convertRawRecord(log));
} else { } else {
// 隙間埋め // 補間
const latest = logs.find(l => isTimeBefore(new Date(l.date * 1000), current)); const latest = logs.find(l => isTimeBefore(new Date(l.date * 1000), current));
const data = latest ? this.convertRawRecord(latest) : null; const data = latest ? this.convertRawRecord(latest) : null;
chart.unshift(this.getNewLog(data)); chart.unshift(this.getNewLog(data));

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { onRequestHookHandler } from 'fastify'; import type { onRequestHookHandler } from 'fastify';
export const handleRequestRedirectToOmitSearch: onRequestHookHandler = (request, reply, done) => { export const handleRequestRedirectToOmitSearch: onRequestHookHandler = (request, reply, done) => {

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { MiNote } from '@/models/Note.js'; import type { MiNote } from '@/models/Note.js';
export function isPureRenote(note: MiNote): note is MiNote & { renoteId: NonNullable<MiNote['renoteId']> } { export function isPureRenote(note: MiNote): note is MiNote & { renoteId: NonNullable<MiNote['renoteId']> } {

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export type FetchFunction<K, V> = (key: K) => Promise<V>; export type FetchFunction<K, V> = (key: K) => Promise<V>;
type ResolveReject<V> = Parameters<ConstructorParameters<typeof Promise<V>>[0]>; type ResolveReject<V> = Parameters<ConstructorParameters<typeof Promise<V>>[0]>;

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { id } from './util/id.js'; import { id } from './util/id.js';
import { MiUser } from './User.js'; import { MiUser } from './User.js';

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export const packedSigninSchema = { export const packedSigninSchema = {
type: 'object', type: 'object',
properties: { properties: {

View File

@ -44,6 +44,7 @@ export const paramDef = {
permissions: { type: 'array', items: { permissions: { type: 'array', items: {
type: 'string', type: 'string',
} }, } },
visibility: { type: 'string', enum: ['public', 'private'], default: 'public' },
}, },
required: ['title', 'summary', 'script', 'permissions'], required: ['title', 'summary', 'script', 'permissions'],
} as const; } as const;
@ -66,6 +67,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
summary: ps.summary, summary: ps.summary,
script: ps.script, script: ps.script,
permissions: ps.permissions, permissions: ps.permissions,
visibility: ps.visibility,
}).then(x => this.flashsRepository.findOneByOrFail(x.identifiers[0])); }).then(x => this.flashsRepository.findOneByOrFail(x.identifiers[0]));
return await this.flashEntityService.pack(flash); return await this.flashEntityService.pack(flash);

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { initTestDb, sendEnvResetRequest } from './utils.js'; import { initTestDb, sendEnvResetRequest } from './utils.js';
beforeAll(async () => { beforeAll(async () => {

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as assert from 'assert'; import * as assert from 'assert';
import { Test } from '@nestjs/testing'; import { Test } from '@nestjs/testing';

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { DebounceLoader } from '@/misc/loader.js'; import { DebounceLoader } from '@/misc/loader.js';
class Mock { class Mock {

View File

@ -1,3 +1,8 @@
<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->
<link rel="preload" href="https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/about-icon.png?raw=true" as="image" type="image/png" crossorigin="anonymous"> <link rel="preload" href="https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/about-icon.png?raw=true" as="image" type="image/png" crossorigin="anonymous">
<link rel="preload" href="https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/fedi.jpg?raw=true" as="image" type="image/jpeg" crossorigin="anonymous"> <link rel="preload" href="https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/fedi.jpg?raw=true" as="image" type="image/jpeg" crossorigin="anonymous">
<link rel="stylesheet" href="https://unpkg.com/@tabler/icons-webfont@2.44.0/tabler-icons.min.css"> <link rel="stylesheet" href="https://unpkg.com/@tabler/icons-webfont@2.44.0/tabler-icons.min.css">

View File

@ -75,7 +75,7 @@ export async function mainBoot() {
mainRouter.push('/search'); mainRouter.push('/search');
}, },
}; };
try {
if (defaultStore.state.enableSeasonalScreenEffect) { if (defaultStore.state.enableSeasonalScreenEffect) {
const month = new Date().getMonth() + 1; const month = new Date().getMonth() + 1;
if (defaultStore.state.hemisphere === 'S') { if (defaultStore.state.hemisphere === 'S') {
@ -97,6 +97,10 @@ export async function mainBoot() {
} }
} }
} }
} catch (error) {
// console.error(error);
console.error('Failed to initialise the seasonal screen effect canvas context:', error);
}
if ($i) { if ($i) {
// only add post shortcuts if logged in // only add post shortcuts if logged in

View File

@ -1,3 +1,8 @@
<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->
<template> <template>
<render/> <render/>
</template> </template>

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export default (v, fractionDigits = 0) => { export default (v, fractionDigits = 0) => {
if (v == null) return 'N/A'; if (v == null) return 'N/A';
if (v === 0) return '0'; if (v === 0) return '0';

View File

@ -18,16 +18,17 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkCodeEditor v-model="script" lang="is"> <MkCodeEditor v-model="script" lang="is">
<template #label>{{ i18n.ts._play.script }}</template> <template #label>{{ i18n.ts._play.script }}</template>
</MkCodeEditor> </MkCodeEditor>
<MkSelect v-model="visibility">
<template #label>{{ i18n.ts.visibility }}</template>
<template #caption>{{ i18n.ts._play.visibilityDescription }}</template>
<option :key="'public'" :value="'public'">{{ i18n.ts.public }}</option>
<option :key="'private'" :value="'private'">{{ i18n.ts.private }}</option>
</MkSelect>
<div class="_buttons"> <div class="_buttons">
<MkButton primary @click="save"><i class="ti ti-check"></i> {{ i18n.ts.save }}</MkButton> <MkButton primary @click="save"><i class="ti ti-check"></i> {{ i18n.ts.save }}</MkButton>
<MkButton @click="show"><i class="ti ti-eye"></i> {{ i18n.ts.show }}</MkButton> <MkButton @click="show"><i class="ti ti-eye"></i> {{ i18n.ts.show }}</MkButton>
<MkButton v-if="flash" danger @click="del"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton> <MkButton v-if="flash" danger @click="del"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
</div> </div>
<MkSelect v-model="visibility">
<template #label>{{ i18n.ts.visibility }}</template>
<option :key="'public'" :value="'public'">{{ i18n.ts.public }}</option>
<option :key="'private'" :value="'private'">{{ i18n.ts.private }}</option>
</MkSelect>
</div> </div>
</MkSpacer> </MkSpacer>
</MkStickyContainer> </MkStickyContainer>
@ -367,7 +368,7 @@ const props = defineProps<{
}>(); }>();
const flash = ref<Misskey.entities.Flash | null>(null); const flash = ref<Misskey.entities.Flash | null>(null);
const visibility = ref<Misskey.entities.FlashUpdateRequest['visibility']>('public'); const visibility = ref<'private' | 'public'>('public');
if (props.id) { if (props.id) {
flash.value = await misskeyApi('flash/show', { flash.value = await misskeyApi('flash/show', {
@ -420,6 +421,7 @@ async function save() {
summary: summary.value, summary: summary.value,
permissions: permissions.value, permissions: permissions.value,
script: script.value, script: script.value,
visibility: visibility.value,
}); });
router.push('/play/' + created.id + '/edit'); router.push('/play/' + created.id + '/edit');
} }

View File

@ -41,13 +41,26 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkButton inline danger @click="uninstall(plugin)"><i class="ti ti-trash"></i> {{ i18n.ts.uninstall }}</MkButton> <MkButton inline danger @click="uninstall(plugin)"><i class="ti ti-trash"></i> {{ i18n.ts.uninstall }}</MkButton>
</div> </div>
<MkFolder>
<template #icon><i class="ti ti-terminal-2"></i></template>
<template #label>{{ i18n.ts._plugin.viewLog }}</template>
<div class="_gaps_s">
<div class="_buttons">
<MkButton inline @click="copy(pluginLogs.get(plugin.id)?.join('\n'))"><i class="ti ti-copy"></i> {{ i18n.ts.copy }}</MkButton>
</div>
<MkCode :code="pluginLogs.get(plugin.id)?.join('\n') ?? ''"/>
</div>
</MkFolder>
<MkFolder> <MkFolder>
<template #icon><i class="ti ti-code"></i></template> <template #icon><i class="ti ti-code"></i></template>
<template #label>{{ i18n.ts._plugin.viewSource }}</template> <template #label>{{ i18n.ts._plugin.viewSource }}</template>
<div class="_gaps_s"> <div class="_gaps_s">
<div class="_buttons"> <div class="_buttons">
<MkButton inline @click="copy(plugin)"><i class="ti ti-copy"></i> {{ i18n.ts.copy }}</MkButton> <MkButton inline @click="copy(plugin.src)"><i class="ti ti-copy"></i> {{ i18n.ts.copy }}</MkButton>
</div> </div>
<MkCode :code="plugin.src ?? ''" lang="is"/> <MkCode :code="plugin.src ?? ''" lang="is"/>
@ -74,6 +87,7 @@ import { ColdDeviceStorage } from '@/store.js';
import { unisonReload } from '@/scripts/unison-reload.js'; import { unisonReload } from '@/scripts/unison-reload.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js'; import { definePageMetadata } from '@/scripts/page-metadata.js';
import { pluginLogs } from '@/plugin.js';
const plugins = ref(ColdDeviceStorage.get('plugins')); const plugins = ref(ColdDeviceStorage.get('plugins'));
@ -87,8 +101,8 @@ async function uninstall(plugin) {
}); });
} }
function copy(plugin) { function copy(text) {
copyToClipboard(plugin.src ?? ''); copyToClipboard(text ?? '');
os.success(); os.success();
} }

View File

@ -3,6 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
import { ref } from 'vue';
import { Interpreter, Parser, utils, values } from '@syuilo/aiscript'; import { Interpreter, Parser, utils, values } from '@syuilo/aiscript';
import { aiScriptReadline, createAiScriptEnv } from '@/scripts/aiscript/api.js'; import { aiScriptReadline, createAiScriptEnv } from '@/scripts/aiscript/api.js';
import { inputText } from '@/os.js'; import { inputText } from '@/os.js';
@ -10,6 +11,7 @@ import { Plugin, noteActions, notePostInterruptors, noteViewInterruptors, postFo
const parser = new Parser(); const parser = new Parser();
const pluginContexts = new Map<string, Interpreter>(); const pluginContexts = new Map<string, Interpreter>();
export const pluginLogs = ref(new Map<string, string[]>());
export async function install(plugin: Plugin): Promise<void> { export async function install(plugin: Plugin): Promise<void> {
// 後方互換性のため // 後方互換性のため
@ -22,21 +24,27 @@ export async function install(plugin: Plugin): Promise<void> {
in: aiScriptReadline, in: aiScriptReadline,
out: (value): void => { out: (value): void => {
console.log(value); console.log(value);
pluginLogs.value.get(plugin.id).push(utils.reprValue(value));
}, },
log: (): void => { log: (): void => {
}, },
err: (err): void => {
pluginLogs.value.get(plugin.id).push(`${err}`);
throw err; // install時のtry-catchに反応させる
},
}); });
initPlugin({ plugin, aiscript }); initPlugin({ plugin, aiscript });
try { aiscript.exec(parser.parse(plugin.src)).then(
await aiscript.exec(parser.parse(plugin.src)); () => {
} catch (err) {
console.error('Plugin install failed:', plugin.name, 'v' + plugin.version);
return;
}
console.info('Plugin installed:', plugin.name, 'v' + plugin.version); console.info('Plugin installed:', plugin.name, 'v' + plugin.version);
},
(err) => {
console.error('Plugin install failed:', plugin.name, 'v' + plugin.version);
throw err;
},
);
} }
function createPluginEnv(opts: { plugin: Plugin; storageKey: string }): Record<string, values.Value> { function createPluginEnv(opts: { plugin: Plugin; storageKey: string }): Record<string, values.Value> {
@ -92,6 +100,7 @@ function createPluginEnv(opts: { plugin: Plugin; storageKey: string }): Record<s
function initPlugin({ plugin, aiscript }): void { function initPlugin({ plugin, aiscript }): void {
pluginContexts.set(plugin.id, aiscript); pluginContexts.set(plugin.id, aiscript);
pluginLogs.value.set(plugin.id, []);
} }
function registerPostFormAction({ pluginId, title, handler }): void { function registerPostFormAction({ pluginId, title, handler }): void {

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import { UnicodeEmojiDef } from './emojilist.js'; import { UnicodeEmojiDef } from './emojilist.js';

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { unisonReload } from '@/scripts/unison-reload.js'; import { unisonReload } from '@/scripts/unison-reload.js';
import * as os from '@/os.js'; import * as os from '@/os.js';
import { miLocalStorage } from '@/local-storage.js'; import { miLocalStorage } from '@/local-storage.js';

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { bundledThemesInfo } from 'shiki'; import { bundledThemesInfo } from 'shiki';
import { getHighlighterCore, loadWasm } from 'shiki/core'; import { getHighlighterCore, loadWasm } from 'shiki/core';
import darkPlus from 'shiki/themes/dark-plus.mjs'; import darkPlus from 'shiki/themes/dark-plus.mjs';

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export default async function hasAudio(media: HTMLMediaElement) { export default async function hasAudio(media: HTMLMediaElement) {
const cloned = media.cloneNode() as HTMLMediaElement; const cloned = media.cloneNode() as HTMLMediaElement;
cloned.muted = (cloned as typeof cloned & Partial<HTMLVideoElement>).playsInline = true; cloned.muted = (cloned as typeof cloned & Partial<HTMLVideoElement>).playsInline = true;

View File

@ -155,7 +155,9 @@ export class SnowfallEffect {
max: 0.125, max: 0.125,
easing: 0.0005, easing: 0.0005,
}; };
/**
* @throws {Error} - Thrown when it fails to get WebGL context for the canvas
*/
constructor(options: { constructor(options: {
sakura?: boolean; sakura?: boolean;
}) { }) {

View File

@ -8,7 +8,12 @@ import { markRaw } from 'vue';
import { $i } from '@/account.js'; import { $i } from '@/account.js';
import { wsOrigin } from '@/config.js'; import { wsOrigin } from '@/config.js';
// heart beat interval in ms
const HEART_BEAT_INTERVAL = 1000 * 60;
let stream: Misskey.Stream | null = null; let stream: Misskey.Stream | null = null;
let timeoutHeartBeat: ReturnType<typeof setTimeout> | null = null;
let lastHeartbeatCall = 0;
export function useStream(): Misskey.Stream { export function useStream(): Misskey.Stream {
if (stream) return stream; if (stream) return stream;
@ -17,7 +22,18 @@ export function useStream(): Misskey.Stream {
token: $i.token, token: $i.token,
} : null)); } : null));
window.setTimeout(heartbeat, 1000 * 60); if (timeoutHeartBeat) window.clearTimeout(timeoutHeartBeat);
timeoutHeartBeat = window.setTimeout(heartbeat, HEART_BEAT_INTERVAL);
// send heartbeat right now when last send time is over HEART_BEAT_INTERVAL
document.addEventListener('visibilitychange', () => {
if (
!stream
|| document.visibilityState !== 'visible'
|| Date.now() - lastHeartbeatCall < HEART_BEAT_INTERVAL
) return;
heartbeat();
});
return stream; return stream;
} }
@ -26,5 +42,7 @@ function heartbeat(): void {
if (stream != null && document.visibilityState === 'visible') { if (stream != null && document.visibilityState === 'visible') {
stream.heartbeat(); stream.heartbeat();
} }
window.setTimeout(heartbeat, 1000 * 60); lastHeartbeatCall = Date.now();
if (timeoutHeartBeat) window.clearTimeout(timeoutHeartBeat);
timeoutHeartBeat = window.setTimeout(heartbeat, HEART_BEAT_INTERVAL);
} }

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] }; export type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };
export type WithNonNullable<T, K extends keyof T> = T & { [P in K]-?: NonNullable<T[P]> }; export type WithNonNullable<T, K extends keyof T> = T & { [P in K]-?: NonNullable<T[P]> };

View File

@ -22688,6 +22688,11 @@ export type operations = {
summary: string; summary: string;
script: string; script: string;
permissions: string[]; permissions: string[];
/**
* @default public
* @enum {string}
*/
visibility?: 'public' | 'private';
}; };
}; };
}; };

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { Release } from './parser.js'; import { Release } from './parser.js';
export class Result { export class Result {

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as process from 'process'; import * as process from 'process';
import * as fs from 'fs'; import * as fs from 'fs';
import { parseChangeLog } from './parser.js'; import { parseChangeLog } from './parser.js';

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as fs from 'node:fs'; import * as fs from 'node:fs';
import { unified } from 'unified'; import { unified } from 'unified';
import remarkParse from 'remark-parse'; import remarkParse from 'remark-parse';

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import {expect, suite, test} from "vitest"; import {expect, suite, test} from "vitest";
import {Release, ReleaseCategory} from "../src/parser"; import {Release, ReleaseCategory} from "../src/parser";
import {checkNewRelease, checkNewTopic} from "../src/checker"; import {checkNewRelease, checkNewTopic} from "../src/checker";

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { createWriteStream } from 'node:fs'; import { createWriteStream } from 'node:fs';
import { mkdir } from 'node:fs/promises'; import { mkdir } from 'node:fs/promises';
import { resolve } from 'node:path'; import { resolve } from 'node:path';