Merge branch 'develop' into fix-freebsd
This commit is contained in:
commit
3524effc2a
15
CHANGELOG.md
15
CHANGELOG.md
|
@ -1,3 +1,15 @@
|
|||
## Unreleased
|
||||
|
||||
### General
|
||||
-
|
||||
|
||||
### Client
|
||||
-
|
||||
|
||||
### Server
|
||||
-
|
||||
|
||||
|
||||
## 2025.2.1
|
||||
|
||||
### General
|
||||
|
@ -15,6 +27,8 @@
|
|||
- Enhance: リアクションする際に確認ダイアログを表示できるように
|
||||
- Enhance: コントロールパネルのユーザ検索で入力された情報をページ遷移で損なわないように `#15437`
|
||||
- Enhance: CWの注釈で入力済みの文字数を表示
|
||||
- Enhance: ノート検索ページのデザイン調整
|
||||
(Cherry-picked from https://github.com/taiyme/misskey/pull/273)
|
||||
- Fix: ノートページで、クリップ一覧が表示されないことがある問題を修正
|
||||
- Fix: コンディショナルロールを手動で割り当てできる導線を削除 `#13529`
|
||||
- Fix: 埋め込みプレイヤーから外部ページに移動できない問題を修正
|
||||
|
@ -22,6 +36,7 @@
|
|||
- Fix: カスタム絵文字管理画面(beta)にてisSensitive/localOnlyの絞り込みが上手くいかない問題の修正 ( #15445 )
|
||||
- Fix: ユーザのサジェスト中に@を入力してもサジェスト結果が消えないように `#14385`
|
||||
- Fix: CWの注釈が100文字を超えている場合、ノート投稿ボタンを非アクティブに
|
||||
- Fix: テーマ選択で現在のテーマが初期表示されていない問題を修正
|
||||
- 翻訳の更新
|
||||
|
||||
### Server
|
||||
|
|
|
@ -1584,3 +1584,7 @@ _offlineScreen:
|
|||
_remoteLookupErrors:
|
||||
_noSuchObject:
|
||||
title: "غير موجود"
|
||||
_search:
|
||||
searchScopeAll: "الكل"
|
||||
searchScopeLocal: "المحلي"
|
||||
searchScopeUser: "مستخدم محدد"
|
||||
|
|
|
@ -1348,3 +1348,6 @@ _reversi:
|
|||
_remoteLookupErrors:
|
||||
_noSuchObject:
|
||||
title: "পাওয়া যায়নি"
|
||||
_search:
|
||||
searchScopeAll: "সবগুলো"
|
||||
searchScopeLocal: "স্থানীয়"
|
||||
|
|
|
@ -2854,3 +2854,11 @@ _bootErrors:
|
|||
otherOption1: "Esborrar la configuració i la memòria cau del client"
|
||||
otherOption2: "Iniciar client senzill"
|
||||
otherOption3: "Iniciar l'eina de reparació "
|
||||
_search:
|
||||
searchScopeAll: "Tot"
|
||||
searchScopeLocal: "Local"
|
||||
searchScopeServer: "Instància "
|
||||
searchScopeUser: "Especificar usuari"
|
||||
pleaseEnterServerHost: "Introdueix l'adreça de la instància "
|
||||
pleaseSelectUser: "Selecciona un usuari"
|
||||
serverHostPlaceholder: "Ex: misskey.example.com"
|
||||
|
|
|
@ -2024,3 +2024,7 @@ _reversi:
|
|||
_remoteLookupErrors:
|
||||
_noSuchObject:
|
||||
title: "Nenalezeno"
|
||||
_search:
|
||||
searchScopeAll: "Vše"
|
||||
searchScopeLocal: "Místní"
|
||||
searchScopeUser: "Upřesnit uživatele"
|
||||
|
|
|
@ -2614,3 +2614,7 @@ _remoteLookupErrors:
|
|||
_noSuchObject:
|
||||
title: "Nicht gefunden"
|
||||
description: "Die angeforderte Ressource konnte nicht gefunden werden, bitte überprüfe die URI erneut."
|
||||
_search:
|
||||
searchScopeAll: "Alle"
|
||||
searchScopeLocal: "Lokal"
|
||||
searchScopeUser: "Spezifischer Benutzer"
|
||||
|
|
|
@ -397,3 +397,5 @@ _moderationLogTypes:
|
|||
suspend: "Αποβολή"
|
||||
_reversi:
|
||||
total: "Σύνολο"
|
||||
_search:
|
||||
searchScopeLocal: "Τοπικό"
|
||||
|
|
|
@ -2854,3 +2854,7 @@ _bootErrors:
|
|||
otherOption1: "Delete client settings and cache"
|
||||
otherOption2: "Start the simple client"
|
||||
otherOption3: "Launch the repair tool"
|
||||
_search:
|
||||
searchScopeAll: "All"
|
||||
searchScopeLocal: "Local"
|
||||
searchScopeUser: "Specific user"
|
||||
|
|
|
@ -2589,3 +2589,7 @@ _followRequest:
|
|||
_remoteLookupErrors:
|
||||
_noSuchObject:
|
||||
title: "No se encuentra"
|
||||
_search:
|
||||
searchScopeAll: "Todo"
|
||||
searchScopeLocal: "Local"
|
||||
searchScopeUser: "Especificar usuario"
|
||||
|
|
|
@ -2364,3 +2364,7 @@ _embedCodeGen:
|
|||
_remoteLookupErrors:
|
||||
_noSuchObject:
|
||||
title: "Non trouvé"
|
||||
_search:
|
||||
searchScopeAll: "Tous"
|
||||
searchScopeLocal: "Local"
|
||||
searchScopeUser: "Spécifier l'utilisateur·rice"
|
||||
|
|
|
@ -2610,3 +2610,7 @@ _mediaControls:
|
|||
_remoteLookupErrors:
|
||||
_noSuchObject:
|
||||
title: "Tidak dapat ditemukan"
|
||||
_search:
|
||||
searchScopeAll: "Semua"
|
||||
searchScopeLocal: "Lokal"
|
||||
searchScopeUser: "Pengguna spesifik"
|
||||
|
|
|
@ -11000,6 +11000,36 @@ export interface Locale extends ILocale {
|
|||
*/
|
||||
"otherOption3": string;
|
||||
};
|
||||
"_search": {
|
||||
/**
|
||||
* 全て
|
||||
*/
|
||||
"searchScopeAll": string;
|
||||
/**
|
||||
* ローカル
|
||||
*/
|
||||
"searchScopeLocal": string;
|
||||
/**
|
||||
* サーバー指定
|
||||
*/
|
||||
"searchScopeServer": string;
|
||||
/**
|
||||
* ユーザー指定
|
||||
*/
|
||||
"searchScopeUser": string;
|
||||
/**
|
||||
* サーバーのホストを入力してください
|
||||
*/
|
||||
"pleaseEnterServerHost": string;
|
||||
/**
|
||||
* ユーザーを選択してください
|
||||
*/
|
||||
"pleaseSelectUser": string;
|
||||
/**
|
||||
* 例: misskey.example.com
|
||||
*/
|
||||
"serverHostPlaceholder": string;
|
||||
};
|
||||
}
|
||||
declare const locales: {
|
||||
[lang: string]: Locale;
|
||||
|
|
|
@ -2854,3 +2854,7 @@ _bootErrors:
|
|||
otherOption1: "Nelle impostazioni, cancellare le impostazioni del client e svuotare la cache"
|
||||
otherOption2: "Avviare il client predefinito"
|
||||
otherOption3: "Avviare lo strumento di riparazione"
|
||||
_search:
|
||||
searchScopeAll: "Tutte"
|
||||
searchScopeLocal: "Locale"
|
||||
searchScopeUser: "Profilo specifico"
|
||||
|
|
|
@ -2942,3 +2942,12 @@ _bootErrors:
|
|||
otherOption1: "クライアント設定とキャッシュを削除"
|
||||
otherOption2: "簡易クライアントを起動"
|
||||
otherOption3: "修復ツールを起動"
|
||||
|
||||
_search:
|
||||
searchScopeAll: "全て"
|
||||
searchScopeLocal: "ローカル"
|
||||
searchScopeServer: "サーバー指定"
|
||||
searchScopeUser: "ユーザー指定"
|
||||
pleaseEnterServerHost: "サーバーのホストを入力してください"
|
||||
pleaseSelectUser: "ユーザーを選択してください"
|
||||
serverHostPlaceholder: "例: misskey.example.com"
|
||||
|
|
|
@ -2854,3 +2854,7 @@ _bootErrors:
|
|||
otherOption1: "クライアント設定とキャッシュをほかす"
|
||||
otherOption2: "簡易クライアントを起動"
|
||||
otherOption3: "修復ツールを起動"
|
||||
_search:
|
||||
searchScopeAll: "みんな"
|
||||
searchScopeLocal: "ローカル"
|
||||
searchScopeUser: "ユーザー指定"
|
||||
|
|
|
@ -843,3 +843,6 @@ _reversi:
|
|||
_remoteLookupErrors:
|
||||
_noSuchObject:
|
||||
title: "몬 찾앗십니다"
|
||||
_search:
|
||||
searchScopeAll: "말캉"
|
||||
searchScopeUser: "사용자 지정"
|
||||
|
|
|
@ -2841,3 +2841,7 @@ _captcha:
|
|||
_bootErrors:
|
||||
title: "로딩이 실패함"
|
||||
solution4: "(Tor Browser) dom.webaudio.enabled를 true로 설정하세요"
|
||||
_search:
|
||||
searchScopeAll: "전체"
|
||||
searchScopeLocal: "로컬"
|
||||
searchScopeUser: "사용자 지정"
|
||||
|
|
|
@ -477,3 +477,5 @@ _moderationLogTypes:
|
|||
_remoteLookupErrors:
|
||||
_noSuchObject:
|
||||
title: "ບໍ່ພົບ"
|
||||
_search:
|
||||
searchScopeAll: "ທັງໝົດ"
|
||||
|
|
|
@ -540,3 +540,5 @@ _reversi:
|
|||
_remoteLookupErrors:
|
||||
_noSuchObject:
|
||||
title: "Niet gevonden"
|
||||
_search:
|
||||
searchScopeAll: "Alle"
|
||||
|
|
|
@ -730,3 +730,5 @@ _moderationLogTypes:
|
|||
_remoteLookupErrors:
|
||||
_noSuchObject:
|
||||
title: "Ikke funnet"
|
||||
_search:
|
||||
searchScopeAll: "Alle"
|
||||
|
|
|
@ -1583,3 +1583,6 @@ _reversi:
|
|||
_remoteLookupErrors:
|
||||
_noSuchObject:
|
||||
title: "Nie znaleziono"
|
||||
_search:
|
||||
searchScopeAll: "Wszystkie"
|
||||
searchScopeLocal: "Lokalne"
|
||||
|
|
|
@ -2757,3 +2757,7 @@ _remoteLookupErrors:
|
|||
_noSuchObject:
|
||||
title: "Não encontrado"
|
||||
description: "O recurso solicitado não foi encontrado, confira o endereço."
|
||||
_search:
|
||||
searchScopeAll: "Todos"
|
||||
searchScopeLocal: "Local"
|
||||
searchScopeUser: "Usuário específico"
|
||||
|
|
|
@ -736,3 +736,5 @@ _reversi:
|
|||
_remoteLookupErrors:
|
||||
_noSuchObject:
|
||||
title: "Nu a fost găsit"
|
||||
_search:
|
||||
searchScopeAll: "Tot"
|
||||
|
|
|
@ -2147,3 +2147,7 @@ _reversi:
|
|||
_remoteLookupErrors:
|
||||
_noSuchObject:
|
||||
title: "Не найдено"
|
||||
_search:
|
||||
searchScopeAll: "Все"
|
||||
searchScopeLocal: "Местная"
|
||||
searchScopeUser: "Указанный пользователь"
|
||||
|
|
|
@ -1449,3 +1449,6 @@ _reversi:
|
|||
_remoteLookupErrors:
|
||||
_noSuchObject:
|
||||
title: "Nenájdené"
|
||||
_search:
|
||||
searchScopeAll: "Všetko"
|
||||
searchScopeLocal: "Lokálne"
|
||||
|
|
|
@ -707,3 +707,5 @@ _reversi:
|
|||
white: "Vit"
|
||||
_selfXssPrevention:
|
||||
warning: "VARNING"
|
||||
_search:
|
||||
searchScopeAll: "Allt"
|
||||
|
|
|
@ -2709,3 +2709,7 @@ _embedCodeGen:
|
|||
_remoteLookupErrors:
|
||||
_noSuchObject:
|
||||
title: "ไม่พบหน้าที่ต้องการ"
|
||||
_search:
|
||||
searchScopeAll: "ทั้งหมด"
|
||||
searchScopeLocal: "ท้องถิ่น"
|
||||
searchScopeUser: "ผู้ใช้เฉพาะ"
|
||||
|
|
|
@ -460,3 +460,5 @@ _deck:
|
|||
_moderationLogTypes:
|
||||
suspend: "askıya al"
|
||||
resetPassword: "Şifre sıfırlama"
|
||||
_search:
|
||||
searchScopeAll: "Tümü"
|
||||
|
|
|
@ -1624,3 +1624,6 @@ _reversi:
|
|||
_remoteLookupErrors:
|
||||
_noSuchObject:
|
||||
title: "Не знайдено"
|
||||
_search:
|
||||
searchScopeAll: "Всі"
|
||||
searchScopeLocal: "Локальна"
|
||||
|
|
|
@ -1094,3 +1094,6 @@ _reversi:
|
|||
_remoteLookupErrors:
|
||||
_noSuchObject:
|
||||
title: "Topilmadi"
|
||||
_search:
|
||||
searchScopeAll: "Barcha"
|
||||
searchScopeLocal: "Mahalliy"
|
||||
|
|
|
@ -1930,3 +1930,7 @@ _reversi:
|
|||
_remoteLookupErrors:
|
||||
_noSuchObject:
|
||||
title: "Không tìm thấy"
|
||||
_search:
|
||||
searchScopeAll: "Tất cả"
|
||||
searchScopeLocal: "Máy chủ này"
|
||||
searchScopeUser: "Người dùng chỉ định"
|
||||
|
|
|
@ -2854,3 +2854,7 @@ _bootErrors:
|
|||
otherOption1: "清除客户端设定与缓存"
|
||||
otherOption2: "使用简易客户端"
|
||||
otherOption3: "启动修复工具"
|
||||
_search:
|
||||
searchScopeAll: "全部"
|
||||
searchScopeLocal: "本地"
|
||||
searchScopeUser: "用户指定"
|
||||
|
|
|
@ -2854,3 +2854,7 @@ _bootErrors:
|
|||
otherOption1: "刪除用戶端設定和快取"
|
||||
otherOption2: "啟動簡易用戶端"
|
||||
otherOption3: "啟動修復工具"
|
||||
_search:
|
||||
searchScopeAll: "全部"
|
||||
searchScopeLocal: "本地"
|
||||
searchScopeUser: "指定使用者"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "misskey",
|
||||
"version": "2025.2.1-beta.2",
|
||||
"version": "2025.2.1",
|
||||
"codename": "nasubi",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -14,7 +14,7 @@ import { IdService } from '@/core/IdService.js';
|
|||
import { MiUserKeypair } from '@/models/UserKeypair.js';
|
||||
import { MiUsedUsername } from '@/models/UsedUsername.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import generateNativeUserToken from '@/misc/generate-native-user-token.js';
|
||||
import { generateNativeUserToken } from '@/misc/token.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
|
||||
@Injectable()
|
||||
|
|
|
@ -14,7 +14,7 @@ import { MiUserProfile } from '@/models/UserProfile.js';
|
|||
import { IdService } from '@/core/IdService.js';
|
||||
import { MiUserKeypair } from '@/models/UserKeypair.js';
|
||||
import { MiUsedUsername } from '@/models/UsedUsername.js';
|
||||
import generateUserToken from '@/misc/generate-native-user-token.js';
|
||||
import { generateNativeUserToken } from '@/misc/token.js';
|
||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
import { InstanceActorService } from '@/core/InstanceActorService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
|
@ -74,7 +74,7 @@ export class SignupService {
|
|||
}
|
||||
|
||||
// Generate secret
|
||||
const secret = generateUserToken();
|
||||
const secret = generateNativeUserToken();
|
||||
|
||||
// Check username duplication
|
||||
if (await this.usersRepository.exists({ where: { usernameLower: username.toLowerCase(), host: IsNull() } })) {
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default (token: string) => token.length === 16;
|
|
@ -5,5 +5,6 @@
|
|||
|
||||
import { secureRndstr } from '@/misc/secure-rndstr.js';
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default () => secureRndstr(16);
|
||||
export const generateNativeUserToken = () => secureRndstr(16);
|
||||
|
||||
export const isNativeUserToken = (token: string) => token.length === 16;
|
|
@ -11,7 +11,7 @@ import type { MiAccessToken } from '@/models/AccessToken.js';
|
|||
import { MemoryKVCache } from '@/misc/cache.js';
|
||||
import type { MiApp } from '@/models/App.js';
|
||||
import { CacheService } from '@/core/CacheService.js';
|
||||
import isNativeToken from '@/misc/is-native-token.js';
|
||||
import { isNativeUserToken } from '@/misc/token.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
|
||||
export class AuthenticationError extends Error {
|
||||
|
@ -46,7 +46,7 @@ export class AuthenticateService implements OnApplicationShutdown {
|
|||
return [null, null];
|
||||
}
|
||||
|
||||
if (isNativeToken(token)) {
|
||||
if (isNativeUserToken(token)) {
|
||||
const user = await this.cacheService.localUserByNativeTokenCache.fetch(token,
|
||||
() => this.usersRepository.findOneBy({ token }) as Promise<MiLocalUser | null>);
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import bcrypt from 'bcryptjs';
|
|||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import type { UsersRepository, UserProfilesRepository } from '@/models/_.js';
|
||||
import generateUserToken from '@/misc/generate-native-user-token.js';
|
||||
import { generateNativeUserToken } from '@/misc/token.js';
|
||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
|
||||
|
@ -49,7 +49,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
throw new Error('incorrect password');
|
||||
}
|
||||
|
||||
const newToken = generateUserToken();
|
||||
const newToken = generateNativeUserToken();
|
||||
|
||||
await this.usersRepository.update(me.id, {
|
||||
token: newToken,
|
||||
|
|
|
@ -41,11 +41,28 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, nextTick, ref, watch, computed, toRefs, useSlots } from 'vue';
|
||||
import type { VNode, VNodeChild } from 'vue';
|
||||
import { useInterval } from '@@/js/use-interval.js';
|
||||
import type { VNode, VNodeChild } from 'vue';
|
||||
import type { MenuItem } from '@/types/menu.js';
|
||||
import * as os from '@/os.js';
|
||||
|
||||
type ItemOption = {
|
||||
type?: 'option';
|
||||
value: string | number | null;
|
||||
label: string;
|
||||
};
|
||||
|
||||
type ItemGroup = {
|
||||
type: 'group';
|
||||
label: string;
|
||||
items: ItemOption[];
|
||||
};
|
||||
|
||||
export type MkSelectItem = ItemOption | ItemGroup;
|
||||
|
||||
// TODO: itemsをslot内のoptionで指定する用法は廃止する(props.itemsを必須化する)
|
||||
// see: https://github.com/misskey-dev/misskey/issues/15558
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: string | number | null;
|
||||
required?: boolean;
|
||||
|
@ -56,6 +73,7 @@ const props = defineProps<{
|
|||
inline?: boolean;
|
||||
small?: boolean;
|
||||
large?: boolean;
|
||||
items?: MkSelectItem[];
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
|
@ -107,7 +125,30 @@ onMounted(() => {
|
|||
});
|
||||
});
|
||||
|
||||
watch(modelValue, () => {
|
||||
watch([modelValue, () => props.items], () => {
|
||||
if (props.items) {
|
||||
let found: ItemOption | null = null;
|
||||
for (const item of props.items) {
|
||||
if (item.type === 'group') {
|
||||
for (const option of item.items) {
|
||||
if (option.value === modelValue.value) {
|
||||
found = option;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (item.value === modelValue.value) {
|
||||
found = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
currentValueText.value = found.label;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const scanOptions = (options: VNodeChild[]) => {
|
||||
for (const vnode of options) {
|
||||
if (typeof vnode !== 'object' || vnode === null || Array.isArray(vnode)) continue;
|
||||
|
@ -130,7 +171,7 @@ watch(modelValue, () => {
|
|||
};
|
||||
|
||||
scanOptions(slots.default!());
|
||||
}, { immediate: true });
|
||||
}, { immediate: true, deep: true });
|
||||
|
||||
function show() {
|
||||
if (opening.value) return;
|
||||
|
@ -139,41 +180,70 @@ function show() {
|
|||
opening.value = true;
|
||||
|
||||
const menu: MenuItem[] = [];
|
||||
let options = slots.default!();
|
||||
|
||||
const pushOption = (option: VNode) => {
|
||||
menu.push({
|
||||
text: option.children as string,
|
||||
active: computed(() => modelValue.value === option.props?.value),
|
||||
action: () => {
|
||||
emit('update:modelValue', option.props?.value);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const scanOptions = (options: VNodeChild[]) => {
|
||||
for (const vnode of options) {
|
||||
if (typeof vnode !== 'object' || vnode === null || Array.isArray(vnode)) continue;
|
||||
if (vnode.type === 'optgroup') {
|
||||
const optgroup = vnode;
|
||||
if (props.items) {
|
||||
for (const item of props.items) {
|
||||
if (item.type === 'group') {
|
||||
menu.push({
|
||||
type: 'label',
|
||||
text: optgroup.props?.label,
|
||||
text: item.label,
|
||||
});
|
||||
if (Array.isArray(optgroup.children)) scanOptions(optgroup.children);
|
||||
} else if (Array.isArray(vnode.children)) { // 何故かフラグメントになってくることがある
|
||||
const fragment = vnode;
|
||||
if (Array.isArray(fragment.children)) scanOptions(fragment.children);
|
||||
} else if (vnode.props == null) { // v-if で条件が false のときにこうなる
|
||||
// nop?
|
||||
for (const option of item.items) {
|
||||
menu.push({
|
||||
text: option.label,
|
||||
active: computed(() => modelValue.value === option.value),
|
||||
action: () => {
|
||||
emit('update:modelValue', option.value);
|
||||
},
|
||||
});
|
||||
}
|
||||
} else {
|
||||
const option = vnode;
|
||||
pushOption(option);
|
||||
menu.push({
|
||||
text: item.label,
|
||||
active: computed(() => modelValue.value === item.value),
|
||||
action: () => {
|
||||
emit('update:modelValue', item.value);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
} else {
|
||||
let options = slots.default!();
|
||||
|
||||
scanOptions(options);
|
||||
const pushOption = (option: VNode) => {
|
||||
menu.push({
|
||||
text: option.children as string,
|
||||
active: computed(() => modelValue.value === option.props?.value),
|
||||
action: () => {
|
||||
emit('update:modelValue', option.props?.value);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const scanOptions = (options: VNodeChild[]) => {
|
||||
for (const vnode of options) {
|
||||
if (typeof vnode !== 'object' || vnode === null || Array.isArray(vnode)) continue;
|
||||
if (vnode.type === 'optgroup') {
|
||||
const optgroup = vnode;
|
||||
menu.push({
|
||||
type: 'label',
|
||||
text: optgroup.props?.label,
|
||||
});
|
||||
if (Array.isArray(optgroup.children)) scanOptions(optgroup.children);
|
||||
} else if (Array.isArray(vnode.children)) { // 何故かフラグメントになってくることがある
|
||||
const fragment = vnode;
|
||||
if (Array.isArray(fragment.children)) scanOptions(fragment.children);
|
||||
} else if (vnode.props == null) { // v-if で条件が false のときにこうなる
|
||||
// nop?
|
||||
} else {
|
||||
const option = vnode;
|
||||
pushOption(option);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
scanOptions(options);
|
||||
}
|
||||
|
||||
os.popupMenu(menu, container.value, {
|
||||
width: container.value?.offsetWidth,
|
||||
|
|
|
@ -6,69 +6,127 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<template>
|
||||
<div class="_gaps">
|
||||
<div class="_gaps">
|
||||
<MkInput v-model="searchQuery" :large="true" :autofocus="true" type="search" @enter.prevent="search">
|
||||
<MkInput
|
||||
v-model="searchQuery"
|
||||
large
|
||||
autofocus
|
||||
type="search"
|
||||
@enter.prevent="search"
|
||||
>
|
||||
<template #prefix><i class="ti ti-search"></i></template>
|
||||
</MkInput>
|
||||
<MkFoldableSection :expanded="true">
|
||||
<MkFoldableSection expanded>
|
||||
<template #header>{{ i18n.ts.options }}</template>
|
||||
|
||||
<div class="_gaps_m">
|
||||
<template v-if="instance.federation !== 'none'">
|
||||
<MkRadios v-model="hostSelect">
|
||||
<template #label>{{ i18n.ts.host }}</template>
|
||||
<option value="all" default>{{ i18n.ts.all }}</option>
|
||||
<option value="local">{{ i18n.ts.local }}</option>
|
||||
<option v-if="noteSearchableScope === 'global'" value="specified">{{ i18n.ts.specifyHost }}</option>
|
||||
</MkRadios>
|
||||
<MkInput v-if="noteSearchableScope === 'global'" v-model="hostInput" :disabled="hostSelect !== 'specified'" :large="true" type="search">
|
||||
<MkRadios v-model="searchScope">
|
||||
<option v-if="instance.federation !== 'none' && noteSearchableScope === 'global'" value="all">{{ i18n.ts._search.searchScopeAll }}</option>
|
||||
<option value="local">{{ instance.federation === 'none' ? i18n.ts._search.searchScopeAll : i18n.ts._search.searchScopeLocal }}</option>
|
||||
<option v-if="instance.federation !== 'none' && noteSearchableScope === 'global'" value="server">{{ i18n.ts._search.searchScopeServer }}</option>
|
||||
<option value="user">{{ i18n.ts._search.searchScopeUser }}</option>
|
||||
</MkRadios>
|
||||
|
||||
<div v-if="instance.federation !== 'none' && searchScope === 'server'" :class="$style.subOptionRoot">
|
||||
<MkInput
|
||||
v-model="hostInput"
|
||||
:placeholder="i18n.ts._search.serverHostPlaceholder"
|
||||
@enter.prevent="search"
|
||||
>
|
||||
<template #label>{{ i18n.ts._search.pleaseEnterServerHost }}</template>
|
||||
<template #prefix><i class="ti ti-server"></i></template>
|
||||
</MkInput>
|
||||
</template>
|
||||
|
||||
<MkFolder :defaultOpen="true">
|
||||
<template #label>{{ i18n.ts.specifyUser }}</template>
|
||||
<template v-if="user" #suffix>@{{ user.username }}{{ user.host ? `@${user.host}` : "" }}</template>
|
||||
</div>
|
||||
|
||||
<div v-if="searchScope === 'user'" :class="$style.subOptionRoot">
|
||||
<div :class="$style.userSelectLabel">{{ i18n.ts._search.pleaseSelectUser }}</div>
|
||||
<div class="_gaps">
|
||||
<div :class="$style.userItem">
|
||||
<MkUserCardMini v-if="user" :class="$style.userCard" :user="user" :withChart="false"/>
|
||||
<MkButton v-if="user == null && $i != null" transparent :class="$style.addMeButton" @click="selectSelf"><div :class="$style.addUserButtonInner"><span><i class="ti ti-plus"></i><i class="ti ti-user"></i></span><span>{{ i18n.ts.selectSelf }}</span></div></MkButton>
|
||||
<MkButton v-if="user == null" transparent :class="$style.addUserButton" @click="selectUser"><div :class="$style.addUserButtonInner"><i class="ti ti-plus"></i><span>{{ i18n.ts.selectUser }}</span></div></MkButton>
|
||||
<button class="_button" :class="$style.remove" :disabled="user == null" @click="removeUser"><i class="ti ti-x"></i></button>
|
||||
<div v-if="user == null" :class="$style.userSelectButtons">
|
||||
<div v-if="$i != null">
|
||||
<MkButton
|
||||
transparent
|
||||
:class="$style.userSelectButton"
|
||||
@click="selectSelf"
|
||||
>
|
||||
<div :class="$style.userSelectButtonInner">
|
||||
<span><i class="ti ti-plus"></i><i class="ti ti-user"></i></span>
|
||||
<span>{{ i18n.ts.selectSelf }}</span>
|
||||
</div>
|
||||
</MkButton>
|
||||
</div>
|
||||
<div :style="$i == null ? 'grid-column: span 2;' : undefined">
|
||||
<MkButton
|
||||
transparent
|
||||
:class="$style.userSelectButton"
|
||||
@click="selectUser"
|
||||
>
|
||||
<div :class="$style.userSelectButtonInner">
|
||||
<span><i class="ti ti-plus"></i></span>
|
||||
<span>{{ i18n.ts.selectUser }}</span>
|
||||
</div>
|
||||
</MkButton>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else :class="$style.userSelectedButtons">
|
||||
<div style="overflow: hidden;">
|
||||
<MkUserCardMini
|
||||
:user="user"
|
||||
:withChart="false"
|
||||
:class="$style.userSelectedCard"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<button
|
||||
class="_button"
|
||||
:class="$style.userSelectedRemoveButton"
|
||||
@click="removeUser"
|
||||
>
|
||||
<i class="ti ti-x"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</MkFolder>
|
||||
</div>
|
||||
</div>
|
||||
</MkFoldableSection>
|
||||
<div>
|
||||
<MkButton large primary gradate rounded style="margin: 0 auto;" @click="search">{{ i18n.ts.search }}</MkButton>
|
||||
<MkButton
|
||||
large
|
||||
primary
|
||||
gradate
|
||||
rounded
|
||||
:disabled="searchParams == null"
|
||||
style="margin: 0 auto;"
|
||||
@click="search"
|
||||
>
|
||||
{{ i18n.ts.search }}
|
||||
</MkButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<MkFoldableSection v-if="notePagination">
|
||||
<template #header>{{ i18n.ts.searchResult }}</template>
|
||||
<MkNotes :key="key" :pagination="notePagination"/>
|
||||
<MkNotes :key="`searchNotes:${key}`" :pagination="notePagination"/>
|
||||
</MkFoldableSection>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, toRef, watch } from 'vue';
|
||||
import type { UserDetailed } from 'misskey-js/entities.js';
|
||||
import { computed, ref, shallowRef, toRef } from 'vue';
|
||||
import type * as Misskey from 'misskey-js';
|
||||
import type { Paging } from '@/components/MkPagination.vue';
|
||||
import MkNotes from '@/components/MkNotes.vue';
|
||||
import MkInput from '@/components/MkInput.vue';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import { $i } from '@/account.js';
|
||||
import { host as localHost } from '@@/js/config.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { instance } from '@/instance.js';
|
||||
import * as os from '@/os.js';
|
||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||
import MkFoldableSection from '@/components/MkFoldableSection.vue';
|
||||
import MkFolder from '@/components/MkFolder.vue';
|
||||
import { useRouter } from '@/router/supplier.js';
|
||||
import MkUserCardMini from '@/components/MkUserCardMini.vue';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import MkFoldableSection from '@/components/MkFoldableSection.vue';
|
||||
import MkInput from '@/components/MkInput.vue';
|
||||
import MkNotes from '@/components/MkNotes.vue';
|
||||
import MkRadios from '@/components/MkRadios.vue';
|
||||
import { $i } from '@/account.js';
|
||||
import { instance } from '@/instance.js';
|
||||
import MkUserCardMini from '@/components/MkUserCardMini.vue';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
query?: string;
|
||||
|
@ -83,76 +141,127 @@ const props = withDefaults(defineProps<{
|
|||
});
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const key = ref(0);
|
||||
const notePagination = ref<Paging<'notes/search'>>();
|
||||
|
||||
const searchQuery = ref(toRef(props, 'query').value);
|
||||
const notePagination = ref<Paging>();
|
||||
const user = ref<UserDetailed | null>(null);
|
||||
const hostInput = ref(toRef(props, 'host').value);
|
||||
|
||||
const user = shallowRef<Misskey.entities.UserDetailed | null>(null);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
const noteSearchableScope = instance.noteSearchableScope ?? 'local';
|
||||
|
||||
const hostSelect = ref<'all' | 'local' | 'specified'>('all');
|
||||
//#region set user
|
||||
let fetchedUser: Misskey.entities.UserDetailed | null = null;
|
||||
|
||||
const setHostSelectWithInput = (after: string | undefined | null, before: string | undefined | null) => {
|
||||
if (before === after) return;
|
||||
if (after === '') hostSelect.value = 'all';
|
||||
else hostSelect.value = 'specified';
|
||||
if (props.userId) {
|
||||
fetchedUser = await misskeyApi('users/show', {
|
||||
userId: props.userId,
|
||||
}).catch(() => null);
|
||||
}
|
||||
|
||||
if (props.username && fetchedUser == null) {
|
||||
fetchedUser = await misskeyApi('users/show', {
|
||||
username: props.username,
|
||||
...(props.host ? { host: props.host } : {}),
|
||||
}).catch(() => null);
|
||||
}
|
||||
|
||||
if (fetchedUser != null) {
|
||||
if (!(noteSearchableScope === 'local' && fetchedUser.host != null)) {
|
||||
user.value = fetchedUser;
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
|
||||
const searchScope = ref<'all' | 'local' | 'server' | 'user'>((() => {
|
||||
if (user.value != null) return 'user';
|
||||
if (noteSearchableScope === 'local') return 'local';
|
||||
if (hostInput.value) return 'server';
|
||||
return 'all';
|
||||
})());
|
||||
|
||||
type SearchParams = {
|
||||
readonly query: string;
|
||||
readonly host?: string;
|
||||
readonly userId?: string;
|
||||
};
|
||||
|
||||
setHostSelectWithInput(hostInput.value, undefined);
|
||||
const fixHostIfLocal = (target: string | null | undefined) => {
|
||||
if (!target || target === localHost) return '.';
|
||||
return target;
|
||||
};
|
||||
|
||||
watch(hostInput, setHostSelectWithInput);
|
||||
const searchParams = computed<SearchParams | null>(() => {
|
||||
const trimmedQuery = searchQuery.value.trim();
|
||||
if (!trimmedQuery) return null;
|
||||
|
||||
const searchHost = computed(() => {
|
||||
if (hostSelect.value === 'local' || instance.federation === 'none') return '.';
|
||||
if (hostSelect.value === 'specified') return hostInput.value;
|
||||
return null;
|
||||
if (searchScope.value === 'user') {
|
||||
if (user.value == null) return null;
|
||||
return {
|
||||
query: trimmedQuery,
|
||||
host: fixHostIfLocal(user.value.host),
|
||||
userId: user.value.id,
|
||||
};
|
||||
}
|
||||
|
||||
if (instance.federation !== 'none' && searchScope.value === 'server') {
|
||||
let trimmedHost = hostInput.value?.trim();
|
||||
if (!trimmedHost) return null;
|
||||
if (trimmedHost.startsWith('https://') || trimmedHost.startsWith('http://')) {
|
||||
try {
|
||||
trimmedHost = new URL(trimmedHost).host;
|
||||
} catch (err) { /* empty */ }
|
||||
}
|
||||
return {
|
||||
query: trimmedQuery,
|
||||
host: fixHostIfLocal(trimmedHost),
|
||||
};
|
||||
}
|
||||
|
||||
if (instance.federation === 'none' || searchScope.value === 'local') {
|
||||
return {
|
||||
query: trimmedQuery,
|
||||
host: '.',
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
query: trimmedQuery,
|
||||
};
|
||||
});
|
||||
|
||||
if (props.userId != null) {
|
||||
misskeyApi('users/show', { userId: props.userId }).then(_user => {
|
||||
user.value = _user;
|
||||
});
|
||||
} else if (props.username != null) {
|
||||
misskeyApi('users/show', {
|
||||
username: props.username,
|
||||
...(props.host != null && props.host !== '') ? { host: props.host } : {},
|
||||
function selectUser() {
|
||||
os.selectUser({
|
||||
includeSelf: true,
|
||||
localOnly: instance.noteSearchableScope === 'local',
|
||||
}).then(_user => {
|
||||
user.value = _user;
|
||||
});
|
||||
}
|
||||
|
||||
function selectUser() {
|
||||
os.selectUser({ includeSelf: true, localOnly: instance.noteSearchableScope === 'local' }).then(_user => {
|
||||
user.value = _user;
|
||||
hostInput.value = _user.host ?? '';
|
||||
});
|
||||
}
|
||||
|
||||
function selectSelf() {
|
||||
user.value = $i as UserDetailed | null;
|
||||
hostInput.value = null;
|
||||
user.value = $i;
|
||||
}
|
||||
|
||||
function removeUser() {
|
||||
user.value = null;
|
||||
hostInput.value = '';
|
||||
}
|
||||
|
||||
async function search() {
|
||||
const query = searchQuery.value.toString().trim();
|
||||
|
||||
if (query == null || query === '') return;
|
||||
if (searchParams.value == null) return;
|
||||
|
||||
//#region AP lookup
|
||||
if (query.startsWith('https://') && !query.includes(' ')) {
|
||||
if (searchParams.value.query.startsWith('https://') && !searchParams.value.query.includes(' ')) {
|
||||
const confirm = await os.confirm({
|
||||
type: 'info',
|
||||
text: i18n.ts.lookupConfirm,
|
||||
});
|
||||
if (!confirm.canceled) {
|
||||
const promise = misskeyApi('ap/show', {
|
||||
uri: query,
|
||||
uri: searchParams.value.query,
|
||||
});
|
||||
|
||||
os.promiseDialog(promise, null, null, i18n.ts.fetchingAsApObject);
|
||||
|
@ -161,6 +270,7 @@ async function search() {
|
|||
|
||||
if (res.type === 'User') {
|
||||
router.push(`/@${res.object.username}@${res.object.host}`);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
} else if (res.type === 'Note') {
|
||||
router.push(`/notes/${res.object.id}`);
|
||||
}
|
||||
|
@ -170,25 +280,25 @@ async function search() {
|
|||
}
|
||||
//#endregion
|
||||
|
||||
if (query.length > 1 && !query.includes(' ')) {
|
||||
if (query.startsWith('@')) {
|
||||
if (searchParams.value.query.length > 1 && !searchParams.value.query.includes(' ')) {
|
||||
if (searchParams.value.query.startsWith('@')) {
|
||||
const confirm = await os.confirm({
|
||||
type: 'info',
|
||||
text: i18n.ts.lookupConfirm,
|
||||
});
|
||||
if (!confirm.canceled) {
|
||||
router.push(`/${query}`);
|
||||
router.push(`/${searchParams.value.query}`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (query.startsWith('#')) {
|
||||
if (searchParams.value.query.startsWith('#')) {
|
||||
const confirm = await os.confirm({
|
||||
type: 'info',
|
||||
text: i18n.ts.openTagPageConfirm,
|
||||
});
|
||||
if (!confirm.canceled) {
|
||||
router.push(`/tags/${encodeURIComponent(query.substring(1))}`);
|
||||
router.push(`/tags/${encodeURIComponent(searchParams.value.query.substring(1))}`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -198,9 +308,7 @@ async function search() {
|
|||
endpoint: 'notes/search',
|
||||
limit: 10,
|
||||
params: {
|
||||
query: searchQuery.value,
|
||||
userId: user.value ? user.value.id : null,
|
||||
...(searchHost.value ? { host: searchHost.value } : {}),
|
||||
...searchParams.value,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -208,41 +316,48 @@ async function search() {
|
|||
}
|
||||
</script>
|
||||
<style lang="scss" module>
|
||||
.userItem {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
.subOptionRoot {
|
||||
background: var(--MI_THEME-panel);
|
||||
border-radius: var(--MI-radius);
|
||||
padding: var(--MI-margin);
|
||||
}
|
||||
.addMeButton {
|
||||
border: 2px dashed var(--MI_THEME-fgTransparent);
|
||||
|
||||
.userSelectLabel {
|
||||
font-size: 0.85em;
|
||||
padding: 0 0 8px;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.userSelectButtons {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.userSelectButton {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 12px;
|
||||
margin-right: 16px;
|
||||
border: 2px dashed var(--MI_THEME-fgTransparent);
|
||||
}
|
||||
.addUserButton {
|
||||
border: 2px dashed var(--MI_THEME-fgTransparent);
|
||||
padding: 12px;
|
||||
flex-grow: 1;
|
||||
}
|
||||
.addUserButtonInner {
|
||||
|
||||
.userSelectButtonInner {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
min-height: 38px;
|
||||
}
|
||||
.userCard {
|
||||
flex-grow: 1;
|
||||
|
||||
.userSelectedButtons {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto;
|
||||
align-items: center;
|
||||
}
|
||||
.remove {
|
||||
|
||||
.userSelectedRemoveButton {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
align-self: center;
|
||||
|
||||
& > i:before {
|
||||
color: #ff2a2a;
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
opacity: 0;
|
||||
}
|
||||
color: #ff2a2a;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -19,7 +19,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
|
||||
<MkFoldableSection v-if="userPagination">
|
||||
<template #header>{{ i18n.ts.searchResult }}</template>
|
||||
<MkUserList :key="key" :pagination="userPagination"/>
|
||||
<MkUserList :key="`searchUsers:${key}`" :pagination="userPagination"/>
|
||||
</MkFoldableSection>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -49,14 +49,16 @@ const props = withDefaults(defineProps<{
|
|||
|
||||
const router = useRouter();
|
||||
|
||||
const key = ref('');
|
||||
const key = ref(0);
|
||||
const userPagination = ref<Paging<'users/search'>>();
|
||||
|
||||
const searchQuery = ref(toRef(props, 'query').value);
|
||||
const searchOrigin = ref(toRef(props, 'origin').value);
|
||||
const userPagination = ref<Paging>();
|
||||
|
||||
async function search() {
|
||||
const query = searchQuery.value.toString().trim();
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
if (query == null || query === '') return;
|
||||
|
||||
//#region AP lookup
|
||||
|
@ -76,6 +78,7 @@ async function search() {
|
|||
|
||||
if (res.type === 'User') {
|
||||
router.push(`/@${res.object.username}@${res.object.host}`);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
} else if (res.type === 'Note') {
|
||||
router.push(`/notes/${res.object.id}`);
|
||||
}
|
||||
|
@ -118,6 +121,6 @@ async function search() {
|
|||
},
|
||||
};
|
||||
|
||||
key.value = query;
|
||||
key.value++;
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -32,27 +32,13 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</div>
|
||||
|
||||
<div class="selects">
|
||||
<MkSelect v-model="lightThemeId" large class="select">
|
||||
<MkSelect v-model="lightThemeId" large class="select" :items="lightThemeSelectorItems">
|
||||
<template #label>{{ i18n.ts.themeForLightMode }}</template>
|
||||
<template #prefix><i class="ti ti-sun"></i></template>
|
||||
<option v-if="instanceLightTheme" :key="'instance:' + instanceLightTheme.id" :value="instanceLightTheme.id">{{ instanceLightTheme.name }}</option>
|
||||
<optgroup v-if="installedLightThemes.length > 0" :label="i18n.ts._theme.installedThemes">
|
||||
<option v-for="x in installedLightThemes" :key="'installed:' + x.id" :value="x.id">{{ x.name }}</option>
|
||||
</optgroup>
|
||||
<optgroup :label="i18n.ts._theme.builtinThemes">
|
||||
<option v-for="x in builtinLightThemes" :key="'builtin:' + x.id" :value="x.id">{{ x.name }}</option>
|
||||
</optgroup>
|
||||
</MkSelect>
|
||||
<MkSelect v-model="darkThemeId" large class="select">
|
||||
<MkSelect v-model="darkThemeId" large class="select" :items="darkThemeSelectorItems">
|
||||
<template #label>{{ i18n.ts.themeForDarkMode }}</template>
|
||||
<template #prefix><i class="ti ti-moon"></i></template>
|
||||
<option v-if="instanceDarkTheme" :key="'instance:' + instanceDarkTheme.id" :value="instanceDarkTheme.id">{{ instanceDarkTheme.name }}</option>
|
||||
<optgroup v-if="installedDarkThemes.length > 0" :label="i18n.ts._theme.installedThemes">
|
||||
<option v-for="x in installedDarkThemes" :key="'installed:' + x.id" :value="x.id">{{ x.name }}</option>
|
||||
</optgroup>
|
||||
<optgroup :label="i18n.ts._theme.builtinThemes">
|
||||
<option v-for="x in builtinDarkThemes" :key="'builtin:' + x.id" :value="x.id">{{ x.name }}</option>
|
||||
</optgroup>
|
||||
</MkSelect>
|
||||
</div>
|
||||
|
||||
|
@ -73,6 +59,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<script lang="ts" setup>
|
||||
import { computed, onActivated, ref, watch } from 'vue';
|
||||
import JSON5 from 'json5';
|
||||
import type { MkSelectItem } from '@/components/MkSelect.vue';
|
||||
import MkSwitch from '@/components/MkSwitch.vue';
|
||||
import MkSelect from '@/components/MkSelect.vue';
|
||||
import FormSection from '@/components/form/section.vue';
|
||||
|
@ -102,6 +89,70 @@ const installedLightThemes = computed(() => installedThemes.value.filter(t => t.
|
|||
const builtinLightThemes = computed(() => builtinThemes.value.filter(t => t.base === 'light' || t.kind === 'light'));
|
||||
const themes = computed(() => uniqueBy([instanceDarkTheme.value, instanceLightTheme.value, ...builtinThemes.value, ...installedThemes.value].filter(x => x != null), theme => theme.id));
|
||||
|
||||
const lightThemeSelectorItems = computed(() => {
|
||||
const items = [] as MkSelectItem[];
|
||||
if (instanceLightTheme.value) {
|
||||
items.push({
|
||||
type: 'option',
|
||||
value: instanceLightTheme.value.id,
|
||||
label: instanceLightTheme.value.name,
|
||||
});
|
||||
}
|
||||
if (installedLightThemes.value.length > 0) {
|
||||
items.push({
|
||||
type: 'group',
|
||||
label: i18n.ts._theme.installedThemes,
|
||||
items: installedLightThemes.value.map(x => ({
|
||||
type: 'option',
|
||||
value: x.id,
|
||||
label: x.name,
|
||||
})),
|
||||
});
|
||||
}
|
||||
items.push({
|
||||
type: 'group',
|
||||
label: i18n.ts._theme.builtinThemes,
|
||||
items: builtinLightThemes.value.map(x => ({
|
||||
type: 'option',
|
||||
value: x.id,
|
||||
label: x.name,
|
||||
})),
|
||||
});
|
||||
return items;
|
||||
});
|
||||
|
||||
const darkThemeSelectorItems = computed(() => {
|
||||
const items = [] as MkSelectItem[];
|
||||
if (instanceDarkTheme.value) {
|
||||
items.push({
|
||||
type: 'option',
|
||||
value: instanceDarkTheme.value.id,
|
||||
label: instanceDarkTheme.value.name,
|
||||
});
|
||||
}
|
||||
if (installedDarkThemes.value.length > 0) {
|
||||
items.push({
|
||||
type: 'group',
|
||||
label: i18n.ts._theme.installedThemes,
|
||||
items: installedDarkThemes.value.map(x => ({
|
||||
type: 'option',
|
||||
value: x.id,
|
||||
label: x.name,
|
||||
})),
|
||||
});
|
||||
}
|
||||
items.push({
|
||||
type: 'group',
|
||||
label: i18n.ts._theme.builtinThemes,
|
||||
items: builtinDarkThemes.value.map(x => ({
|
||||
type: 'option',
|
||||
value: x.id,
|
||||
label: x.name,
|
||||
})),
|
||||
});
|
||||
return items;
|
||||
});
|
||||
|
||||
const darkTheme = ColdDeviceStorage.ref('darkTheme');
|
||||
const darkThemeId = computed({
|
||||
get() {
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { host as localHost } from '@@/js/config.js';
|
||||
|
||||
export async function genSearchQuery(v: any, q: string) {
|
||||
let host: string;
|
||||
let userId: string;
|
||||
if (q.split(' ').some(x => x.startsWith('@'))) {
|
||||
for (const at of q.split(' ').filter(x => x.startsWith('@')).map(x => x.substring(1))) {
|
||||
if (at.includes('.')) {
|
||||
if (at === localHost || at === '.') {
|
||||
host = null;
|
||||
} else {
|
||||
host = at;
|
||||
}
|
||||
} else {
|
||||
const user = await v.api('users/show', Misskey.acct.parse(at)).catch(x => null);
|
||||
if (user) {
|
||||
userId = user.id;
|
||||
} else {
|
||||
// todo: show error
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
query: q.split(' ').filter(x => !x.startsWith('/') && !x.startsWith('@')).join(' '),
|
||||
host: host,
|
||||
userId: userId,
|
||||
};
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"type": "module",
|
||||
"name": "misskey-js",
|
||||
"version": "2025.2.1-beta.2",
|
||||
"version": "2025.2.1",
|
||||
"description": "Misskey SDK for JavaScript",
|
||||
"license": "MIT",
|
||||
"main": "./built/index.js",
|
||||
|
|
Loading…
Reference in New Issue