Skip to content

Commit

Permalink
Merge remote-tracking branch 'cherry/develop' into develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	packages/backend/src/core/NoteCreateService.ts
#	packages/frontend/@types/global.d.ts
#	packages/frontend/src/components/MkNoteDetailed.vue
#	scripts/build-pre.js
  • Loading branch information
caipira113 committed Dec 15, 2023
2 parents 5153632 + 214047c commit 13b98eb
Show file tree
Hide file tree
Showing 46 changed files with 333 additions and 161 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
- Feat: モデレーターがユーザーのアイコンもしくはバナー画像を未設定状態にできる機能を追加 (cherry-pick from https://github.com/TeamNijimiss/misskey/commit/e0eb5a752f6e5616d6312bb7c9790302f9dbff83)
- Feat: TL上からノートが見えなくなるワードミュートであるハードミュートを追加
- Enhance: アイコンデコレーションを複数設定できるように
- Enhance: アイコンデコレーションの位置を微調整できるように
- Fix: MFM `$[unixtime ]` に不正な値を入力した際に発生する各種エラーを修正

### Client
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG_CHERRYPICK.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Misskey의 전체 변경 사항을 확인하려면, [CHANGELOG.md#2023xx](CHANGE
- 기존 데이터 절약 모드 설정이 재설정됩니다.
- Enhance: 컴포넌트만 새로 고쳐도 적용할 수 있는 설정은 페이지를 새로 고치지 않고 설정을 반영함
- 각 기능이 적용되는 컴포넌트(타임라인, 알림)에 따라 해당 컴포넌트만 새로 로드됩니다.
- Enhance: 페이지를 새로 불러오지 않고 알림 컴포넌트를 갱신할 수 있음
- Fix: '모달 배경색 제거' 옵션이 이모지 피커에 반영되지 않음
- Fix: 열람 주의로 설정된 노트의 리액션이 '더 보기'를 눌러야 표시됨
- Fix: 채널 이름이 긴 경우 게시 양식 표시가 깨지는 문제 (misskey-dev/misskey#12524)
Expand Down
2 changes: 0 additions & 2 deletions locales/en-US.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
_lang_: "English"
cannotBeUsedFunc: "This feature is currently unavailable."
Xcoordinate: "X-Coordinate"
Ycoordinate: "Y-Coordinate"
scale: "Scale"
opacity: "Opacity"
noteUpdatedAt: "Edited: {date} {time}"
Expand Down
2 changes: 0 additions & 2 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
export interface Locale {
"_lang_": string;
"cannotBeUsedFunc": string;
"Xcoordinate": string;
"Ycoordinate": string;
"scale": string;
"opacity": string;
"noteUpdatedAt": string;
Expand Down
2 changes: 0 additions & 2 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
_lang_: "日本語"

cannotBeUsedFunc: "この機能は現在使用できません。"
Xcoordinate: "X座標"
Ycoordinate: "Y座標"
scale: "大きさ"
opacity: "不透明度"
noteUpdatedAt: "編集済み: {date} {time}"
Expand Down
2 changes: 0 additions & 2 deletions locales/ko-KR.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
_lang_: "한국어"
cannotBeUsedFunc: "이 기능은 현재 사용할 수 없어요."
Xcoordinate: "X 좌표"
Ycoordinate: "Y 좌표"
scale: "크기"
opacity: "불투명도"
noteUpdatedAt: "편집됨: {date} {time}"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"check:connect": "cd packages/backend && pnpm check:connect",
"migrateandstart": "pnpm migrate && pnpm start",
"watch": "pnpm dev",
"dev": "pnpm -r dev",
"dev": "node scripts/dev.mjs",
"lint": "pnpm -r lint",
"cy:open": "pnpm cypress open --browser --e2e --config-file=cypress.config.ts",
"cy:run": "pnpm cypress run",
Expand Down
4 changes: 3 additions & 1 deletion packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"watch:swc": "swc src -d built -D -w",
"build:tsc": "tsc -p tsconfig.json && tsc-alias -p tsconfig.json",
"watch": "node watch.mjs",
"dev": "node ./built/boot/entry.js",
"restart": "pnpm build && pnpm start",
"dev": "nodemon -w src -e ts,js,mjs,cjs,json --exec \"cross-env NODE_ENV=development pnpm run restart\"",
"typecheck": "tsc --noEmit",
"eslint": "eslint --quiet \"src/**/*.ts\"",
"lint": "pnpm typecheck && pnpm eslint",
Expand Down Expand Up @@ -228,6 +229,7 @@
"execa": "8.0.1",
"jest": "29.7.0",
"jest-mock": "29.7.0",
"nodemon": "3.0.2",
"simple-oauth2": "5.0.0"
}
}
4 changes: 2 additions & 2 deletions packages/backend/src/core/AvatarDecorationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ export class AvatarDecorationService implements OnApplicationShutdown {
id: findDecoration?.id ?? '',
angle: avatarDecorations.angle ?? 0,
flipH: avatarDecorations.flipH ?? false,
offsetX: avatarDecorations.offsetX ?? 0,
offsetY: avatarDecorations.offsetY ?? 0,
scale: avatarDecorations.scale ?? 1,
moveX: avatarDecorations.moveX ?? 0,
moveY: avatarDecorations.moveY ?? 0,
opacity: avatarDecorations.opacity ?? 1,
}];
await this.usersRepository.update({ id: user.id }, updates);
Expand Down
4 changes: 2 additions & 2 deletions packages/backend/src/core/entities/UserEntityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,9 @@ export class UserEntityService implements OnModuleInit {
id: ud.id,
angle: ud.angle || undefined,
flipH: ud.flipH || undefined,
offsetX: ud.offsetX || undefined,
offsetY: ud.offsetY || undefined,
scale: ud.scale || undefined,
moveX: ud.moveX || undefined,
moveY: ud.moveY || undefined,
opacity: ud.opacity || undefined,
url: decorations.find(d => d.id === ud.id)!.url,
}))) : [],
Expand Down
12 changes: 6 additions & 6 deletions packages/backend/src/models/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ export class MiUser {
})
public avatarDecorations: {
id: string;
angle: number;
flipH: boolean;
scale: number;
moveX: number;
moveY: number;
opacity: number;
angle?: number;
flipH?: boolean;
offsetX?: number;
offsetY?: number;
scale?: number;
opacity?: number;
}[];

