chore: 🎨 format
This commit is contained in:
parent
e4e5ada060
commit
97d395ce2a
@ -8,7 +8,11 @@ import { apiTimelineMastodon } from "./endpoints/timeline.js";
|
|||||||
import { apiNotificationsMastodon } from "./endpoints/notifications.js";
|
import { apiNotificationsMastodon } from "./endpoints/notifications.js";
|
||||||
import { apiSearchMastodon } from "./endpoints/search.js";
|
import { apiSearchMastodon } from "./endpoints/search.js";
|
||||||
import { getInstance } from "./endpoints/meta.js";
|
import { getInstance } from "./endpoints/meta.js";
|
||||||
import {convertAccount, convertAnnouncement, convertFilter} from "./converters.js";
|
import {
|
||||||
|
convertAccount,
|
||||||
|
convertAnnouncement,
|
||||||
|
convertFilter,
|
||||||
|
} from "./converters.js";
|
||||||
import { convertId, IdType } from "../index.js";
|
import { convertId, IdType } from "../index.js";
|
||||||
import { Users } from "@/models/index.js";
|
import { Users } from "@/models/index.js";
|
||||||
import { IsNull } from "typeorm";
|
import { IsNull } from "typeorm";
|
||||||
@ -55,15 +59,18 @@ export function apiMastodonCompatible(router: Router): void {
|
|||||||
try {
|
try {
|
||||||
const data = await client.getInstance();
|
const data = await client.getInstance();
|
||||||
const admin = await Users.findOne({
|
const admin = await Users.findOne({
|
||||||
where: {
|
where: {
|
||||||
host: IsNull(),
|
host: IsNull(),
|
||||||
isAdmin: true,
|
isAdmin: true,
|
||||||
isDeleted: false,
|
isDeleted: false,
|
||||||
isSuspended: false,
|
isSuspended: false,
|
||||||
},
|
},
|
||||||
order: { id: "ASC" },
|
order: { id: "ASC" },
|
||||||
});
|
});
|
||||||
const contact = admin == null ? null : convertAccount((await client.getAccount(admin.id)).data);
|
const contact =
|
||||||
|
admin == null
|
||||||
|
? null
|
||||||
|
: convertAccount((await client.getAccount(admin.id)).data);
|
||||||
ctx.body = await getInstance(data.data, contact);
|
ctx.body = await getInstance(data.data, contact);
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
@ -5,13 +5,15 @@ import { Users, Notes } from "@/models/index.js";
|
|||||||
import { IsNull } from "typeorm";
|
import { IsNull } from "typeorm";
|
||||||
import { MAX_NOTE_TEXT_LENGTH, FILE_TYPE_BROWSERSAFE } from "@/const.js";
|
import { MAX_NOTE_TEXT_LENGTH, FILE_TYPE_BROWSERSAFE } from "@/const.js";
|
||||||
|
|
||||||
export async function getInstance(response: Entity.Instance, contact: Entity.Account) {
|
export async function getInstance(
|
||||||
const [meta, totalUsers, totalStatuses] =
|
response: Entity.Instance,
|
||||||
await Promise.all([
|
contact: Entity.Account,
|
||||||
fetchMeta(true),
|
) {
|
||||||
Users.count({ where: { host: IsNull() } }),
|
const [meta, totalUsers, totalStatuses] = await Promise.all([
|
||||||
Notes.count({ where: { userHost: IsNull() } }),
|
fetchMeta(true),
|
||||||
]);
|
Users.count({ where: { host: IsNull() } }),
|
||||||
|
Notes.count({ where: { userHost: IsNull() } }),
|
||||||
|
]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
uri: response.uri,
|
uri: response.uri,
|
||||||
|
@ -104,13 +104,16 @@
|
|||||||
v-for="user in items"
|
v-for="user in items"
|
||||||
:key="user.id"
|
:key="user.id"
|
||||||
v-tooltip.mfm="
|
v-tooltip.mfm="
|
||||||
user.updatedAt ? `Last posted: ${new Date(
|
user.updatedAt
|
||||||
user.updatedAt,
|
? `Last posted: ${new Date(
|
||||||
).toLocaleString()}` : 'Never posted'
|
user.updatedAt,
|
||||||
|
).toLocaleString()}`
|
||||||
|
: 'Never posted'
|
||||||
"
|
"
|
||||||
class="user"
|
class="user"
|
||||||
:user="user"
|
:user="user"
|
||||||
:show-about-page="true" />
|
:show-about-page="true"
|
||||||
|
/>
|
||||||
</MkPagination>
|
</MkPagination>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -45,7 +45,9 @@
|
|||||||
<div class="about">
|
<div class="about">
|
||||||
<div
|
<div
|
||||||
class="desc"
|
class="desc"
|
||||||
v-html="meta.description || i18n.ts.headlineFirefish"
|
v-html="
|
||||||
|
meta.description || i18n.ts.headlineFirefish
|
||||||
|
"
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="action">
|
<div class="action">
|
||||||
|
Loading…
Reference in New Issue
Block a user