2023-06-03 08:28:21 +02:00
|
|
|
import * as JSON5 from "json5";
|
2023-01-13 05:40:33 +01:00
|
|
|
import { IsNull, MoreThan } from "typeorm";
|
|
|
|
import config from "@/config/index.js";
|
|
|
|
import { fetchMeta } from "@/misc/fetch-meta.js";
|
|
|
|
import { Ads, Emojis, Users } from "@/models/index.js";
|
2023-03-04 15:16:20 +01:00
|
|
|
import { MAX_NOTE_TEXT_LENGTH, MAX_CAPTION_TEXT_LENGTH } from "@/const.js";
|
2023-01-13 05:40:33 +01:00
|
|
|
import define from "../define.js";
|
2016-12-28 23:49:51 +01:00
|
|
|
|
2018-10-08 18:01:48 +02:00
|
|
|
export const meta = {
|
2023-01-13 05:40:33 +01:00
|
|
|
tags: ["meta"],
|
2019-02-23 03:20:58 +01:00
|
|
|
|
2022-01-18 14:27:10 +01:00
|
|
|
requireCredential: false,
|
2018-10-08 18:01:48 +02:00
|
|
|
|
2019-02-24 19:21:54 +01:00
|
|
|
res: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "object",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2019-02-24 19:21:54 +01:00
|
|
|
properties: {
|
2021-03-06 14:34:11 +01:00
|
|
|
maintainerName: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: true,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
maintainerEmail: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: true,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
2019-02-24 19:21:54 +01:00
|
|
|
version: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-12-09 15:58:30 +01:00
|
|
|
example: config.version,
|
2019-02-24 19:21:54 +01:00
|
|
|
},
|
|
|
|
name: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2019-02-24 19:21:54 +01:00
|
|
|
},
|
2021-03-06 14:34:11 +01:00
|
|
|
uri: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
|
|
|
format: "url",
|
|
|
|
example: "https://calckey.example.com",
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
description: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: true,
|
2019-02-24 19:21:54 +01:00
|
|
|
},
|
2021-03-06 14:34:11 +01:00
|
|
|
langs: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "array",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
items: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-12-09 15:58:30 +01:00
|
|
|
},
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
tosUrl: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: true,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
repositoryUrl: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2023-01-20 01:18:17 +01:00
|
|
|
default: "https://codeberg.org/calckey/calckey",
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
feedbackUrl: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2023-01-20 01:18:17 +01:00
|
|
|
default: "https://codeberg.org/calckey/calckey/issues",
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
2022-03-01 15:58:01 +01:00
|
|
|
defaultDarkTheme: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: true,
|
2022-03-01 15:58:01 +01:00
|
|
|
},
|
|
|
|
defaultLightTheme: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: true,
|
2022-03-01 15:58:01 +01:00
|
|
|
},
|
2021-03-06 14:34:11 +01:00
|
|
|
disableRegistration: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
disableLocalTimeline: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
2022-07-29 06:28:13 +02:00
|
|
|
disableRecommendedTimeline: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2022-07-29 06:28:13 +02:00
|
|
|
},
|
2021-03-06 14:34:11 +01:00
|
|
|
disableGlobalTimeline: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
driveCapacityPerLocalUserMb: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "number",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
driveCapacityPerRemoteUserMb: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "number",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
cacheRemoteFiles: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
2021-10-08 06:37:02 +02:00
|
|
|
emailRequiredForSignup: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-10-08 06:37:02 +02:00
|
|
|
},
|
2021-03-06 14:34:11 +01:00
|
|
|
enableHcaptcha: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
hcaptchaSiteKey: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: true,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
enableRecaptcha: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
recaptchaSiteKey: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: true,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
swPublickey: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: true,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
mascotImageUrl: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2023-06-03 08:30:51 +02:00
|
|
|
default: "/static-assets/badges/info.png",
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
bannerUrl: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
errorImageUrl: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2023-06-03 08:30:51 +02:00
|
|
|
default: "/static-assets/badges/error.png",
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
iconUrl: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: true,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
2022-02-20 11:01:06 +01:00
|
|
|
maxNoteTextLength: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "number",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2022-02-20 11:01:06 +01:00
|
|
|
},
|
2023-03-04 15:16:20 +01:00
|
|
|
maxCaptionTextLength: {
|
|
|
|
type: "number",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
|
|
|
},
|
2021-03-06 14:34:11 +01:00
|
|
|
emojis: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "array",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2019-02-24 19:21:54 +01:00
|
|
|
items: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "object",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2019-02-24 19:21:54 +01:00
|
|
|
properties: {
|
2021-03-06 14:34:11 +01:00
|
|
|
id: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
|
|
|
format: "id",
|
2019-02-24 19:21:54 +01:00
|
|
|
},
|
2021-03-06 14:34:11 +01:00
|
|
|
aliases: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "array",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
items: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-12-09 15:58:30 +01:00
|
|
|
},
|
2019-02-24 19:21:54 +01:00
|
|
|
},
|
2021-03-06 14:34:11 +01:00
|
|
|
category: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: true,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
host: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: true,
|
|
|
|
description: "The local host is represented with `null`.",
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
url: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
|
|
|
format: "url",
|
2021-12-09 15:58:30 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2019-02-24 19:21:54 +01:00
|
|
|
},
|
2021-05-04 14:15:57 +02:00
|
|
|
ads: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "array",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-05-04 14:15:57 +02:00
|
|
|
items: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "object",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-05-04 14:15:57 +02:00
|
|
|
properties: {
|
|
|
|
place: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-05-04 14:15:57 +02:00
|
|
|
},
|
|
|
|
url: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
|
|
|
format: "url",
|
2021-05-04 14:15:57 +02:00
|
|
|
},
|
|
|
|
imageUrl: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
|
|
|
format: "url",
|
2021-05-04 14:15:57 +02:00
|
|
|
},
|
2021-12-09 15:58:30 +01:00
|
|
|
},
|
|
|
|
},
|
2021-05-04 14:15:57 +02:00
|
|
|
},
|
2021-03-06 14:34:11 +01:00
|
|
|
requireSetup: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-12-09 15:58:30 +01:00
|
|
|
example: false,
|
2019-02-24 19:21:54 +01:00
|
|
|
},
|
2021-03-06 14:34:11 +01:00
|
|
|
enableEmail: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2019-02-24 19:21:54 +01:00
|
|
|
},
|
2021-03-06 14:34:11 +01:00
|
|
|
enableTwitterIntegration: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
enableGithubIntegration: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
enableDiscordIntegration: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
enableServiceWorker: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
2021-08-15 13:26:44 +02:00
|
|
|
translatorAvailable: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-08-15 13:26:44 +02:00
|
|
|
},
|
2021-03-06 14:34:11 +01:00
|
|
|
proxyAccountName: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: false,
|
|
|
|
nullable: true,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
features: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "object",
|
|
|
|
optional: true,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
properties: {
|
|
|
|
registration: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
localTimeLine: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
2022-07-29 06:49:36 +02:00
|
|
|
recommendedTimeLine: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2022-07-29 06:28:13 +02:00
|
|
|
},
|
2021-03-06 14:34:11 +01:00
|
|
|
globalTimeLine: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
elasticsearch: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
hcaptcha: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
recaptcha: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
objectStorage: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
twitter: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
github: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
discord: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
serviceWorker: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: false,
|
|
|
|
nullable: false,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
|
|
|
miauth: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: true,
|
|
|
|
nullable: false,
|
2021-12-09 15:58:30 +01:00
|
|
|
default: true,
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
2021-12-09 15:58:30 +01:00
|
|
|
},
|
2021-03-06 14:34:11 +01:00
|
|
|
},
|
2021-07-20 18:45:41 +02:00
|
|
|
secureMode: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: true,
|
|
|
|
nullable: false,
|
2021-07-20 18:45:41 +02:00
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
privateMode: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "boolean",
|
|
|
|
optional: true,
|
|
|
|
nullable: false,
|
2021-07-20 18:45:41 +02:00
|
|
|
default: false,
|
|
|
|
},
|
2023-01-05 05:06:48 +01:00
|
|
|
defaultReaction: {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "string",
|
|
|
|
optional: "false",
|
|
|
|
nullable: false,
|
|
|
|
default: "⭐",
|
2023-01-05 05:06:48 +01:00
|
|
|
},
|
2021-12-09 15:58:30 +01:00
|
|
|
},
|
|
|
|
},
|
2022-01-18 14:27:10 +01:00
|
|
|
} as const;
|
2018-10-08 18:01:48 +02:00
|
|
|
|
2022-02-20 05:15:40 +01:00
|
|
|
export const paramDef = {
|
2023-01-13 05:40:33 +01:00
|
|
|
type: "object",
|
2022-02-19 06:05:32 +01:00
|
|
|
properties: {
|
2023-01-13 05:40:33 +01:00
|
|
|
detail: { type: "boolean", default: true },
|
2022-02-19 06:05:32 +01:00
|
|
|
},
|
|
|
|
required: [],
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
export default define(meta, paramDef, async (ps, me) => {
|
2019-04-24 01:11:19 +02:00
|
|
|
const instance = await fetchMeta(true);
|
2017-11-15 01:47:47 +01:00
|
|
|
|
2019-10-20 17:43:39 +02:00
|
|
|
const emojis = await Emojis.find({
|
|
|
|
where: {
|
2022-03-26 07:34:00 +01:00
|
|
|
host: IsNull(),
|
2019-10-20 17:43:39 +02:00
|
|
|
},
|
|
|
|
order: {
|
2023-01-13 05:40:33 +01:00
|
|
|
category: "ASC",
|
|
|
|
name: "ASC",
|
2019-10-20 17:43:39 +02:00
|
|
|
},
|
|
|
|
cache: {
|
2023-01-13 05:40:33 +01:00
|
|
|
id: "meta_emojis",
|
|
|
|
milliseconds: 3600000, // 1 hour
|
2021-12-09 15:58:30 +01:00
|
|
|
},
|
2019-10-20 17:43:39 +02:00
|
|
|
});
|
2018-11-02 15:23:01 +01:00
|
|
|
|
2021-05-04 14:15:57 +02:00
|
|
|
const ads = await Ads.find({
|
|
|
|
where: {
|
2021-12-09 15:58:30 +01:00
|
|
|
expiresAt: MoreThan(new Date()),
|
2021-05-04 14:15:57 +02:00
|
|
|
},
|
|
|
|
});
|
2021-07-20 20:51:59 +02:00
|
|
|
|
2018-11-06 16:08:21 +01:00
|
|
|
const response: any = {
|
2019-04-07 14:50:36 +02:00
|
|
|
maintainerName: instance.maintainerName,
|
|
|
|
maintainerEmail: instance.maintainerEmail,
|
2018-04-22 14:32:09 +02:00
|
|
|
|
2019-11-01 14:34:26 +01:00
|
|
|
version: config.version,
|
2018-04-22 14:32:09 +02:00
|
|
|
|
2018-11-05 23:14:43 +01:00
|
|
|
name: instance.name,
|
2018-12-26 20:50:35 +01:00
|
|
|
uri: config.url,
|
2018-11-05 23:14:43 +01:00
|
|
|
description: instance.description,
|
2018-11-07 04:28:53 +01:00
|
|
|
langs: instance.langs,
|
2020-01-29 20:37:25 +01:00
|
|
|
tosUrl: instance.ToSUrl,
|
2019-05-13 19:57:04 +02:00
|
|
|
repositoryUrl: instance.repositoryUrl,
|
|
|
|
feedbackUrl: instance.feedbackUrl,
|
2021-07-20 20:51:59 +02:00
|
|
|
|
|
|
|
secureMode: instance.secureMode,
|
|
|
|
privateMode: instance.privateMode,
|
|
|
|
|
2018-11-05 23:14:43 +01:00
|
|
|
disableRegistration: instance.disableRegistration,
|
|
|
|
disableLocalTimeline: instance.disableLocalTimeline,
|
2022-07-29 06:28:13 +02:00
|
|
|
disableRecommendedTimeline: instance.disableRecommendedTimeline,
|
2019-01-16 06:54:14 +01:00
|
|
|
disableGlobalTimeline: instance.disableGlobalTimeline,
|
2018-11-05 23:14:43 +01:00
|
|
|
driveCapacityPerLocalUserMb: instance.localDriveCapacityMb,
|
|
|
|
driveCapacityPerRemoteUserMb: instance.remoteDriveCapacityMb,
|
2021-10-08 06:37:02 +02:00
|
|
|
emailRequiredForSignup: instance.emailRequiredForSignup,
|
2020-04-28 07:29:33 +02:00
|
|
|
enableHcaptcha: instance.enableHcaptcha,
|
|
|
|
hcaptchaSiteKey: instance.hcaptchaSiteKey,
|
2018-11-07 04:09:24 +01:00
|
|
|
enableRecaptcha: instance.enableRecaptcha,
|
|
|
|
recaptchaSiteKey: instance.recaptchaSiteKey,
|
2018-12-19 20:08:13 +01:00
|
|
|
swPublickey: instance.swPublicKey,
|
2022-02-09 13:25:48 +01:00
|
|
|
themeColor: instance.themeColor,
|
2019-01-03 19:52:50 +01:00
|
|
|
mascotImageUrl: instance.mascotImageUrl,
|
2018-11-05 23:14:43 +01:00
|
|
|
bannerUrl: instance.bannerUrl,
|
2018-12-11 13:17:57 +01:00
|
|
|
errorImageUrl: instance.errorImageUrl,
|
2019-03-15 04:40:10 +01:00
|
|
|
iconUrl: instance.iconUrl,
|
2020-11-25 13:31:34 +01:00
|
|
|
backgroundImageUrl: instance.backgroundImageUrl,
|
|
|
|
logoImageUrl: instance.logoImageUrl,
|
2022-02-20 11:01:06 +01:00
|
|
|
maxNoteTextLength: MAX_NOTE_TEXT_LENGTH, // 後方互換性のため
|
2023-03-04 15:16:20 +01:00
|
|
|
maxCaptionTextLength: MAX_CAPTION_TEXT_LENGTH,
|
2021-07-20 20:51:59 +02:00
|
|
|
emojis: instance.privateMode && !me ? [] : await Emojis.packMany(emojis),
|
2023-06-03 08:28:21 +02:00
|
|
|
// クライアントの手間を減らすためあらかじめJSONに変換しておく
|
|
|
|
defaultLightTheme: instance.defaultLightTheme
|
|
|
|
? JSON.stringify(JSON5.parse(instance.defaultLightTheme))
|
|
|
|
: null,
|
|
|
|
defaultDarkTheme: instance.defaultDarkTheme
|
|
|
|
? JSON.stringify(JSON5.parse(instance.defaultDarkTheme))
|
|
|
|
: null,
|
2023-01-13 05:40:33 +01:00
|
|
|
ads:
|
|
|
|
instance.privateMode && !me
|
|
|
|
? []
|
|
|
|
: ads.map((ad) => ({
|
|
|
|
id: ad.id,
|
|
|
|
url: ad.url,
|
|
|
|
place: ad.place,
|
|
|
|
ratio: ad.ratio,
|
|
|
|
imageUrl: ad.imageUrl,
|
|
|
|
})),
|
2018-11-29 12:33:31 +01:00
|
|
|
enableEmail: instance.enableEmail,
|
2018-11-16 18:13:01 +01:00
|
|
|
|
|
|
|
enableTwitterIntegration: instance.enableTwitterIntegration,
|
|
|
|
enableGithubIntegration: instance.enableGithubIntegration,
|
|
|
|
enableDiscordIntegration: instance.enableDiscordIntegration,
|
2019-03-31 18:04:55 +02:00
|
|
|
|
|
|
|
enableServiceWorker: instance.enableServiceWorker,
|
2020-08-29 01:56:32 +02:00
|
|
|
|
2023-04-30 03:09:51 +02:00
|
|
|
translatorAvailable:
|
|
|
|
instance.deeplAuthKey != null || instance.libreTranslateApiUrl != null,
|
2023-01-05 05:06:48 +01:00
|
|
|
defaultReaction: instance.defaultReaction,
|
2021-08-15 13:26:44 +02:00
|
|
|
|
2023-01-13 05:40:33 +01:00
|
|
|
...(ps.detail
|
|
|
|
? {
|
|
|
|
pinnedPages: instance.privateMode && !me ? [] : instance.pinnedPages,
|
|
|
|
pinnedClipId:
|
|
|
|
instance.privateMode && !me ? [] : instance.pinnedClipId,
|
|
|
|
cacheRemoteFiles: instance.cacheRemoteFiles,
|
|
|
|
requireSetup:
|
|
|
|
(await Users.countBy({
|
|
|
|
host: IsNull(),
|
2023-02-13 05:18:45 +01:00
|
|
|
isAdmin: true,
|
2023-01-13 05:40:33 +01:00
|
|
|
})) === 0,
|
|
|
|
}
|
|
|
|
: {}),
|
2018-11-06 16:08:21 +01:00
|
|
|
};
|
2018-11-02 15:23:01 +01:00
|
|
|
|
2018-11-06 16:08:21 +01:00
|
|
|
if (ps.detail) {
|
2021-07-20 20:51:59 +02:00
|
|
|
if (!instance.privateMode || me) {
|
2023-01-13 05:40:33 +01:00
|
|
|
const proxyAccount = instance.proxyAccountId
|
|
|
|
? await Users.pack(instance.proxyAccountId).catch(() => null)
|
|
|
|
: null;
|
2021-07-20 20:51:59 +02:00
|
|
|
response.proxyAccountName = proxyAccount ? proxyAccount.username : null;
|
|
|
|
}
|
2020-11-17 06:59:15 +01:00
|
|
|
|
2018-11-06 16:08:21 +01:00
|
|
|
response.features = {
|
2018-11-05 23:14:43 +01:00
|
|
|
registration: !instance.disableRegistration,
|
|
|
|
localTimeLine: !instance.disableLocalTimeline,
|
2022-07-29 06:49:36 +02:00
|
|
|
recommendedTimeline: !instance.disableRecommendedTimeline,
|
2019-01-16 06:54:14 +01:00
|
|
|
globalTimeLine: !instance.disableGlobalTimeline,
|
2021-10-08 06:37:02 +02:00
|
|
|
emailRequiredForSignup: instance.emailRequiredForSignup,
|
2019-02-07 13:02:33 +01:00
|
|
|
elasticsearch: config.elasticsearch ? true : false,
|
2020-04-28 07:29:33 +02:00
|
|
|
hcaptcha: instance.enableHcaptcha,
|
2018-11-06 16:08:21 +01:00
|
|
|
recaptcha: instance.enableRecaptcha,
|
2019-05-15 18:07:32 +02:00
|
|
|
objectStorage: instance.useObjectStorage,
|
2018-11-07 05:14:52 +01:00
|
|
|
twitter: instance.enableTwitterIntegration,
|
|
|
|
github: instance.enableGithubIntegration,
|
2018-11-15 11:15:04 +01:00
|
|
|
discord: instance.enableDiscordIntegration,
|
2018-12-19 20:08:13 +01:00
|
|
|
serviceWorker: instance.enableServiceWorker,
|
2023-06-06 06:15:49 +02:00
|
|
|
postEditing: instance.experimentalFeatures?.postEditing || false,
|
|
|
|
postImports: instance.experimentalFeatures?.postImports || false,
|
2020-03-29 10:44:14 +02:00
|
|
|
miauth: true,
|
2018-11-06 16:08:21 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-02-22 03:46:58 +01:00
|
|
|
return response;
|
|
|
|
});
|