@Index()
Expand Down
4 changes: 4 additions & 0 deletions packages/backend/src/models/json-schema/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ export const packedNoteSchema = {
type: 'object',
optional: true, nullable: true,
},
event: {
type: 'object',
optional: true, nullable: true,
},
channelId: {
type: 'string',
optional: true, nullable: true,
Expand Down
6 changes: 3 additions & 3 deletions packages/backend/src/models/json-schema/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ export const packedUserLiteSchema = {
type: 'boolean',
nullable: false, optional: true,
},
scale: {
offsetX: {
type: 'number',
nullable: false, optional: true,
},
moveX: {
offsetY: {
type: 'number',
nullable: false, optional: true,
},
moveY: {
scale: {
type: 'number',
nullable: false, optional: true,
},
Expand Down
8 changes: 4 additions & 4 deletions packages/backend/src/server/api/endpoints/i/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ export const paramDef = {
id: { type: 'string', format: 'misskey:id' },
angle: { type: 'number', nullable: true, maximum: 0.5, minimum: -0.5 },
flipH: { type: 'boolean', nullable: true },
offsetX: { type: 'number', nullable: true, maximum: 0.25, minimum: -0.25 },
offsetY: { type: 'number', nullable: true, maximum: 0.25, minimum: -0.25 },
scale: { type: 'number', nullable: true, maximum: 1.5, minimum: 0.5 },
moveX: { type: 'number', nullable: true, maximum: 25, minimum: -25 },
moveY: { type: 'number', nullable: true, maximum: 25, minimum: -25 },
opacity: { type: 'number', nullable: true, maximum: 1, minimum: 0.1 },
},
required: ['id'],
Expand Down Expand Up @@ -345,9 +345,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
id: d.id,
angle: d.angle ?? 0,
flipH: d.flipH ?? false,
offsetX: d.offsetX ?? 0,
offsetY: d.offsetY ?? 0,
scale: d.scale ?? 1,
moveX: d.moveX ?? 0,
moveY: d.moveY ?? 0,
opacity: d.opacity ?? 1,
}));
}
Expand Down
5 changes: 5 additions & 0 deletions packages/backend/src/server/api/endpoints/notes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const paramDef = {
renote: { type: 'boolean' },
withFiles: { type: 'boolean' },
poll: { type: 'boolean' },
event: { type: 'boolean' },
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
sinceId: { type: 'string', format: 'misskey:id' },
untilId: { type: 'string', format: 'misskey:id' },
Expand Down Expand Up @@ -78,6 +79,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
query.andWhere(ps.poll ? 'note.hasPoll = TRUE' : 'note.hasPoll = FALSE');
}

