Merge branch 'develop' of codeberg.org:calckey/calckey into develop

This commit is contained in:
ThatOneCalculator 2023-03-19 00:12:33 -07:00
commit 681cefcda5
No known key found for this signature in database
GPG Key ID: 8703CACD01000000
8 changed files with 59 additions and 50 deletions

View File

@ -81,7 +81,7 @@
"koa-send": "5.0.1", "koa-send": "5.0.1",
"koa-slow": "2.1.0", "koa-slow": "2.1.0",
"koa-views": "7.0.2", "koa-views": "7.0.2",
"@calckey/megalodon": "5.1.2", "@calckey/megalodon": "5.1.21",
"mfm-js": "0.23.2", "mfm-js": "0.23.2",
"mime-types": "2.1.35", "mime-types": "2.1.35",
"multer": "1.4.4-lts.1", "multer": "1.4.4-lts.1",

View File

@ -33,10 +33,10 @@ export function apiAccountMastodon(router: Router): void {
let acct = data.data; let acct = data.data;
acct.id = convertId(acct.id, IdType.MastodonId); acct.id = convertId(acct.id, IdType.MastodonId);
acct.url = `${BASE_URL}/@${acct.url}`; acct.url = `${BASE_URL}/@${acct.url}`;
acct.note = ""; acct.note = acct.note || "";
acct.avatar_static = acct.avatar; acct.avatar_static = acct.avatar;
acct.header = acct.header || ""; acct.header = acct.header || "https://http.cat/404";
acct.header_static = acct.header || ""; acct.header_static = acct.header || "https://http.cat/404";
acct.source = { acct.source = {
note: acct.note, note: acct.note,
fields: acct.fields, fields: acct.fields,
@ -339,7 +339,12 @@ export function apiAccountMastodon(router: Router): void {
return; return;
} }
const data = await client.getRelationships(ids); let reqIds = [];
for (let i = 0; i < ids.length; i++) {
reqIds.push(convertId(ids[i], IdType.CalckeyId));
}
const data = await client.getRelationships(reqIds);
let resp = data.data; let resp = data.data;
for (let acctIdx = 0; acctIdx < resp.length; acctIdx++) { for (let acctIdx = 0; acctIdx < resp.length; acctIdx++) {
resp[acctIdx].id = convertId(resp[acctIdx].id, IdType.MastodonId); resp[acctIdx].id = convertId(resp[acctIdx].id, IdType.MastodonId);

View File

@ -105,7 +105,12 @@ export function apiStatusMastodon(router: Router): void {
const id = ctx.params.id; const id = ctx.params.id;
const data = await client.getStatusContext(id, limitToInt(ctx.query as any)); const data = await client.getStatusContext(id, limitToInt(ctx.query as any));
const status = await client.getStatus(id); const status = await client.getStatus(id);
const reactionsAxios = await axios.get( let reqInstance = axios.create({
headers: {
Authorization : ctx.headers.authorization
}
});
const reactionsAxios = await reqInstance.get(
`${BASE_URL}/api/notes/reactions?noteId=${id}`, `${BASE_URL}/api/notes/reactions?noteId=${id}`,
); );
const reactions: IReaction[] = reactionsAxios.data; const reactions: IReaction[] = reactionsAxios.data;

View File

@ -301,7 +301,7 @@ if (appearNote.replyId) {
os.api('notes/conversation', { os.api('notes/conversation', {
noteId: appearNote.replyId, noteId: appearNote.replyId,
}).then(res => { }).then(res => {
conversation.value = res; conversation.value = res.reverse();
}); });
} }

View File

@ -10,11 +10,13 @@
<XNoteHeader class="header" :note="note" :mini="true"/> <XNoteHeader class="header" :note="note" :mini="true"/>
<div class="body"> <div class="body">
<p v-if="note.cw != null" class="cw"> <p v-if="note.cw != null" class="cw">
<i v-if="note.replyId" class="ph-arrow-bend-up-left ph-bold ph-lg reply-icon"></i>
<i v-if="note.renoteId != parentId" class="ph-quotes ph-bold ph-lg reply-icon"></i>
<Mfm v-if="note.cw != ''" class="text" :text="note.cw" :author="note.user" :i="$i" :custom-emojis="note.emojis"/> <Mfm v-if="note.cw != ''" class="text" :text="note.cw" :author="note.user" :i="$i" :custom-emojis="note.emojis"/>
<XCwButton v-model="showContent" :note="note"/> <XCwButton v-model="showContent" :note="note"/>
</p> </p>
<div v-show="note.cw == null || showContent" class="content" @click="router.push(notePage(note))"> <div v-show="note.cw == null || showContent" class="content" @click="router.push(notePage(note))">
<MkSubNoteContent class="text" :note="note" :detailed="true"/> <MkSubNoteContent class="text" :note="note" :detailed="true" :parentId="note.parentId"/>
</div> </div>
</div> </div>
<MkNoteFooter :note="note" :directReplies="replies.length"></MkNoteFooter> <MkNoteFooter :note="note" :directReplies="replies.length"></MkNoteFooter>
@ -22,10 +24,10 @@
</div> </div>
<template v-if="conversation"> <template v-if="conversation">
<template v-if="replies.length == 1"> <template v-if="replies.length == 1">
<MkNoteSub v-for="reply in replies" :key="reply.id" :note="reply" class="reply single" :conversation="conversation" :depth="depth"/> <MkNoteSub v-for="reply in replies" :key="reply.id" :note="reply" class="reply single" :conversation="conversation" :depth="depth" :parentId="note.replyId"/>
</template> </template>
<template v-else-if="depth < 5"> <template v-else-if="depth < 5">
<MkNoteSub v-for="reply in replies" :key="reply.id" :note="reply" class="reply" :conversation="conversation" :depth="depth + 1"/> <MkNoteSub v-for="reply in replies" :key="reply.id" :note="reply" class="reply" :conversation="conversation" :depth="depth + 1" :parentId="note.replyId"/>
</template> </template>
<div v-else-if="replies.length > 0" class="more"> <div v-else-if="replies.length > 0" class="more">
<div class="line"></div> <div class="line"></div>
@ -52,6 +54,7 @@ const router = useRouter();
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
note: misskey.entities.Note; note: misskey.entities.Note;
conversation?: misskey.entities.Note[]; conversation?: misskey.entities.Note[];
parentId?;
// how many notes are in between this one and the note being viewed in detail // how many notes are in between this one and the note being viewed in detail
depth?: number; depth?: number;
@ -115,7 +118,10 @@ const replies: misskey.entities.Note[] = props.conversation?.filter(item => item
margin: 0; margin: 0;
padding: 0; padding: 0;
overflow-wrap: break-word; overflow-wrap: break-word;
> .reply-icon {
margin-right: 6px;
color: var(--accent);
}
> .text { > .text {
margin-right: 8px; margin-right: 8px;
} }

View File

@ -2,16 +2,13 @@
<div class="wrmlmaau" :class="{ collapsed, isLong }"> <div class="wrmlmaau" :class="{ collapsed, isLong }">
<div class="body"> <div class="body">
<span v-if="note.deletedAt" style="opacity: 0.5">({{ i18n.ts.deleted }})</span> <span v-if="note.deletedAt" style="opacity: 0.5">({{ i18n.ts.deleted }})</span>
<MkA v-if="note.replyId" class="reply" :to="`/notes/${note.replyId}`"><i class="ph-arrow-bend-up-left ph-bold ph-lg"></i></MkA> <template v-if="!note.cw">
<i v-if="note.replyId" class="ph-arrow-bend-up-left ph-bold ph-lg reply-icon"></i>
<i v-if="note.renoteId != parentId" class="ph-quotes ph-bold ph-lg reply-icon"></i>
</template>
<Mfm v-if="note.text" :text="note.text" :author="note.user" :i="$i" :custom-emojis="note.emojis"/> <Mfm v-if="note.text" :text="note.text" :author="note.user" :i="$i" :custom-emojis="note.emojis"/>
<MkA v-if="note.renoteId" class="rp" :to="`/notes/${note.renoteId}`">{{ i18n.ts.quoteAttached }}: ...</MkA> <MkA v-if="note.renoteId" class="rp" :to="`/notes/${note.renoteId}`">{{ i18n.ts.quoteAttached }}: ...</MkA>
</div> </div>
<template v-if="detailed">
<!-- <div v-if="note.renoteId" class="renote">
<XNoteSimple :note="note.renote"/>
</div> -->
<MkUrlPreview v-for="url in urls" :key="url" :url="url" :compact="true" :detail="false" class="url-preview"/>
</template>
<div v-if="note.files.length > 0"> <div v-if="note.files.length > 0">
<XMediaList :media-list="note.files"/> <XMediaList :media-list="note.files"/>
</div> </div>
@ -19,6 +16,12 @@
<summary>{{ i18n.ts.poll }}</summary> <summary>{{ i18n.ts.poll }}</summary>
<XPoll :note="note"/> <XPoll :note="note"/>
</div> </div>
<template v-if="detailed">
<!-- <div v-if="note.renoteId" class="renote">
<XNoteSimple :note="note.renote"/>
</div> -->
<MkUrlPreview v-for="url in urls" :key="url" :url="url" :compact="true" :detail="false" class="url-preview"/>
</template>
<button v-if="isLong && collapsed" class="fade _button" @click.stop="collapsed = false"> <button v-if="isLong && collapsed" class="fade _button" @click.stop="collapsed = false">
<span>{{ i18n.ts.showMore }}</span> <span>{{ i18n.ts.showMore }}</span>
</button> </button>
@ -41,6 +44,7 @@ import { i18n } from '@/i18n';
const props = defineProps<{ const props = defineProps<{
note: misskey.entities.Note; note: misskey.entities.Note;
parentId?;
detailed?: boolean; detailed?: boolean;
}>(); }>();
@ -60,7 +64,7 @@ const urls = props.note.text ? extractUrlFromMfm(mfm.parse(props.note.text)) : n
overflow-wrap: break-word; overflow-wrap: break-word;
> .body { > .body {
> .reply { > .reply-icon {
margin-right: 6px; margin-right: 6px;
color: var(--accent); color: var(--accent);
} }

View File

@ -51,13 +51,6 @@ const props = defineProps<{
let channel = $ref(null); let channel = $ref(null);
let showBanner = $ref(true); let showBanner = $ref(true);
const pagination = {
endpoint: 'channels/timeline' as const,
limit: 10,
params: computed(() => ({
channelId: props.channelId,
})),
};
watch(() => props.channelId, async () => { watch(() => props.channelId, async () => {
channel = await os.api('channels/show', { channel = await os.api('channels/show', {
@ -66,14 +59,23 @@ watch(() => props.channelId, async () => {
}, { immediate: true }); }, { immediate: true });
function edit() { function edit() {
router.push(`/channels/${channel.id}/edit`); router.push(`/channels/${channel?.id}/edit`);
} }
const headerActions = $computed(() => channel && channel.userId ? [{ const headerActions = $computed(() => [
...(
channel
&& channel?.userId === $i?.id
? [
{
icon: 'ph-gear-six ph-bold ph-lg', icon: 'ph-gear-six ph-bold ph-lg',
text: i18n.ts.edit, text: i18n.ts.edit,
handler: edit, handler: edit,
}] : null); }
]
: []
),
]);
const headerTabs = $computed(() => []); const headerTabs = $computed(() => []);

View File

@ -55,7 +55,7 @@ importers:
'@bull-board/api': ^4.6.4 '@bull-board/api': ^4.6.4
'@bull-board/koa': ^4.6.4 '@bull-board/koa': ^4.6.4
'@bull-board/ui': ^4.6.4 '@bull-board/ui': ^4.6.4
'@calckey/megalodon': 5.1.2 '@calckey/megalodon': 5.1.21
'@discordapp/twemoji': 14.0.2 '@discordapp/twemoji': 14.0.2
'@elastic/elasticsearch': 7.17.0 '@elastic/elasticsearch': 7.17.0
'@koa/cors': 3.4.3 '@koa/cors': 3.4.3
@ -224,7 +224,7 @@ importers:
'@bull-board/api': 4.10.2 '@bull-board/api': 4.10.2
'@bull-board/koa': 4.10.2_6tybghmia4wsnt33xeid7y4rby '@bull-board/koa': 4.10.2_6tybghmia4wsnt33xeid7y4rby
'@bull-board/ui': 4.10.2 '@bull-board/ui': 4.10.2
'@calckey/megalodon': 5.1.2 '@calckey/megalodon': 5.1.21
'@discordapp/twemoji': 14.0.2 '@discordapp/twemoji': 14.0.2
'@elastic/elasticsearch': 7.17.0 '@elastic/elasticsearch': 7.17.0
'@koa/cors': 3.4.3 '@koa/cors': 3.4.3
@ -759,8 +759,8 @@ packages:
'@bull-board/api': 4.10.2 '@bull-board/api': 4.10.2
dev: false dev: false
/@calckey/megalodon/5.1.2: /@calckey/megalodon/5.1.21:
resolution: {integrity: sha512-bUjPOfASy8X2NxdBvYDOWN9Rw/KdkfbTxy5vMQBcrGXepFbT4M+00blEYNc00Uu/epwH9YoNqpQC8PKQr/WU4w==} resolution: {integrity: sha512-wThdyNb/UofklvYzyeFNQwxJNHqaSLD+z0glQLzV1tmAvSB0EZOL0D15dvpdB0LED0Q2rpJlwaonejkTI9JQhA==}
engines: {node: '>=15.0.0'} engines: {node: '>=15.0.0'}
dependencies: dependencies:
'@types/oauth': 0.9.1 '@types/oauth': 0.9.1
@ -3402,7 +3402,7 @@ packages:
/axios/0.25.0_debug@4.3.4: /axios/0.25.0_debug@4.3.4:
resolution: {integrity: sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==} resolution: {integrity: sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==}
dependencies: dependencies:
follow-redirects: 1.15.2_debug@4.3.4 follow-redirects: 1.15.2
transitivePeerDependencies: transitivePeerDependencies:
- debug - debug
dev: true dev: true
@ -6407,19 +6407,6 @@ packages:
peerDependenciesMeta: peerDependenciesMeta:
debug: debug:
optional: true optional: true
dev: false
/follow-redirects/1.15.2_debug@4.3.4:
resolution: {integrity: sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==}
engines: {node: '>=4.0'}
peerDependencies:
debug: '*'
peerDependenciesMeta:
debug:
optional: true
dependencies:
debug: 4.3.4
dev: true
/for-each/0.3.3: /for-each/0.3.3:
resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==}