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 59b3bd2a58
8 changed files with 59 additions and 50 deletions

View file

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

View file

@ -33,10 +33,10 @@ export function apiAccountMastodon(router: Router): void {
let acct = data.data;
acct.id = convertId(acct.id, IdType.MastodonId);
acct.url = `${BASE_URL}/@${acct.url}`;
acct.note = "";
acct.note = acct.note || "";
acct.avatar_static = acct.avatar;
acct.header = acct.header || "";
acct.header_static = acct.header || "";
acct.header = acct.header || "https://http.cat/404";
acct.header_static = acct.header || "https://http.cat/404";
acct.source = {
note: acct.note,
fields: acct.fields,
@ -338,8 +338,13 @@ export function apiAccountMastodon(router: Router): void {
ctx.body = [relationshipModel];
return;
}
let reqIds = [];
for (let i = 0; i < ids.length; i++) {
reqIds.push(convertId(ids[i], IdType.CalckeyId));
}
const data = await client.getRelationships(ids);
const data = await client.getRelationships(reqIds);
let resp = data.data;
for (let acctIdx = 0; acctIdx < resp.length; acctIdx++) {
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 data = await client.getStatusContext(id, limitToInt(ctx.query as any));
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}`,
);
const reactions: IReaction[] = reactionsAxios.data;

View file

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

View file

@ -10,11 +10,13 @@
<XNoteHeader class="header" :note="note" :mini="true"/>
<div class="body">
<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"/>
<XCwButton v-model="showContent" :note="note"/>
</p>
<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>
<MkNoteFooter :note="note" :directReplies="replies.length"></MkNoteFooter>
@ -22,10 +24,10 @@
</div>
<template v-if="conversation">
<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 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>
<div v-else-if="replies.length > 0" class="more">
<div class="line"></div>
@ -52,6 +54,7 @@ const router = useRouter();
const props = withDefaults(defineProps<{
note: misskey.entities.Note;
conversation?: misskey.entities.Note[];
parentId?;
// how many notes are in between this one and the note being viewed in detail
depth?: number;
@ -115,7 +118,10 @@ const replies: misskey.entities.Note[] = props.conversation?.filter(item => item
margin: 0;
padding: 0;
overflow-wrap: break-word;
> .reply-icon {
margin-right: 6px;
color: var(--accent);
}
> .text {
margin-right: 8px;
}

View file

@ -2,16 +2,13 @@
<div class="wrmlmaau" :class="{ collapsed, isLong }">
<div class="body">
<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"/>
<MkA v-if="note.renoteId" class="rp" :to="`/notes/${note.renoteId}`">{{ i18n.ts.quoteAttached }}: ...</MkA>
</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">
<XMediaList :media-list="note.files"/>
</div>
@ -19,6 +16,12 @@
<summary>{{ i18n.ts.poll }}</summary>
<XPoll :note="note"/>
</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">
<span>{{ i18n.ts.showMore }}</span>
</button>
@ -41,6 +44,7 @@ import { i18n } from '@/i18n';
const props = defineProps<{
note: misskey.entities.Note;
parentId?;
detailed?: boolean;
}>();
@ -60,7 +64,7 @@ const urls = props.note.text ? extractUrlFromMfm(mfm.parse(props.note.text)) : n
overflow-wrap: break-word;
> .body {
> .reply {
> .reply-icon {
margin-right: 6px;
color: var(--accent);
}

View file

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

View file

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