Skip to content

Commit

Permalink
Merge branch 'develop' into emoji_file_label
Browse files Browse the repository at this point in the history
  • Loading branch information
kozakura913 authored Dec 27, 2024
2 parents 1a30048 + 1658048 commit 414d18f
Show file tree
Hide file tree
Showing 8 changed files with 135 additions and 48 deletions.
1 change: 1 addition & 0 deletions CHANGELOG_YOJO.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Feat: システムユーザーのファイル一覧を追加 [#595](https://github.com/yojo-art/cherrypick/pull/595)

### Client
- Enhance: ノート詳細から前後のHTL/LTLを開く機能を追加 [#572](https://github.com/yojo-art/cherrypick/pull/572)
- Enhance: インポート時にライセンス欄にインポート元を追記する [#573](https://github.com/yojo-art/cherrypick/pull/573)

### Server
Expand Down
4 changes: 4 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4215,6 +4215,10 @@ export interface Locale extends ILocale {
* CWを維持する
*/
"keepCw": string;
/**
* %sが検索語句に置き換えられます
*/
"searchEngineDescription": string;
/**
* Pub/Subのアカウント
*/
Expand Down
1 change: 1 addition & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,7 @@ usernameInfo: "サーバー上であなたのアカウントを一意に識別
aiChanMode: "藍モード"
devMode: "開発者モード"
keepCw: "CWを維持する"
searchEngineDescription: "%sが検索語句に置き換えられます"
pubSub: "Pub/Subのアカウント"
lastCommunication: "直近の通信"
resolved: "解決済み"
Expand Down
15 changes: 12 additions & 3 deletions packages/frontend/src/components/MkGoogle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ SPDX-License-Identifier: AGPL-3.0-only

<script lang="ts" setup>
import { ref } from 'vue';
import { url as local } from '@@/js/config.js';
import { i18n } from '@/i18n.js';
import { defaultStore } from '@/store.js';
import { useRouter } from '@/router/supplier.js';

const router = useRouter();

const props = defineProps<{
q: string;
Expand All @@ -21,9 +26,13 @@ const props = defineProps<{
const query = ref(props.q);

const search = () => {
const sp = new URLSearchParams();
sp.append('q', query.value);
window.open(`https://www.google.com/search?${sp.toString()}`, '_blank', 'noopener');
const searchUrl = String(defaultStore.state.searchEngine).replaceAll('%s', encodeURIComponent(query.value));
const url = new URL(searchUrl, local);
if (url.origin === local) {
router.push(url.toString().substring(local.length));
} else {
window.open(searchUrl, '_blank', 'noopener');
}
};
</script>

Expand Down
148 changes: 103 additions & 45 deletions packages/frontend/src/pages/note.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ SPDX-License-Identifier: AGPL-3.0-only
<Transition :name="defaultStore.state.animation ? 'fade' : ''" mode="out-in">
<div v-if="note">
<div v-if="showNext" class="_margin">
<MkNotes class="" :pagination="showNext === 'channel' ? nextChannelPagination : nextUserPagination" :noGap="true" :disableAutoLoad="true"/>
<MkNotes class="" :pagination="showNext" :noGap="true" :disableAutoLoad="true"/>
</div>

<div class="_margin">
<div v-if="!showNext" class="_buttons" :class="$style.loadNext">
<MkButton v-if="note.channelId" rounded :class="$style.loadButton" @click="showNext = 'channel'"><i class="ti ti-chevron-up"></i> <i class="ti ti-device-tv"></i></MkButton>
<MkButton rounded :class="$style.loadButton" @click="showNext = 'user'"><i class="ti ti-chevron-up"></i> <i class="ti ti-user"></i></MkButton>
<MkButton v-if="note.channelId" rounded :class="$style.loadButton" @click="showNext = showNextPagination('channel')"><i class="ti ti-chevron-up"></i> <i class="ti ti-device-tv"></i></MkButton>
<MkButton rounded :class="$style.loadButton" @click="showNext = showNextPagination('user')"><i class="ti ti-chevron-up"></i> <i class="ti ti-user"></i></MkButton>
<MkButton v-if="isAvailableBasicTimeline('home')" rounded :class="$style.loadButton" @click="showNext = showNextPagination('home')"><i class="ti ti-chevron-up"></i> <i class="ti ti-home"></i></MkButton>
<MkButton v-if="isAvailableBasicTimeline('local')" rounded :class="$style.loadButton" @click="showNext = showNextPagination('local')"><i class="ti ti-chevron-up"></i> <i class="ti ti-planet"></i></MkButton>
</div>
<div class="_margin _gaps_s">
<MkRemoteCaution v-if="note.user.host != null" :href="note.url ?? note.uri"/>
Expand All @@ -30,13 +32,15 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
</div>
<div v-if="!showPrev" class="_buttons" :class="$style.loadPrev">
<MkButton v-if="note.channelId" rounded :class="$style.loadButton" @click="showPrev = 'channel'"><i class="ti ti-chevron-down"></i> <i class="ti ti-device-tv"></i></MkButton>
<MkButton rounded :class="$style.loadButton" @click="showPrev = 'user'"><i class="ti ti-chevron-down"></i> <i class="ti ti-user"></i></MkButton>
<MkButton v-if="note.channelId" rounded :class="$style.loadButton" @click="showPrev = showPrevPagination('channel')"><i class="ti ti-chevron-down"></i> <i class="ti ti-device-tv"></i></MkButton>
<MkButton rounded :class="$style.loadButton" @click="showPrev = showPrevPagination('user')"><i class="ti ti-chevron-down"></i> <i class="ti ti-user"></i></MkButton>
<MkButton v-if="isAvailableBasicTimeline('home')" rounded :class="$style.loadButton" @click="showPrev = showPrevPagination('home')"><i class="ti ti-chevron-down"></i> <i class="ti ti-home"></i></MkButton>
<MkButton v-if="isAvailableBasicTimeline('local')" rounded :class="$style.loadButton" @click="showPrev = showPrevPagination('local')"><i class="ti ti-chevron-down"></i> <i class="ti ti-planet"></i></MkButton>
</div>
</div>

<div v-if="showPrev" class="_margin">
<MkNotes class="" :pagination="showPrev === 'channel' ? prevChannelPagination : prevUserPagination" :noGap="true"/>
<MkNotes class="" :pagination="showPrev" :noGap="true"/>
</div>
</div>
<MkError v-else-if="error" @retry="fetchNote()"/>
Expand All @@ -61,6 +65,7 @@ import { i18n } from '@/i18n.js';
import { dateString } from '@/filters/date.js';
import MkClipPreview from '@/components/MkClipPreview.vue';
import { defaultStore } from '@/store.js';
import { isAvailableBasicTimeline } from '@/timelines.js';

const props = defineProps<{
noteId: string;
Expand All @@ -69,47 +74,100 @@ const props = defineProps<{

const note = ref<null | Misskey.entities.Note>();
const clips = ref<Misskey.entities.Clip[]>();
const showPrev = ref<'user' | 'channel' | false>(false);
const showNext = ref<'user' | 'channel' | false>(false);
type TimelineType = 'user' | 'home' | 'local' | 'channel' | false;
const showPrev = ref<Paging|false>(false);
const showNext = ref<Paging|false>(false);
const error = ref();

const prevUserPagination: Paging = {
endpoint: 'users/notes',
limit: 10,
params: computed(() => note.value ? ({
userId: note.value.userId,
untilId: note.value.id,
}) : undefined),
};

const nextUserPagination: Paging = {
reversed: true,
endpoint: 'users/notes',
limit: 10,
params: computed(() => note.value ? ({
userId: note.value.userId,
sinceId: note.value.id,
}) : undefined),
};

const prevChannelPagination: Paging = {
endpoint: 'channels/timeline',
limit: 10,
params: computed(() => note.value ? ({
channelId: note.value.channelId,
untilId: note.value.id,
}) : undefined),
};

const nextChannelPagination: Paging = {
reversed: true,
endpoint: 'channels/timeline',
limit: 10,
params: computed(() => note.value ? ({
channelId: note.value.channelId,
sinceId: note.value.id,
}) : undefined),
};
function showPrevPagination(tl:TimelineType): Paging {
switch (tl) {
case 'channel':
return {
endpoint: 'channels/timeline',
limit: 10,
params: computed(() => note.value ? ({
channelId: note.value.channelId,
untilId: note.value.id,
}) : undefined),
};
case 'home':
return {
endpoint: 'notes/timeline',
limit: 10,
params: computed(() => note.value ? ({
withRenotes: true,
withReplies: true,
untilId: note.value.id,
}) : undefined),
};
case 'local':
return {
endpoint: 'notes/local-timeline',
limit: 10,
params: computed(() => note.value ? ({
withRenotes: true,
withReplies: true,
untilId: note.value.id,
}) : undefined),
};
default:
return {
endpoint: 'users/notes',
limit: 10,
params: computed(() => note.value ? ({
userId: note.value.userId,
untilId: note.value.id,
}) : undefined),
};
}
}

function showNextPagination(tl:TimelineType):Paging {
switch (tl) {
case 'channel':
return {
reversed: true,
endpoint: 'channels/timeline',
limit: 10,
params: computed(() => note.value ? ({
channelId: note.value.channelId,
sinceId: note.value.id,
}) : undefined),
};
case 'home':
return {
reversed: true,
endpoint: 'notes/timeline',
limit: 10,
params: computed(() => note.value ? ({
withRenotes: true,
withReplies: true,
sinceId: note.value.id,
}) : undefined),
};
case 'local':
return {
reversed: true,
endpoint: 'notes/local-timeline',
limit: 10,
params: computed(() => note.value ? ({
withRenotes: true,
withReplies: true,
sinceId: note.value.id,
}) : undefined),
};
default:
return {
reversed: true,
endpoint: 'users/notes',
limit: 10,
params: computed(() => note.value ? ({
userId: note.value.userId,
sinceId: note.value.id,
}) : undefined),
};
}
}

function fetchNote() {
showPrev.value = false;
Expand Down
6 changes: 6 additions & 0 deletions packages/frontend/src/pages/settings/general.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkSwitch v-model="disableNyaize">{{ i18n.ts.noNyaization }} <span class="_beta">CherryPick</span></MkSwitch>
<MkSwitch v-model="checkMultipleRenote">{{ i18n.ts.showMultipleRenoteWarning }} <span class="_beta">yojo-art</span></MkSwitch>
</div>
<MkInput v-model="searchEngine" manualSave :spellcheck="false">
<template #label>{{ i18n.ts.search }}<span class="_beta" style="vertical-align: middle;">yojo-art</span></template>
<template #caption>{{ i18n.ts.searchEngineDescription }}</template>
</MkInput>
<MkSelect v-model="serverDisconnectedBehavior">
<template #label>{{ i18n.ts.whenServerDisconnected }} <span class="_beta" style="vertical-align: middle;">CherryPick</span></template>
<option value="reload">{{ i18n.ts._serverDisconnectedBehavior.reload }}</option>
Expand Down Expand Up @@ -161,6 +165,7 @@ import FormSection from '@/components/form/section.vue';
import FormLink from '@/components/form/link.vue';
import MkLink from '@/components/MkLink.vue';
import MkInfo from '@/components/MkInfo.vue';
import MkInput from '@/components/MkInput.vue';
import { defaultStore } from '@/store.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
Expand Down Expand Up @@ -201,6 +206,7 @@ const useAutoTranslate = computed(defaultStore.makeGetterSetter('useAutoTranslat
const welcomeBackToast = computed(defaultStore.makeGetterSetter('welcomeBackToast'));
const disableNyaize = computed(defaultStore.makeGetterSetter('disableNyaize'));
const checkMultipleRenote = computed(defaultStore.makeGetterSetter('checkMultipleRenote'));
const searchEngine = computed(defaultStore.makeGetterSetter('searchEngine'));

watch(lang, () => {
miLocalStorage.setItem('lang', lang.value as string);
Expand Down
4 changes: 4 additions & 0 deletions packages/frontend/src/pages/settings/preferences-backups.vue
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ const defaultStoreSaveKeys: (keyof typeof defaultStore['state'])[] = [
'showMoreButtonInNoteFooter',
'selectReaction',
// #endregion CherryPick
// #region yojo-art
'checkMultipleRenote',
'searchEngine',
// #endregion yojo-art
];
const coldDeviceStorageSaveKeys: (keyof typeof ColdDeviceStorage.default)[] = [
'lightTheme',
Expand Down
4 changes: 4 additions & 0 deletions packages/frontend/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'account',
default: [] as string[],
},
searchEngine: {
where: 'account',
default: 'https://www.google.com/search?q=%s',
},

menu: {
where: 'deviceAccount',
Expand Down

0 comments on commit 414d18f

Please sign in to comment.