Merge branch 'develop' into acid-chicken-patch-1

This commit is contained in:
Acid Chicken (硫酸鶏) 2023-03-31 16:41:55 +09:00 committed by GitHub
commit 13a406b6cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
64 changed files with 4491 additions and 4444 deletions

View file

@ -11,15 +11,14 @@
"lint": "pnpm typecheck && pnpm eslint"
},
"dependencies": {
"@discordapp/twemoji": "14.0.2",
"@discordapp/twemoji": "14.1.2",
"@rollup/plugin-alias": "4.0.3",
"@rollup/plugin-json": "6.0.0",
"@rollup/pluginutils": "5.0.2",
"@syuilo/aiscript": "0.13.1",
"@tabler/icons-webfont": "2.10.0",
"@vitejs/plugin-vue": "4.0.0",
"@tabler/icons-webfont": "2.12.0",
"@vitejs/plugin-vue": "4.1.0",
"@vue/compiler-sfc": "3.2.47",
"autobind-decorator": "2.4.0",
"autosize": "5.0.2",
"blurhash": "2.0.5",
"broadcast-channel": "4.20.2",
@ -29,29 +28,29 @@
"chartjs-adapter-date-fns": "3.0.0",
"chartjs-chart-matrix": "2.0.1",
"chartjs-plugin-gradient": "0.6.1",
"chartjs-plugin-zoom": "2.0.0",
"chartjs-plugin-zoom": "2.0.1",
"compare-versions": "5.0.1",
"cropperjs": "2.0.0-beta.2",
"date-fns": "2.29.3",
"escape-regexp": "0.0.1",
"eventemitter3": "5.0.0",
"gsap": "3.11.4",
"gsap": "3.11.5",
"idb-keyval": "6.2.0",
"insert-text-at-cursor": "0.3.0",
"is-file-animated": "1.0.2",
"json5": "2.2.3",
"matter-js": "0.19.0",
"mfm-js": "0.23.3",
"misskey-js": "../misskey-js",
"photoswipe": "5.3.6",
"misskey-js": "workspace:*",
"photoswipe": "5.3.7",
"prismjs": "1.29.0",
"punycode": "2.3.0",
"querystring": "0.2.1",
"rndstr": "1.0.0",
"rollup": "3.19.0",
"rollup": "3.20.2",
"s-age": "1.1.2",
"sanitize-html": "2.10.0",
"sass": "1.58.3",
"sass": "1.60.0",
"seedrandom": "3.0.5",
"strict-event-emitter-types": "2.0.0",
"syuilo-password-strength": "0.0.1",
@ -59,13 +58,13 @@
"three": "0.150.1",
"throttle-debounce": "5.0.0",
"tinycolor2": "1.6.0",
"tsc-alias": "1.8.3",
"tsconfig-paths": "4.1.2",
"tsc-alias": "1.8.5",
"tsconfig-paths": "4.2.0",
"twemoji-parser": "14.0.0",
"typescript": "4.9.5",
"typescript": "5.0.2",
"uuid": "9.0.0",
"vanilla-tilt": "1.8.0",
"vite": "4.1.4",
"vite": "4.2.1",
"vue": "3.2.47",
"vue-plyr": "7.0.0",
"vue-prism-editor": "2.0.0-alpha.2",
@ -77,28 +76,28 @@
"@types/gulp": "4.0.10",
"@types/gulp-rename": "2.0.1",
"@types/matter-js": "0.18.2",
"@types/node": "18.15.0",
"@types/node": "18.15.11",
"@types/punycode": "2.1.0",
"@types/sanitize-html": "2.8.1",
"@types/sanitize-html": "2.9.0",
"@types/seedrandom": "3.0.5",
"@types/throttle-debounce": "5.0.0",
"@types/tinycolor2": "1.4.3",
"@types/uuid": "9.0.1",
"@types/websocket": "1.0.5",
"@types/ws": "8.5.4",
"@typescript-eslint/eslint-plugin": "5.54.1",
"@typescript-eslint/parser": "5.54.1",
"@vitest/coverage-c8": "^0.29.2",
"@typescript-eslint/eslint-plugin": "5.57.0",
"@typescript-eslint/parser": "5.57.0",
"@vitest/coverage-c8": "^0.29.8",
"@vue/runtime-core": "3.2.47",
"cross-env": "7.0.3",
"cypress": "12.7.0",
"eslint": "8.35.0",
"cypress": "12.9.0",
"eslint": "8.37.0",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-vue": "9.9.0",
"eslint-plugin-vue": "9.10.0",
"happy-dom": "8.9.0",
"start-server-and-test": "2.0.0",
"summaly": "github:misskey-dev/summaly",
"vitest": "^0.29.2",
"vitest": "^0.29.8",
"vitest-fetch-mock": "^0.2.2",
"vue-eslint-parser": "9.1.0",
"vue-tsc": "1.2.0"

View file

@ -169,6 +169,7 @@ const props = defineProps<{
}>();
const inChannel = inject('inChannel', null);
const currentClip = inject<Ref<misskey.entities.Clip> | null>('currentClip', null);
let note = $ref(deepClone(props.note));
@ -370,8 +371,6 @@ function undoReact(note): void {
});
}
const currentClipPage = inject<Ref<misskey.entities.Clip> | null>('currentClipPage', null);
function onContextmenu(ev: MouseEvent): void {
const isLink = (el: HTMLElement) => {
if (el.tagName === 'A') return true;
@ -386,18 +385,18 @@ function onContextmenu(ev: MouseEvent): void {
ev.preventDefault();
react();
} else {
os.contextMenu(getNoteMenu({ note: note, translating, translation, menuButton, isDeleted, currentClipPage }), ev).then(focus);
os.contextMenu(getNoteMenu({ note: note, translating, translation, menuButton, isDeleted, currentClip: currentClip?.value }), ev).then(focus);
}
}
function menu(viaKeyboard = false): void {
os.popupMenu(getNoteMenu({ note: note, translating, translation, menuButton, isDeleted, currentClipPage }), menuButton.value, {
os.popupMenu(getNoteMenu({ note: note, translating, translation, menuButton, isDeleted, currentClip: currentClip?.value }), menuButton.value, {
viaKeyboard,
}).then(focus);
}
async function clip() {
os.popupMenu(await getNoteClipMenu({ note: note, isDeleted, currentClipPage }), clipButton.value).then(focus);
os.popupMenu(await getNoteClipMenu({ note: note, isDeleted, currentClip: currentClip?.value }), clipButton.value).then(focus);
}
function showRenoteMenu(viaKeyboard = false): void {

View file

@ -19,7 +19,7 @@
:ad="true"
:class="$style.notes"
>
<XNote :key="note._featuredId_ || note._prId_ || note.id" :class="$style.note" :note="note"/>
<MkNote :key="note._featuredId_ || note._prId_ || note.id" :class="$style.note" :note="note"/>
</MkDateSeparatedList>
</div>
</template>
@ -28,7 +28,7 @@
<script lang="ts" setup>
import { shallowRef } from 'vue';
import XNote from '@/components/MkNote.vue';
import MkNote from '@/components/MkNote.vue';
import MkDateSeparatedList from '@/components/MkDateSeparatedList.vue';
import MkPagination, { Paging } from '@/components/MkPagination.vue';
import { i18n } from '@/i18n';

View file

@ -9,7 +9,7 @@
<template #default="{ items: notifications }">
<MkDateSeparatedList v-slot="{ item: notification }" :class="$style.list" :items="notifications" :no-gap="true">
<XNote v-if="['reply', 'quote', 'mention'].includes(notification.type)" :key="notification.id" :note="notification.note"/>
<MkNote v-if="['reply', 'quote', 'mention'].includes(notification.type)" :key="notification.id" :note="notification.note"/>
<XNotification v-else :key="notification.id" :notification="notification" :with-time="true" :full="true" class="_panel notification"/>
</MkDateSeparatedList>
</template>
@ -21,7 +21,7 @@ import { onUnmounted, onMounted, computed, shallowRef } from 'vue';
import MkPagination, { Paging } from '@/components/MkPagination.vue';
import XNotification from '@/components/MkNotification.vue';
import MkDateSeparatedList from '@/components/MkDateSeparatedList.vue';
import XNote from '@/components/MkNote.vue';
import MkNote from '@/components/MkNote.vue';
import { stream } from '@/stream';
import { $i } from '@/account';
import { i18n } from '@/i18n';

View file

@ -52,7 +52,7 @@
<input v-show="withHashtags" ref="hashtagsInputEl" v-model="hashtags" :class="$style.hashtags" :placeholder="i18n.ts.hashtags" list="hashtags">
<XPostFormAttaches v-model="files" :class="$style.attaches" @detach="detachFile" @change-sensitive="updateFileSensitive" @change-name="updateFileName"/>
<MkPollEditor v-if="poll" v-model="poll" @destroyed="poll = null"/>
<XNotePreview v-if="showPreview" :class="$style.preview" :text="text"/>
<MkNotePreview v-if="showPreview" :class="$style.preview" :text="text"/>
<div v-if="showingOptions" style="padding: 0 16px;">
<MkSelect v-model="reactionAcceptance" small>
<template #label>{{ i18n.ts.reactionAcceptance }}</template>
@ -87,7 +87,7 @@ import { toASCII } from 'punycode/';
import * as Acct from 'misskey-js/built/acct';
import MkSelect from './MkSelect.vue';
import MkNoteSimple from '@/components/MkNoteSimple.vue';
import XNotePreview from '@/components/MkNotePreview.vue';
import MkNotePreview from '@/components/MkNotePreview.vue';
import XPostFormAttaches from '@/components/MkPostFormAttaches.vue';
import MkPollEditor from '@/components/MkPollEditor.vue';
import { host, url } from '@/config';

View file

@ -3,7 +3,7 @@
ref="buttonEl"
v-ripple="canToggle"
class="_button"
:class="[$style.root, { [$style.reacted]: note.myReaction == reaction, [$style.canToggle]: canToggle }]"
:class="[$style.root, { [$style.reacted]: note.myReaction == reaction, [$style.canToggle]: canToggle, [$style.large]: defaultStore.state.largeNoteReactions }]"
@click="toggleReaction()"
>
<MkReactionIcon :class="$style.icon" :reaction="reaction" :emoji-url="note.reactionEmojis[reaction.substr(1, reaction.length - 2)]"/>
@ -118,6 +118,17 @@ useTooltip(buttonEl, async (showing) => {
cursor: default;
}
&.large {
height: 42px;
font-size: 1.5em;
border-radius: 6px;
> .count {
font-size: 0.7em;
line-height: 42px;
}
}
&.reacted {
background: var(--accent);

View file

@ -243,7 +243,7 @@ onUnmounted(() => {
display: flex;
align-items: center;
max-width: min(30vw, 400px);
overflow: auto;
overflow: clip;
white-space: nowrap;
text-align: left;
font-weight: bold;

View file

@ -1,21 +1,21 @@
<template>
<div class="voxdxuby">
<XNote v-if="note && !block.detailed" :key="note.id + ':normal'" v-model:note="note"/>
<XNoteDetailed v-if="note && block.detailed" :key="note.id + ':detail'" v-model:note="note"/>
<MkNote v-if="note && !block.detailed" :key="note.id + ':normal'" v-model:note="note"/>
<MkNoteDetailed v-if="note && block.detailed" :key="note.id + ':detail'" v-model:note="note"/>
</div>
</template>
<script lang="ts">
import { defineComponent, onMounted, PropType, Ref, ref } from 'vue';
import XNote from '@/components/MkNote.vue';
import XNoteDetailed from '@/components/MkNoteDetailed.vue';
import MkNote from '@/components/MkNote.vue';
import MkNoteDetailed from '@/components/MkNoteDetailed.vue';
import * as os from '@/os';
import { NoteBlock } from '@/scripts/hpml/block';
export default defineComponent({
components: {
XNote,
XNoteDetailed,
MkNote,
MkNoteDetailed,
},
props: {
block: {

View file

@ -1,5 +1,4 @@
import { defineAsyncComponent, Directive, ref } from 'vue';
import autobind from 'autobind-decorator';
import { popup } from '@/os';
export class UserPreview {
@ -15,9 +14,16 @@ export class UserPreview {
this.user = user;
this.attach();
this.show = this.show.bind(this);
this.close = this.close.bind(this);
this.onMouseover = this.onMouseover.bind(this);
this.onMouseleave = this.onMouseleave.bind(this);
this.onClick = this.onClick.bind(this);
this.attach = this.attach.bind(this);
this.detach = this.detach.bind(this);
}
@autobind
private show() {
if (!document.body.contains(this.el)) return;
if (this.promise) return;
@ -53,7 +59,6 @@ export class UserPreview {
}, 1000);
}
@autobind
private close() {
if (this.promise) {
window.clearInterval(this.checkTimer);
@ -62,34 +67,29 @@ export class UserPreview {
}
}
@autobind
private onMouseover() {
window.clearTimeout(this.showTimer);
window.clearTimeout(this.hideTimer);
this.showTimer = window.setTimeout(this.show, 500);
}
@autobind
private onMouseleave() {
window.clearTimeout(this.showTimer);
window.clearTimeout(this.hideTimer);
this.hideTimer = window.setTimeout(this.close, 500);
}
@autobind
private onClick() {
window.clearTimeout(this.showTimer);
this.close();
}
@autobind
public attach() {
this.el.addEventListener('mouseover', this.onMouseover);
this.el.addEventListener('mouseleave', this.onMouseleave);
this.el.addEventListener('click', this.onClick);
}
@autobind
public detach() {
this.el.removeEventListener('mouseover', this.onMouseover);
this.el.removeEventListener('mouseleave', this.onMouseleave);

View file

@ -2,7 +2,7 @@
<MkStickyContainer>
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
<MkSpacer :content-max="700">
<div class="_gaps_m">
<div v-if="channel" class="_gaps_m">
<MkInput v-model="name">
<template #label>{{ i18n.ts.name }}</template>
</MkInput>
@ -11,13 +11,37 @@
<template #label>{{ i18n.ts.description }}</template>
</MkTextarea>
<div class="banner">
<div>
<MkButton v-if="bannerId == null" @click="setBannerImage"><i class="ti ti-plus"></i> {{ i18n.ts._channel.setBanner }}</MkButton>
<div v-else-if="bannerUrl">
<img :src="bannerUrl" style="width: 100%;"/>
<MkButton @click="removeBannerImage()"><i class="ti ti-trash"></i> {{ i18n.ts._channel.removeBanner }}</MkButton>
</div>
</div>
<MkFolder :default-open="true">
<template #label>{{ i18n.ts.pinnedNotes }}</template>
<div class="_gaps">
<MkButton primary rounded @click="addPinnedNote()"><i class="ti ti-plus"></i></MkButton>
<Sortable
v-model="pinnedNotes"
item-key="id"
:handle="'.' + $style.pinnedNoteHandle"
:animation="150"
>
<template #item="{element,index}">
<div :class="$style.pinnedNote">
<button class="_button" :class="$style.pinnedNoteHandle"><i class="ti ti-menu"></i></button>
{{ element.id }}
<button class="_button" :class="$style.pinnedNoteRemove" @click="removePinnedNote(index)"><i class="ti ti-x"></i></button>
</div>
</template>
</Sortable>
</div>
</MkFolder>
<div>
<MkButton primary @click="save()"><i class="ti ti-device-floppy"></i> {{ channelId ? i18n.ts.save : i18n.ts.create }}</MkButton>
</div>
@ -27,7 +51,7 @@
</template>
<script lang="ts" setup>
import { computed, watch } from 'vue';
import { computed, ref, watch, defineAsyncComponent } from 'vue';
import MkTextarea from '@/components/MkTextarea.vue';
import MkButton from '@/components/MkButton.vue';
import MkInput from '@/components/MkInput.vue';
@ -36,6 +60,9 @@ import * as os from '@/os';
import { useRouter } from '@/router';
import { definePageMetadata } from '@/scripts/page-metadata';
import { i18n } from '@/i18n';
import MkFolder from '@/components/MkFolder.vue';
const Sortable = defineAsyncComponent(() => import('vuedraggable').then(x => x.default));
const router = useRouter();
@ -48,6 +75,7 @@ let name = $ref(null);
let description = $ref(null);
let bannerUrl = $ref<string | null>(null);
let bannerId = $ref<string | null>(null);
const pinnedNotes = ref([]);
watch(() => bannerId, async () => {
if (bannerId == null) {
@ -70,15 +98,36 @@ async function fetchChannel() {
description = channel.description;
bannerId = channel.bannerId;
bannerUrl = channel.bannerUrl;
pinnedNotes.value = channel.pinnedNoteIds.map(id => ({
id,
}));
}
fetchChannel();
async function addPinnedNote() {
const { canceled, result: value } = await os.inputText({
title: i18n.ts.noteIdOrUrl,
});
if (canceled) return;
const note = await os.apiWithDialog('notes/show', {
noteId: value.includes('/') ? value.split('/').pop() : value,
});
pinnedNotes.value = [{
id: note.id,
}, ...pinnedNotes.value];
}
function removePinnedNote(index: number) {
pinnedNotes.value.splice(index, 1);
}
function save() {
const params = {
name: name,
description: description,
bannerId: bannerId,
pinnedNoteIds: pinnedNotes.value.map(x => x.id),
};
if (props.channelId) {
@ -117,6 +166,32 @@ definePageMetadata(computed(() => props.channelId ? {
}));
</script>
<style lang="scss" scoped>
<style lang="scss" module>
.pinnedNote {
position: relative;
display: block;
line-height: 2.85rem;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
color: var(--navFg);
}
.pinnedNoteRemove {
position: absolute;
z-index: 10000;
width: 32px;
height: 32px;
color: #ff2a2a;
right: 8px;
opacity: 0.8;
}
.pinnedNoteHandle {
cursor: move;
width: 32px;
height: 32px;
margin: 0 8px;
opacity: 0.5;
}
</style>

View file

@ -16,6 +16,16 @@
<Mfm :text="channel.description" :is-note="false" :i="$i"/>
</div>
</div>
<MkButton v-if="favorited" v-tooltip="i18n.ts.unfavorite" as-like class="button" rounded primary @click="unfavorite()"><i class="ti ti-star"></i></MkButton>
<MkButton v-else v-tooltip="i18n.ts.favorite" as-like class="button" rounded @click="favorite()"><i class="ti ti-star"></i></MkButton>
<MkFoldableSection>
<template #header><i class="ti ti-pin ti-fw" style="margin-right: 0.5em;"></i>{{ i18n.ts.pinnedNotes }}</template>
<div v-if="channel.pinnedNotes.length > 0" class="_gaps">
<MkNote v-for="note in channel.pinnedNotes" :key="note.id" class="_panel" :note="note"/>
</div>
</MkFoldableSection>
</div>
<div v-if="channel && tab === 'timeline'" class="_gaps">
<!-- スマホタブレットの場合キーボードが表示されると投稿が見づらくなるのでデスクトップ場合のみ自動でフォーカスを当てる -->
@ -54,6 +64,8 @@ import MkNotes from '@/components/MkNotes.vue';
import { url } from '@/config';
import MkButton from '@/components/MkButton.vue';
import { defaultStore } from '@/store';
import MkNote from '@/components/MkNote.vue';
import MkFoldableSection from '@/components/MkFoldableSection.vue';
const router = useRouter();
@ -63,6 +75,7 @@ const props = defineProps<{
let tab = $ref('timeline');
let channel = $ref(null);
let favorited = $ref(false);
const featuredPagination = $computed(() => ({
endpoint: 'notes/featured' as const,
limit: 10,
@ -76,6 +89,7 @@ watch(() => props.channelId, async () => {
channel = await os.api('channels/show', {
channelId: props.channelId,
});
favorited = channel.isFavorited;
}, { immediate: true });
function edit() {
@ -90,6 +104,27 @@ function openPostForm() {
});
}
function favorite() {
os.apiWithDialog('channels/favorite', {
channelId: channel.id,
}).then(() => {
favorited = true;
});
}
async function unfavorite() {
const confirm = await os.confirm({
type: 'warning',
text: i18n.ts.unfavoriteConfirm,
});
if (confirm.canceled) return;
os.apiWithDialog('channels/unfavorite', {
channelId: channel.id,
}).then(() => {
favorited = false;
});
}
const headerActions = $computed(() => {
if (channel && channel.userId) {
const share = {

View file

@ -2,17 +2,22 @@
<MkStickyContainer>
<template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
<MkSpacer :content-max="700">
<div v-if="tab === 'featured'" class="grwlizim featured">
<div v-if="tab === 'featured'">
<MkPagination v-slot="{items}" :pagination="featuredPagination">
<MkChannelPreview v-for="channel in items" :key="channel.id" class="_margin" :channel="channel"/>
</MkPagination>
</div>
<div v-else-if="tab === 'following'" class="grwlizim following">
<div v-else-if="tab === 'favorites'">
<MkPagination v-slot="{items}" :pagination="favoritesPagination">
<MkChannelPreview v-for="channel in items" :key="channel.id" class="_margin" :channel="channel"/>
</MkPagination>
</div>
<div v-else-if="tab === 'following'">
<MkPagination v-slot="{items}" :pagination="followingPagination">
<MkChannelPreview v-for="channel in items" :key="channel.id" class="_margin" :channel="channel"/>
</MkPagination>
</div>
<div v-else-if="tab === 'owned'" class="grwlizim owned">
<div v-else-if="tab === 'owned'">
<MkButton class="new" @click="create()"><i class="ti ti-plus"></i></MkButton>
<MkPagination v-slot="{items}" :pagination="ownedPagination">
<MkChannelPreview v-for="channel in items" :key="channel.id" class="_margin" :channel="channel"/>
@ -39,13 +44,17 @@ const featuredPagination = {
endpoint: 'channels/featured' as const,
noPaging: true,
};
const favoritesPagination = {
endpoint: 'channels/my-favorites' as const,
limit: 100,
};
const followingPagination = {
endpoint: 'channels/followed' as const,
limit: 5,
limit: 10,
};
const ownedPagination = {
endpoint: 'channels/owned' as const,
limit: 5,
limit: 10,
};
function create() {
@ -62,10 +71,14 @@ const headerTabs = $computed(() => [{
key: 'featured',
title: i18n.ts._channel.featured,
icon: 'ti ti-comet',
}, {
key: 'favorites',
title: i18n.ts.favorites,
icon: 'ti ti-star',
}, {
key: 'following',
title: i18n.ts._channel.following,
icon: 'ti ti-heart',
icon: 'ti ti-eye',
}, {
key: 'owned',
title: i18n.ts._channel.owned,

View file

@ -57,7 +57,7 @@ watch(() => props.clipId, async () => {
immediate: true,
});
provide('currentClipPage', $$(clip));
provide('currentClip', $$(clip));
function favorite() {
os.apiWithDialog('clips/favorite', {

View file

@ -12,7 +12,7 @@
<template #default="{ items }">
<MkDateSeparatedList v-slot="{ item }" :items="items" :direction="'down'" :no-gap="false" :ad="false">
<XNote :key="item.id" :note="item.note" :class="$style.note"/>
<MkNote :key="item.id" :note="item.note" :class="$style.note"/>
</MkDateSeparatedList>
</template>
</MkPagination>
@ -22,7 +22,7 @@
<script lang="ts" setup>
import MkPagination from '@/components/MkPagination.vue';
import XNote from '@/components/MkNote.vue';
import MkNote from '@/components/MkNote.vue';
import MkDateSeparatedList from '@/components/MkDateSeparatedList.vue';
import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata';

View file

@ -13,7 +13,7 @@
<MkButton v-if="!showNext && hasNext" class="load next" @click="showNext = true"><i class="ti ti-chevron-up"></i></MkButton>
<div class="note _margin _gaps_s">
<MkRemoteCaution v-if="note.user.host != null" :href="note.url ?? note.uri"/>
<XNoteDetailed :key="note.id" v-model:note="note" class="note"/>
<MkNoteDetailed :key="note.id" v-model:note="note" class="note"/>
</div>
<div v-if="clips && clips.length > 0" class="clips _margin">
<div class="title">{{ i18n.ts.clip }}</div>
@ -41,7 +41,7 @@
<script lang="ts" setup>
import { computed, watch } from 'vue';
import * as misskey from 'misskey-js';
import XNoteDetailed from '@/components/MkNoteDetailed.vue';
import MkNoteDetailed from '@/components/MkNoteDetailed.vue';
import MkNotes from '@/components/MkNotes.vue';
import MkRemoteCaution from '@/components/MkRemoteCaution.vue';
import MkButton from '@/components/MkButton.vue';

View file

@ -10,8 +10,8 @@
</MkInput>
<MkSwitch v-model="props.modelValue.detailed"><span>{{ $ts._pages.blocks._note.detailed }}</span></MkSwitch>
<XNote v-if="note && !props.modelValue.detailed" :key="note.id + ':normal'" v-model:note="note" style="margin-bottom: 16px;"/>
<XNoteDetailed v-if="note && props.modelValue.detailed" :key="note.id + ':detail'" v-model:note="note" style="margin-bottom: 16px;"/>
<MkNote v-if="note && !props.modelValue.detailed" :key="note.id + ':normal'" v-model:note="note" style="margin-bottom: 16px;"/>
<MkNoteDetailed v-if="note && props.modelValue.detailed" :key="note.id + ':detail'" v-model:note="note" style="margin-bottom: 16px;"/>
</section>
</XContainer>
</template>
@ -22,8 +22,8 @@ import { watch } from 'vue';
import XContainer from '../page-editor.container.vue';
import MkInput from '@/components/MkInput.vue';
import MkSwitch from '@/components/MkSwitch.vue';
import XNote from '@/components/MkNote.vue';
import XNoteDetailed from '@/components/MkNoteDetailed.vue';
import MkNote from '@/components/MkNote.vue';
import MkNoteDetailed from '@/components/MkNoteDetailed.vue';
import * as os from '@/os';
const props = defineProps<{

View file

@ -56,6 +56,9 @@ import MkFoldableSection from '@/components/MkFoldableSection.vue';
import { $i } from '@/account';
import { instance } from '@/instance';
import MkInfo from '@/components/MkInfo.vue';
import { useRouter } from '@/router';
const router = useRouter();
const props = defineProps<{
query: string;
@ -84,6 +87,24 @@ async function search() {
if (query == null || query === '') return;
if (query.startsWith('https://')) {
const promise = os.api('ap/show', {
uri: query,
});
os.promiseDialog(promise, null, null, i18n.ts.fetchingAsApObject);
const res = await promise;
if (res.type === 'User') {
router.push(`/@${res.object.username}@${res.object.host}`);
} else if (res.type === 'Note') {
router.push(`/notes/${res.object.id}`);
}
return;
}
if (tab === 'note') {
notePagination = {
endpoint: 'notes/search',

View file

@ -48,6 +48,7 @@
<div class="_gaps_s">
<MkSwitch v-model="showNoteActionsOnlyHover">{{ i18n.ts.showNoteActionsOnlyHover }}</MkSwitch>
<MkSwitch v-model="showClipButtonInNoteFooter">{{ i18n.ts.showClipButtonInNoteFooter }}</MkSwitch>
<MkSwitch v-model="largeNoteReactions">{{ i18n.ts.largeNoteReactions }}</MkSwitch>
<MkSwitch v-model="collapseRenotes">{{ i18n.ts.collapseRenotes }}</MkSwitch>
<MkSwitch v-model="advancedMfm">{{ i18n.ts.enableAdvancedMfm }}</MkSwitch>
<MkSwitch v-if="advancedMfm" v-model="animatedMfm">{{ i18n.ts.enableAnimatedMfm }}</MkSwitch>
@ -145,6 +146,7 @@ const overridedDeviceKind = computed(defaultStore.makeGetterSetter('overridedDev
const serverDisconnectedBehavior = computed(defaultStore.makeGetterSetter('serverDisconnectedBehavior'));
const showNoteActionsOnlyHover = computed(defaultStore.makeGetterSetter('showNoteActionsOnlyHover'));
const showClipButtonInNoteFooter = computed(defaultStore.makeGetterSetter('showClipButtonInNoteFooter'));
const largeNoteReactions = computed(defaultStore.makeGetterSetter('largeNoteReactions'));
const collapseRenotes = computed(defaultStore.makeGetterSetter('collapseRenotes'));
const reduceAnimation = computed(defaultStore.makeGetterSetter('animation', v => !v, v => !v));
const useBlurEffectForModal = computed(defaultStore.makeGetterSetter('useBlurEffectForModal'));

View file

@ -83,7 +83,7 @@ async function chooseAntenna(ev: MouseEvent): Promise<void> {
}
async function chooseChannel(ev: MouseEvent): Promise<void> {
const channels = await os.api('channels/followed', {
const channels = await os.api('channels/my-favorites', {
limit: 100,
});
const items = channels.map(channel => ({

View file

@ -93,7 +93,7 @@
<div class="contents _gaps">
<div v-if="user.pinnedNotes.length > 0" class="_gaps">
<XNote v-for="note in user.pinnedNotes" :key="note.id" class="note _panel" :note="note" :pinned="true"/>
<MkNote v-for="note in user.pinnedNotes" :key="note.id" class="note _panel" :note="note" :pinned="true"/>
</div>
<MkInfo v-else-if="$i && $i.id === user.id">{{ i18n.ts.userPagePinTip }}</MkInfo>
<template v-if="narrow">
@ -115,7 +115,7 @@
import { defineAsyncComponent, computed, onMounted, onUnmounted } from 'vue';
import calcAge from 's-age';
import * as misskey from 'misskey-js';
import XNote from '@/components/MkNote.vue';
import MkNote from '@/components/MkNote.vue';
import MkFollowButton from '@/components/MkFollowButton.vue';
import MkRemoteCaution from '@/components/MkRemoteCaution.vue';
import MkOmit from '@/components/MkOmit.vue';

View file

@ -38,12 +38,12 @@
<script lang="ts">
import { defineComponent } from 'vue';
import { toUnicode } from 'punycode/';
import XTimeline from './welcome.timeline.vue';
import XSigninDialog from '@/components/MkSigninDialog.vue';
import XSignupDialog from '@/components/MkSignupDialog.vue';
import MkButton from '@/components/MkButton.vue';
import XNote from '@/components/MkNote.vue';
import MkNote from '@/components/MkNote.vue';
import MkFeaturedPhotos from '@/components/MkFeaturedPhotos.vue';
import XTimeline from './welcome.timeline.vue';
import { host, instanceName } from '@/config';
import * as os from '@/os';
import number from '@/filters/number';
@ -51,7 +51,7 @@ import number from '@/filters/number';
export default defineComponent({
components: {
MkButton,
XNote,
MkNote,
XTimeline,
MkFeaturedPhotos,
},
@ -118,7 +118,7 @@ export default defineComponent({
text: this.$ts.help,
icon: 'ti ti-question-circle',
action: () => {
window.open(`https://misskey-hub.net/help.md`, '_blank');
window.open('https://misskey-hub.net/help.md', '_blank');
},
}], ev.currentTarget ?? ev.target);
},

View file

@ -61,7 +61,7 @@ import { toUnicode } from 'punycode/';
import XSigninDialog from '@/components/MkSigninDialog.vue';
import XSignupDialog from '@/components/MkSignupDialog.vue';
import MkButton from '@/components/MkButton.vue';
import XNote from '@/components/MkNote.vue';
import MkNote from '@/components/MkNote.vue';
import MkFeaturedPhotos from '@/components/MkFeaturedPhotos.vue';
import XTimeline from './welcome.timeline.vue';
import { host, instanceName } from '@/config';
@ -71,7 +71,7 @@ import number from '@/filters/number';
export default defineComponent({
components: {
MkButton,
XNote,
MkNote,
MkFeaturedPhotos,
XTimeline,
},

View file

@ -15,7 +15,7 @@ import { clipsCache } from '@/cache';
export async function getNoteClipMenu(props: {
note: misskey.entities.Note;
isDeleted: Ref<boolean>;
currentClipPage?: Ref<misskey.entities.Clip>;
currentClip?: misskey.entities.Clip;
}) {
const isRenote = (
props.note.renote != null &&
@ -42,7 +42,7 @@ export async function getNoteClipMenu(props: {
});
if (!confirm.canceled) {
os.apiWithDialog('clips/remove-note', { clipId: clip.id, noteId: appearNote.id });
if (props.currentClipPage?.value.id === clip.id) props.isDeleted.value = true;
if (props.currentClip?.id === clip.id) props.isDeleted.value = true;
}
} else {
os.alert({
@ -92,7 +92,7 @@ export function getNoteMenu(props: {
translation: Ref<any>;
translating: Ref<boolean>;
isDeleted: Ref<boolean>;
currentClipPage?: Ref<misskey.entities.Clip>;
currentClip?: misskey.entities.Clip;
}) {
const isRenote = (
props.note.renote != null &&
@ -176,7 +176,7 @@ export function getNoteMenu(props: {
}
async function unclip(): Promise<void> {
os.apiWithDialog('clips/remove-note', { clipId: props.currentClipPage.value.id, noteId: appearNote.id });
os.apiWithDialog('clips/remove-note', { clipId: props.currentClip.id, noteId: appearNote.id });
props.isDeleted.value = true;
}
@ -230,7 +230,7 @@ export function getNoteMenu(props: {
menu = [
...(
props.currentClipPage?.value.userId === $i.id ? [{
props.currentClip?.userId === $i.id ? [{
icon: 'ti ti-backspace',
text: i18n.ts.unclip,
danger: true,
@ -294,7 +294,7 @@ export function getNoteMenu(props: {
text: i18n.ts.muteThread,
action: () => toggleThreadMute(true),
}),
appearNote.userId === $i.id ? ($i.pinnedNoteIds || []).includes(appearNote.id) ? {
appearNote.userId === $i.id ? ($i.pinnedNoteIds ?? []).includes(appearNote.id) ? {
icon: 'ti ti-pinned-off',
text: i18n.ts.unpin,
action: () => togglePin(false),

View file

@ -1,4 +1,3 @@
import autobind from 'autobind-decorator';
import { ref, Ref, unref } from 'vue';
import { collectPageVars } from '../collect-page-vars';
import { initHpmlLib } from './lib';
@ -51,7 +50,6 @@ export class Hpml {
this.eval();
}
@autobind
public eval() {
try {
this.vars.value = this.evaluateVars();
@ -60,7 +58,6 @@ export class Hpml {
}
}
@autobind
public interpolate(str: string) {
if (str == null) return null;
return str.replace(/{(.+?)}/g, match => {
@ -69,12 +66,10 @@ export class Hpml {
});
}
@autobind
public registerCanvas(id: string, canvas: any) {
this.canvases[id] = canvas;
}
@autobind
public updatePageVar(name: string, value: any) {
const pageVar = this.pageVars.find(v => v.name === name);
if (pageVar !== undefined) {
@ -84,13 +79,11 @@ export class Hpml {
}
}
@autobind
public updateRandomSeed(seed: string) {
this.opts.randomSeed = seed;
this.envVars.SEED = seed;
}
@autobind
private _interpolateScope(str: string, scope: HpmlScope) {
return str.replace(/{(.+?)}/g, match => {
const v = scope.getState(match.slice(1, -1).trim());
@ -98,7 +91,6 @@ export class Hpml {
});
}
@autobind
public evaluateVars(): Record<string, any> {
const values: Record<string, any> = {};
@ -117,7 +109,6 @@ export class Hpml {
return values;
}
@autobind
private evaluate(expr: Expr, scope: HpmlScope): any {
if (isLiteralValue(expr)) {
if (expr.type === null) {

View file

@ -2,7 +2,6 @@
* Hpml
*/
import autobind from 'autobind-decorator';
import { Hpml } from './evaluator';
import { funcDefs } from './lib';
@ -61,7 +60,6 @@ export class HpmlScope {
this.name = name ?? 'anonymous';
}
@autobind
public createChildScope(states: Record<string, any>, name?: HpmlScope['name']): HpmlScope {
const layer = [states, ...this.layerdStates];
return new HpmlScope(layer, name);
@ -71,7 +69,6 @@ export class HpmlScope {
*
* @param name
*/
@autobind
public getState(name: string): any {
for (const later of this.layerdStates) {
const state = later[name];

View file

@ -1,4 +1,3 @@
import autobind from 'autobind-decorator';
import { isLiteralValue } from './expr';
import { funcDefs } from './lib';
import { envVarsDef } from '.';
@ -23,7 +22,6 @@ export class HpmlTypeChecker {
this.pageVars = pageVars;
}
@autobind
public typeCheck(v: Expr): TypeError | null {
if (isLiteralValue(v)) return null;
@ -61,7 +59,6 @@ export class HpmlTypeChecker {
return null;
}
@autobind
public getExpectedType(v: Expr, slot: number): Type {
const def = funcDefs[v.type ?? ''];
if (def == null) {
@ -89,7 +86,6 @@ export class HpmlTypeChecker {
}
}
@autobind
public infer(v: Expr): Type {
if (v.type === null) return null;
if (v.type === 'text') return 'string';
@ -144,7 +140,6 @@ export class HpmlTypeChecker {
}
}
@autobind
public getVarByName(name: string): Variable {
const v = this.variables.find(x => x.name === name);
if (v !== undefined) {
@ -154,25 +149,21 @@ export class HpmlTypeChecker {
}
}
@autobind
public getVarsByType(type: Type): Variable[] {
if (type == null) return this.variables;
return this.variables.filter(x => (this.infer(x) === null) || (this.infer(x) === type));
}
@autobind
public getEnvVarsByType(type: Type): string[] {
if (type == null) return Object.keys(envVarsDef);
return Object.entries(envVarsDef).filter(([k, v]) => v === null || type === v).map(([k, v]) => k);
}
@autobind
public getPageVarsByType(type: Type): string[] {
if (type == null) return this.pageVars.map(v => v.name);
return this.pageVars.filter(v => type === v.type).map(v => v.name);
}
@autobind
public isUsedName(name: string) {
if (this.variables.some(v => v.name === name)) {
return true;

View file

@ -294,6 +294,10 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'device',
default: false,
},
largeNoteReactions: {
where: 'device',
default: false,
},
aiChanMode: {
where: 'device',
default: false,