if (ps.event !== undefined) {
query.andWhere(ps.event ? 'note.hasEvent = TRUE' : 'note.hasEvent = FALSE');
}

// TODO
//if (bot != undefined) {
// query.isBot = bot;
Expand Down
6 changes: 4 additions & 2 deletions packages/cherrypick-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"types": "./built/index.d.ts",
"scripts": {
"build": "tsc",
"watch": "nodemon -w src -e ts,js,cjs,mjs,json --exec \"pnpm run build\"",
"tsd": "tsd",
"api": "pnpm api-extractor run --local --verbose",
"api-prod": "pnpm api-extractor run --verbose",
Expand All @@ -32,9 +33,10 @@
"jest-fetch-mock": "3.0.3",
"jest-websocket-mock": "2.5.0",
"mock-socket": "9.3.1",
"ncp": "2.0.0",
"nodemon": "3.0.2",
"tsd": "0.29.0",
"typescript": "5.3.3",
"ncp": "2.0.0"
"typescript": "5.3.3"
},
"files": [
"built"
Expand Down
2 changes: 1 addition & 1 deletion packages/cherrypick-js/src/autogen/apiClientJSDoc.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* version: 4.6.0-beta.4
* basedMisskeyVersion: 2023.12.0-beta.4
* generatedAt: 2023-12-14T11:18:50.362Z
* generatedAt: 2023-12-14T17:47:05.660Z
*/

import type { SwitchCaseResponseType } from '../api.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/cherrypick-js/src/autogen/endpoint.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* version: 4.6.0-beta.4
* basedMisskeyVersion: 2023.12.0-beta.4
* generatedAt: 2023-12-14T11:18:50.360Z
* generatedAt: 2023-12-14T17:47:05.658Z
*/

import type {
Expand Down
2 changes: 1 addition & 1 deletion packages/cherrypick-js/src/autogen/entities.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* version: 4.6.0-beta.4
* basedMisskeyVersion: 2023.12.0-beta.4
* generatedAt: 2023-12-14T11:18:50.359Z
* generatedAt: 2023-12-14T17:47:05.657Z
*/

import { operations } from './types.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/cherrypick-js/src/autogen/models.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* version: 4.6.0-beta.4
* basedMisskeyVersion: 2023.12.0-beta.4
* generatedAt: 2023-12-14T11:18:50.358Z
* generatedAt: 2023-12-14T17:47:05.656Z
*/

import { components } from './types.js';
Expand Down
12 changes: 7 additions & 5 deletions packages/cherrypick-js/src/autogen/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/*
* version: 4.6.0-beta.4
* basedMisskeyVersion: 2023.12.0-beta.4
* generatedAt: 2023-12-14T11:18:50.281Z
* generatedAt: 2023-12-14T17:47:05.577Z
*/

/**
Expand Down Expand Up @@ -3757,9 +3757,9 @@ export type components = {
id: string;
angle?: number;
flipH?: boolean;
offsetX?: number;
offsetY?: number;
scale?: number;
moveX?: number;
moveY?: number;
opacity?: number;
/** Format: url */
url: string;
Expand Down Expand Up @@ -4096,6 +4096,7 @@ export type components = {
files?: components['schemas']['DriveFile'][];
tags?: string[];
poll?: Record<string, unknown> | null;
event?: Record<string, unknown> | null;
/**
* Format: id
* @example xxxxxxxxxx
Expand Down Expand Up @@ -18673,9 +18674,9 @@ export type operations = {
id: string;
angle?: number | null;
flipH?: boolean | null;
offsetX?: number | null;
offsetY?: number | null;
scale?: number | null;
moveX?: number | null;
moveY?: number | null;
opacity?: number | null;
})[];
/** Format: misskey:id */
Expand Down Expand Up @@ -20334,6 +20335,7 @@ export type operations = {
renote?: boolean;
withFiles?: boolean;
poll?: boolean;
event?: boolean;
/** @default 10 */
limit?: number;
/** Format: misskey:id */
Expand Down
3 changes: 3 additions & 0 deletions packages/frontend/@types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ declare const _DATA_TRANSFER_DRIVE_FILE_: string;
declare const _DATA_TRANSFER_DRIVE_FOLDER_: string;
declare const _DATA_TRANSFER_DECK_COLUMN_: string;
declare const _CLIENT_ASSETS_BASE_URL_: string;

// for dev-mode
declare const _LANGS_FULL_: string[][];
84 changes: 84 additions & 0 deletions packages/frontend/src/_dev_boot_.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,88 @@
// (pnpm start時はpugファイルの中で静的リソースとして読み込むようになっており、この問題は起こっていない)
import '@tabler/icons-webfont/tabler-icons.scss';

await main();

import('@/_boot_.js');

/**
* backend/src/server/web/boot.jsで差し込まれている起動処理のうち、最低限必要なものを模倣するための処理
*/
async function main() {
const forceError = localStorage.getItem('forceError');
if (forceError != null) {
renderError('FORCED_ERROR', 'This error is forced by having forceError in local storage.');
}

//#region Detect language & fetch translations

// dev-modeの場合は常に取り直す
const supportedLangs = _LANGS_.map(it => it[0]);
let lang: string | null | undefined = localStorage.getItem('lang');
if (lang == null || !supportedLangs.includes(lang)) {
if (supportedLangs.includes(navigator.language)) {
lang = navigator.language;
} else {
lang = supportedLangs.find(x => x.split('-')[0] === navigator.language);

// Fallback
if (lang == null) lang = 'en-US';
}
}

// TODO:今のままだと言語ファイル変更後はpnpm devをリスタートする必要があるので、chokidarを使ったり等で対応できるようにする
const locale = _LANGS_FULL_.find(it => it[0] === lang);
localStorage.setItem('lang', lang);
localStorage.setItem('locale', JSON.stringify(locale[1]));
localStorage.setItem('localeVersion', _VERSION_);
//#endregion

//#region Theme
const theme = localStorage.getItem('theme');
if (theme) {
for (const [k, v] of Object.entries(JSON.parse(theme))) {
document.documentElement.style.setProperty(`--${k}`, v.toString());

// HTMLの theme-color 適用
if (k === 'htmlThemeColor') {
for (const tag of document.head.children) {
if (tag.tagName === 'META' && tag.getAttribute('name') === 'theme-color') {
tag.setAttribute('content', v);
break;
}
}
}
}
}
const colorScheme = localStorage.getItem('colorScheme');
if (colorScheme) {
document.documentElement.style.setProperty('color-scheme', colorScheme);
}
//#endregion

const fontSize = localStorage.getItem('fontSize');
if (fontSize) {
document.documentElement.classList.add('f-' + fontSize);
}

const useSystemFont = localStorage.getItem('useSystemFont');
if (useSystemFont) {
document.documentElement.classList.add('useSystemFont');
}

const wallpaper = localStorage.getItem('wallpaper');
if (wallpaper) {
document.documentElement.style.backgroundImage = `url(${wallpaper})`;
}

const customCss = localStorage.getItem('customCss');
if (customCss && customCss.length > 0) {
const style = document.createElement('style');
style.innerHTML = customCss;
document.head.appendChild(style);
}
}

function renderError(code: string, details?: string) {
console.log(code, details);
}
Loading

0 comments on commit 13b98eb

Please sign in to comment.