Merge branch 'develop' of https://codeberg.org/calckey/calckey into hints
This commit is contained in:
commit
6d66bee740
105 changed files with 2433 additions and 1382 deletions
|
@ -82,23 +82,28 @@ redis:
|
|||
# user:
|
||||
# pass:
|
||||
|
||||
# ┌───────────────────────────┐
|
||||
#───┘ Meilisearch configuration └─────────────────────────────────────
|
||||
#meilisearch:
|
||||
# host: meilisearch
|
||||
# port: 7700
|
||||
# ssl: false
|
||||
# apiKey:
|
||||
|
||||
# ┌───────────────┐
|
||||
#───┘ ID generation └───────────────────────────────────────────
|
||||
|
||||
# You can select the ID generation method.
|
||||
# You don't usually need to change this setting, but you can
|
||||
# change it according to your preferences.
|
||||
# No need to uncomment in most cases, but you may want to change
|
||||
# these settings if you plan to run a large and/or distributed server.
|
||||
|
||||
# Available methods:
|
||||
# aid ... Short, Millisecond accuracy
|
||||
# meid ... Similar to ObjectID, Millisecond accuracy
|
||||
# ulid ... Millisecond accuracy
|
||||
# objectid ... This is left for backward compatibility
|
||||
# cuid:
|
||||
# # Min 16, Max 24
|
||||
# length: 16
|
||||
#
|
||||
# # Set this to a unique string across workers (e.g., machine's hostname)
|
||||
# # if your workers are running in multiple hosts.
|
||||
# fingerprint: my-fingerprint
|
||||
|
||||
# ONCE YOU HAVE STARTED THE INSTANCE, DO NOT CHANGE THE
|
||||
# ID SETTINGS AFTER THAT!
|
||||
|
||||
id: 'aid'
|
||||
|
||||
# ┌─────────────────────┐
|
||||
#───┘ Other configuration └─────────────────────────────────────
|
||||
|
|
20
README.md
20
README.md
|
@ -89,7 +89,8 @@ If you have access to a server that supports one of the sources below, I recomme
|
|||
|
||||
- [FFmpeg](https://ffmpeg.org/) for video transcoding
|
||||
- Full text search (one of the following)
|
||||
- 🦔 [Sonic](https://crates.io/crates/sonic-server) (recommended)
|
||||
- 🦔 [Sonic](https://crates.io/crates/sonic-server)
|
||||
- [MeiliSearch](https://www.meilisearch.com/)
|
||||
- [ElasticSearch](https://www.elastic.co/elasticsearch/)
|
||||
|
||||
### 🏗️ Build dependencies
|
||||
|
@ -148,7 +149,11 @@ psql postgres -c "create database calckey with encoding = 'UTF8';"
|
|||
|
||||
In Calckey's directory, fill out the `db` section of `.config/default.yml` with the correct information, where the `db` key is `calckey`.
|
||||
|
||||
## 🦔 Set up search
|
||||
## 🔎 Set up search
|
||||
|
||||
### 🦔 Sonic
|
||||
|
||||
Sonic is better suited for self hosters with smaller deployments. It's easier to use, uses almost no resources, and takes barely any any disk space.
|
||||
|
||||
Follow sonic's [installation guide](https://github.com/valeriansaliou/sonic#installation)
|
||||
|
||||
|
@ -157,6 +162,17 @@ Follow sonic's [installation guide](https://github.com/valeriansaliou/sonic#inst
|
|||
|
||||
In Calckey's directory, fill out the `sonic` section of `.config/default.yml` with the correct information.
|
||||
|
||||
### Meilisearch
|
||||
|
||||
Meilisearch is better suited for larger deployments. It's faster but uses far more resources and disk space.
|
||||
|
||||
Follow Meilisearch's [quick start guide](https://www.meilisearch.com/docs/learn/getting_started/quick_start)
|
||||
|
||||
In Calckey's directory, fill out the `meilisearch` section of `.config/default.yml` with the correct information.
|
||||
|
||||
### ElasticSearch
|
||||
|
||||
Please don't use ElasticSearch unless you already have an ElasticSearch setup and want to continue using it for Calckey. ElasticSearch is slow, heavy, and offers very few benefits over Sonic/Meilisearch.
|
||||
|
||||
## 💅 Customize
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ services:
|
|||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
- sonic
|
||||
- meilisearch
|
||||
ports:
|
||||
- "3000:3000"
|
||||
networks:
|
||||
|
@ -40,14 +40,30 @@ services:
|
|||
volumes:
|
||||
- ./db:/var/lib/postgresql/data
|
||||
|
||||
sonic:
|
||||
restart: unless-stopped
|
||||
image: docker.io/valeriansaliou/sonic:v1.4.0
|
||||
networks:
|
||||
- calcnet
|
||||
volumes:
|
||||
- ./sonic:/var/lib/sonic/store
|
||||
- ./sonic/config.cfg:/etc/sonic.cfg
|
||||
### Only one of the below should be used.
|
||||
### Meilisearch is better overall, but resource-intensive. Sonic is a very light full text search engine.
|
||||
|
||||
# meilisearch:
|
||||
# container_name: meilisearch
|
||||
# image: getmeili/meilisearch:v1.1.1
|
||||
# environment:
|
||||
# - MEILI_ENV=${MEILI_ENV:-development}
|
||||
# ports:
|
||||
# - "7700:7700"
|
||||
# networks:
|
||||
# - calcnet
|
||||
# volumes:
|
||||
# - ./meili_data:/meili_data
|
||||
# restart: unless-stopped
|
||||
|
||||
# sonic:
|
||||
# restart: unless-stopped
|
||||
# image: docker.io/valeriansaliou/sonic:v1.4.0
|
||||
# networks:
|
||||
# - calcnet
|
||||
# volumes:
|
||||
# - ./sonic:/var/lib/sonic/store
|
||||
# - ./sonic/config.cfg:/etc/sonic.cfg
|
||||
|
||||
networks:
|
||||
calcnet:
|
||||
|
|
|
@ -5,6 +5,7 @@ introMisskey: "Welcome! Calckey is an open source, decentralized social media pl
|
|||
\ that's free forever! \U0001F680"
|
||||
monthAndDay: "{month}/{day}"
|
||||
search: "Search"
|
||||
searchPlaceholder: "Search Calckey"
|
||||
notifications: "Notifications"
|
||||
username: "Username"
|
||||
password: "Password"
|
||||
|
@ -1529,30 +1530,35 @@ _weekday:
|
|||
friday: "Friday"
|
||||
saturday: "Saturday"
|
||||
_widgets:
|
||||
memo: "Sticky notes"
|
||||
memo: "Sticky Notes"
|
||||
notifications: "Notifications"
|
||||
timeline: "Timeline"
|
||||
calendar: "Calendar"
|
||||
trends: "Trending"
|
||||
clock: "Clock"
|
||||
rss: "RSS reader"
|
||||
rssTicker: "RSS-Ticker"
|
||||
rss: "RSS Reader"
|
||||
rssTicker: "RSS Ticker"
|
||||
activity: "Activity"
|
||||
photos: "Photos"
|
||||
digitalClock: "Digital clock"
|
||||
unixClock: "UNIX clock"
|
||||
digitalClock: "Digital Clock"
|
||||
unixClock: "UNIX Clock"
|
||||
federation: "Federation"
|
||||
instanceCloud: "Server cloud"
|
||||
postForm: "Posting form"
|
||||
instanceCloud: "Server Cloud"
|
||||
postForm: "Posting Form"
|
||||
slideshow: "Slideshow"
|
||||
button: "Button"
|
||||
onlineUsers: "Online users"
|
||||
onlineUsers: "Online Users"
|
||||
jobQueue: "Job Queue"
|
||||
serverMetric: "Server metrics"
|
||||
aiscript: "AiScript console"
|
||||
userList: "User list"
|
||||
serverMetric: "Server Metrics"
|
||||
aiscript: "AiScript Console"
|
||||
userList: "User List"
|
||||
serverInfo: "Server Info"
|
||||
_userList:
|
||||
chooseList: "Select a list"
|
||||
meiliStatus: "Server Status"
|
||||
meiliSize: "Index size"
|
||||
meiliIndexCount: "Indexed posts"
|
||||
|
||||
_cw:
|
||||
hide: "Hide"
|
||||
show: "Show content"
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "calckey",
|
||||
"version": "14.0.0-dev26",
|
||||
"version": "14.0.0-dev31",
|
||||
"codename": "aqua",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://codeberg.org/calckey/calckey.git"
|
||||
},
|
||||
"packageManager": "pnpm@8.5.1",
|
||||
"packageManager": "pnpm@8.6.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"rebuild": "pnpm run clean && pnpm -r run build && pnpm run gulp",
|
||||
|
|
|
@ -4,10 +4,5 @@
|
|||
"module": "commonjs",
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"jspm_packages",
|
||||
"tmp",
|
||||
"temp"
|
||||
]
|
||||
"exclude": ["node_modules", "jspm_packages", "tmp", "temp"]
|
||||
}
|
||||
|
|
|
@ -1,7 +1,15 @@
|
|||
import test from "ava";
|
||||
|
||||
import { sum } from "../index.js";
|
||||
import { convertId, IdConvertType } from "../built/index.js";
|
||||
|
||||
test("sum from native", (t) => {
|
||||
t.is(sum(1, 2), 3);
|
||||
test("convert to mastodon id", (t) => {
|
||||
t.is(convertId("9gf61ehcxv", IdConvertType.MastodonId), "960365976481219");
|
||||
t.is(
|
||||
convertId("9fbr9z0wbrjqyd3u", IdConvertType.MastodonId),
|
||||
"3954607381600562394",
|
||||
);
|
||||
t.is(
|
||||
convertId("9fbs680oyviiqrol9md73p8g", IdConvertType.MastodonId),
|
||||
"3494513243013053824",
|
||||
);
|
||||
});
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
"@koa/cors": "3.4.3",
|
||||
"@koa/multer": "3.0.0",
|
||||
"@koa/router": "9.0.1",
|
||||
"@paralleldrive/cuid2": "2.2.0",
|
||||
"@peertube/http-signature": "1.7.0",
|
||||
"@redocly/openapi-core": "1.0.0-beta.120",
|
||||
"@sinonjs/fake-timers": "9.1.2",
|
||||
|
@ -85,6 +86,7 @@
|
|||
"koa-send": "5.0.1",
|
||||
"koa-slow": "2.1.0",
|
||||
"koa-views": "7.0.2",
|
||||
"meilisearch": "0.32.4",
|
||||
"mfm-js": "0.23.3",
|
||||
"mime-types": "2.1.35",
|
||||
"multer": "1.4.4-lts.1",
|
||||
|
|
|
@ -39,6 +39,12 @@ export type Source = {
|
|||
collection?: string;
|
||||
bucket?: string;
|
||||
};
|
||||
meilisearch: {
|
||||
host: string;
|
||||
port: number;
|
||||
apiKey?: string;
|
||||
ssl: boolean;
|
||||
};
|
||||
|
||||
proxy?: string;
|
||||
proxySmtp?: string;
|
||||
|
@ -54,7 +60,10 @@ export type Source = {
|
|||
|
||||
onlyQueueProcessor?: boolean;
|
||||
|
||||
id: string;
|
||||
cuid?: {
|
||||
length?: number;
|
||||
fingerprint?: string;
|
||||
};
|
||||
|
||||
outgoingAddressFamily?: "ipv4" | "ipv6" | "dual";
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import si from "systeminformation";
|
||||
import Xev from "xev";
|
||||
import * as osUtils from "os-utils";
|
||||
import meilisearch from "../db/meilisearch.js";
|
||||
|
||||
const ev = new Xev();
|
||||
|
||||
|
@ -24,6 +25,7 @@ export default function () {
|
|||
const memStats = await mem();
|
||||
const netStats = await net();
|
||||
const fsStats = await fs();
|
||||
const meilisearchStats = await meilisearchStatus();
|
||||
|
||||
const stats = {
|
||||
cpu: roundCpu(cpu),
|
||||
|
@ -39,6 +41,7 @@ export default function () {
|
|||
r: round(Math.max(0, fsStats.rIO_sec ?? 0)),
|
||||
w: round(Math.max(0, fsStats.wIO_sec ?? 0)),
|
||||
},
|
||||
meilisearch: meilisearchStats,
|
||||
};
|
||||
ev.emit("serverStats", stats);
|
||||
log.unshift(stats);
|
||||
|
@ -77,3 +80,16 @@ async function fs() {
|
|||
const data = await si.disksIO().catch(() => ({ rIO_sec: 0, wIO_sec: 0 }));
|
||||
return data || { rIO_sec: 0, wIO_sec: 0 };
|
||||
}
|
||||
|
||||
// MEILI STAT
|
||||
async function meilisearchStatus() {
|
||||
if (meilisearch) {
|
||||
return meilisearch.serverStats();
|
||||
} else {
|
||||
return {
|
||||
health: "unconfigured",
|
||||
size: 0,
|
||||
indexed_count: 0,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
292
packages/backend/src/db/meilisearch.ts
Normal file
292
packages/backend/src/db/meilisearch.ts
Normal file
|
@ -0,0 +1,292 @@
|
|||
import { Health, MeiliSearch, Stats } from "meilisearch";
|
||||
import { dbLogger } from "./logger.js";
|
||||
|
||||
import config from "@/config/index.js";
|
||||
import { Note } from "@/models/entities/note.js";
|
||||
import * as url from "url";
|
||||
import { ILocalUser, User } from "@/models/entities/user.js";
|
||||
import { Followings, Users } from "@/models/index.js";
|
||||
|
||||
const logger = dbLogger.createSubLogger("meilisearch", "gray", false);
|
||||
|
||||
const hasConfig =
|
||||
config.meilisearch &&
|
||||
(config.meilisearch.host ||
|
||||
config.meilisearch.port ||
|
||||
config.meilisearch.apiKey);
|
||||
|
||||
if (hasConfig) {
|
||||
const host = hasConfig ? config.meilisearch.host ?? "localhost" : "";
|
||||
const port = hasConfig ? config.meilisearch.port ?? 7700 : 0;
|
||||
const auth = hasConfig ? config.meilisearch.apiKey ?? "" : "";
|
||||
const ssl = hasConfig ? config.meilisearch.ssl ?? false : false;
|
||||
|
||||
logger.info("Connecting to MeiliSearch");
|
||||
|
||||
const client: MeiliSearch = new MeiliSearch({
|
||||
host: `${ssl ? "https" : "http"}://${host}:${port}`,
|
||||
apiKey: auth,
|
||||
});
|
||||
|
||||
const posts = client.index("posts");
|
||||
|
||||
posts
|
||||
.updateSearchableAttributes(["text"])
|
||||
.catch((e) =>
|
||||
logger.error(`Setting searchable attr failed, searches won't work: ${e}`),
|
||||
);
|
||||
|
||||
posts
|
||||
.updateFilterableAttributes([
|
||||
"userName",
|
||||
"userHost",
|
||||
"mediaAttachment",
|
||||
"createdAt",
|
||||
"userId",
|
||||
])
|
||||
.catch((e) =>
|
||||
logger.error(
|
||||
`Setting filterable attr failed, advanced searches won't work: ${e}`,
|
||||
),
|
||||
);
|
||||
|
||||
posts
|
||||
.updateSortableAttributes(["createdAt"])
|
||||
.catch((e) =>
|
||||
logger.error(
|
||||
`Setting sortable attr failed, placeholder searches won't sort properly: ${e}`,
|
||||
),
|
||||
);
|
||||
|
||||
logger.info("Connected to MeiliSearch");
|
||||
}
|
||||
|
||||
export type MeilisearchNote = {
|
||||
id: string;
|
||||
text: string;
|
||||
userId: string;
|
||||
userHost: string;
|
||||
userName: string;
|
||||
channelId: string;
|
||||
mediaAttachment: string;
|
||||
createdAt: number;
|
||||
};
|
||||
|
||||
export default hasConfig
|
||||
? {
|
||||
search: async (
|
||||
query: string,
|
||||
limit: number,
|
||||
offset: number,
|
||||
userCtx: ILocalUser | null,
|
||||
) => {
|
||||
/// Advanced search syntax
|
||||
/// from:user => filter by user + optional domain
|
||||
/// has:image/video/audio/text/file => filter by attachment types
|
||||
/// domain:domain.com => filter by domain
|
||||
/// before:Date => show posts made before Date
|
||||
/// after: Date => show posts made after Date
|
||||
/// "text" => get posts with exact text between quotes
|
||||
/// filter:following => show results only from users you follow
|
||||
/// filter:followers => show results only from followers
|
||||
|
||||
let constructedFilters: string[] = [];
|
||||
|
||||
let splitSearch = query.split(" ");
|
||||
|
||||
// Detect search operators and remove them from the actual query
|
||||
let filteredSearchTerms = (
|
||||
await Promise.all(
|
||||
splitSearch.map(async (term) => {
|
||||
if (term.startsWith("has:")) {
|
||||
let fileType = term.slice(4);
|
||||
constructedFilters.push(`mediaAttachment = "${fileType}"`);
|
||||
return null;
|
||||
} else if (term.startsWith("from:")) {
|
||||
let user = term.slice(5);
|
||||
constructedFilters.push(`userName = ${user}`);
|
||||
return null;
|
||||
} else if (term.startsWith("domain:")) {
|
||||
let domain = term.slice(7);
|
||||
constructedFilters.push(`userHost = ${domain}`);
|
||||
return null;
|
||||
} else if (term.startsWith("after:")) {
|
||||
let timestamp = term.slice(6);
|
||||
// Try to parse the timestamp as JavaScript Date
|
||||
let date = Date.parse(timestamp);
|
||||
if (isNaN(date)) return null;
|
||||
constructedFilters.push(`createdAt > ${date / 1000}`);
|
||||
return null;
|
||||
} else if (term.startsWith("before:")) {
|
||||
let timestamp = term.slice(7);
|
||||
// Try to parse the timestamp as JavaScript Date
|
||||
let date = Date.parse(timestamp);
|
||||
if (isNaN(date)) return null;
|
||||
constructedFilters.push(`createdAt < ${date / 1000}`);
|
||||
return null;
|
||||
} else if (term.startsWith("filter:following")) {
|
||||
// Check if we got a context user
|
||||
if (userCtx) {
|
||||
// Fetch user follows from DB
|
||||
let followedUsers = await Followings.find({
|
||||
where: {
|
||||
followerId: userCtx.id,
|
||||
},
|
||||
select: {
|
||||
followeeId: true,
|
||||
},
|
||||
});
|
||||
let followIDs = followedUsers.map((user) => user.followeeId);
|
||||
|
||||
if (followIDs.length === 0) return null;
|
||||
|
||||
constructedFilters.push(`userId IN [${followIDs.join(",")}]`);
|
||||
} else {
|
||||
logger.warn(
|
||||
"search filtered to follows called without user context",
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
} else if (term.startsWith("filter:followers")) {
|
||||
// Check if we got a context user
|
||||
if (userCtx) {
|
||||
// Fetch users follows from DB
|
||||
let followedUsers = await Followings.find({
|
||||
where: {
|
||||
followeeId: userCtx.id,
|
||||
},
|
||||
select: {
|
||||
followerId: true,
|
||||
},
|
||||
});
|
||||
let followIDs = followedUsers.map((user) => user.followerId);
|
||||
|
||||
if (followIDs.length === 0) return null;
|
||||
|
||||
constructedFilters.push(`userId IN [${followIDs.join(",")}]`);
|
||||
} else {
|
||||
logger.warn(
|
||||
"search filtered to followers called without user context",
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return term;
|
||||
}),
|
||||
)
|
||||
).filter((term) => term !== null);
|
||||
|
||||
let sortRules = [];
|
||||
|
||||
// An empty search term with defined filters means we have a placeholder search => https://www.meilisearch.com/docs/reference/api/search#placeholder-search
|
||||
// These have to be ordered manually, otherwise the *oldest* posts are returned first, which we don't want
|
||||
if (filteredSearchTerms.length === 0 && constructedFilters.length > 0) {
|
||||
sortRules.push("createdAt:desc");
|
||||
}
|
||||
|
||||
logger.info(`Searching for ${filteredSearchTerms.join(" ")}`);
|
||||
logger.info(`Limit: ${limit}`);
|
||||
logger.info(`Offset: ${offset}`);
|
||||
logger.info(`Filters: ${constructedFilters}`);
|
||||
logger.info(`Ordering: ${sortRules}`);
|
||||
|
||||
return posts.search(filteredSearchTerms.join(" "), {
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
filter: constructedFilters,
|
||||
sort: sortRules,
|
||||
});
|
||||
},
|
||||
ingestNote: async (ingestNotes: Note | Note[]) => {
|
||||
if (ingestNotes instanceof Note) {
|
||||
ingestNotes = [ingestNotes];
|
||||
}
|
||||
|
||||
let indexingBatch: MeilisearchNote[] = [];
|
||||
|
||||
for (let note of ingestNotes) {
|
||||
if (note.user === undefined) {
|
||||
note.user = await Users.findOne({
|
||||
where: {
|
||||
id: note.userId,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
let attachmentType = "";
|
||||
if (note.attachedFileTypes.length > 0) {
|
||||
attachmentType = note.attachedFileTypes[0].split("/")[0];
|
||||
switch (attachmentType) {
|
||||
case "image":
|
||||
case "video":
|
||||
case "audio":
|
||||
case "text":
|
||||
break;
|
||||
default:
|
||||
attachmentType = "file";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
indexingBatch.push(<MeilisearchNote>{
|
||||
id: note.id.toString(),
|
||||
text: note.text ? note.text : "",
|
||||
userId: note.userId,
|
||||
userHost:
|
||||
note.userHost !== ""
|
||||
? note.userHost
|
||||
: url.parse(config.host).host,
|
||||
channelId: note.channelId ? note.channelId : "",
|
||||
mediaAttachment: attachmentType,
|
||||
userName: note.user?.username ?? "UNKNOWN",
|
||||
createdAt: note.createdAt.getTime() / 1000, // division by 1000 is necessary because Node returns in ms-accuracy
|
||||
});
|
||||
}
|
||||
|
||||
return posts
|
||||
.addDocuments(indexingBatch, {
|
||||
primaryKey: "id",
|
||||
})
|
||||
.then(() =>
|
||||
console.log(`sent ${indexingBatch.length} posts for indexing`),
|
||||
);
|
||||
},
|
||||
serverStats: async () => {
|
||||
let health: Health = await client.health();
|
||||
let stats: Stats = await client.getStats();
|
||||
|
||||
return {
|
||||
health: health.status,
|
||||
size: stats.databaseSize,
|
||||
indexed_count: stats.indexes["posts"].numberOfDocuments,
|
||||
};
|
||||
},
|
||||
deleteNotes: async (note: Note | Note[] | string | string[]) => {
|
||||
if (note instanceof Note) {
|
||||
note = [note];
|
||||
}
|
||||
if (typeof note === "string") {
|
||||
note = [note];
|
||||
}
|
||||
|
||||
let deletionBatch = note.map((n) => {
|
||||
if(n instanceof Note) {
|
||||
return n.id;
|
||||
}
|
||||
|
||||
if(n.length > 0) return n;
|
||||
|
||||
logger.error(`Failed to delete note from Meilisearch, invalid post ID: ${JSON.stringify(n)}`)
|
||||
|
||||
throw new Error(`Invalid note ID passed to meilisearch deleteNote: ${JSON.stringify(n)}`)
|
||||
}).filter((el) => el !== null);
|
||||
|
||||
await posts.deleteDocuments(deletionBatch as string[]).then(() => {
|
||||
logger.info(`submitted ${deletionBatch.length} large batch for deletion`)
|
||||
});
|
||||
},
|
||||
}
|
||||
: null;
|
|
@ -1,27 +1,27 @@
|
|||
import { ulid } from "ulid";
|
||||
import { genAid } from "./id/aid.js";
|
||||
import { genMeid } from "./id/meid.js";
|
||||
import { genMeidg } from "./id/meidg.js";
|
||||
import { genObjectId } from "./id/object-id.js";
|
||||
import { init, createId } from "@paralleldrive/cuid2";
|
||||
import config from "@/config/index.js";
|
||||
|
||||
const metohd = config.id.toLowerCase();
|
||||
const TIME2000 = 946684800000;
|
||||
const TIMESTAMP_LENGTH = 8;
|
||||
|
||||
const length =
|
||||
Math.min(Math.max(config.cuid?.length ?? 16, 16), 24) - TIMESTAMP_LENGTH;
|
||||
const fingerprint = `${config.cuid?.fingerprint ?? ""}${createId()}`;
|
||||
|
||||
const genCuid2 = init({ length, fingerprint });
|
||||
|
||||
/**
|
||||
* The generated ID results in the form of `[8 chars timestamp] + [cuid2]`.
|
||||
* The minimum and maximum lengths are 16 and 24, respectively.
|
||||
* With the length of 16, namely 8 for cuid2, roughly 1427399 IDs are needed
|
||||
* in the same millisecond to reach 50% chance of collision.
|
||||
*
|
||||
* Ref: https://github.com/paralleldrive/cuid2#parameterized-length
|
||||
*/
|
||||
export function genId(date?: Date): string {
|
||||
if (!date || date > new Date()) date = new Date();
|
||||
const now = (date ?? new Date()).getTime();
|
||||
const time = Math.max(now - TIME2000, 0);
|
||||
const timestamp = time.toString(36).padStart(TIMESTAMP_LENGTH, "0");
|
||||
|
||||
switch (metohd) {
|
||||
case "aid":
|
||||
return genAid(date);
|
||||
case "meid":
|
||||
return genMeid(date);
|
||||
case "meidg":
|
||||
return genMeidg(date);
|
||||
case "ulid":
|
||||
return ulid(date.getTime());
|
||||
case "objectid":
|
||||
return genObjectId(date);
|
||||
default:
|
||||
throw new Error("unrecognized id generation method");
|
||||
}
|
||||
return `${timestamp}${genCuid2()}`;
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@ export class AbuseUserReport {
|
|||
public id: string;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the AbuseUserReport.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the AbuseUserReport.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
|
@ -24,8 +24,8 @@ export class AbuseUserReport {
|
|||
@Column(id())
|
||||
public targetUserId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public targetUser: User | null;
|
||||
|
@ -34,8 +34,8 @@ export class AbuseUserReport {
|
|||
@Column(id())
|
||||
public reporterId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public reporter: User | null;
|
||||
|
@ -46,40 +46,42 @@ export class AbuseUserReport {
|
|||
})
|
||||
public assigneeId: User["id"] | null;
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'SET NULL',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "SET NULL",
|
||||
})
|
||||
@JoinColumn()
|
||||
public assignee: User | null;
|
||||
|
||||
@Index()
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public resolved: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
default: false
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public forwarded: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 2048,
|
||||
})
|
||||
public comment: string;
|
||||
|
||||
//#region Denormalized fields
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
comment: '[Denormalized]',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public targetUserHost: string | null;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
comment: '[Denormalized]',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public reporterHost: string | null;
|
||||
//#endregion
|
||||
|
|
|
@ -15,31 +15,31 @@ export class AccessToken {
|
|||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the AccessToken.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the AccessToken.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
@Column("timestamp with time zone", {
|
||||
nullable: true,
|
||||
})
|
||||
public lastUsedAt: Date | null;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
})
|
||||
public token: string;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public session: string | null;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
})
|
||||
public hash: string;
|
||||
|
@ -48,8 +48,8 @@ export class AccessToken {
|
|||
@Column(id())
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
@ -60,37 +60,38 @@ export class AccessToken {
|
|||
})
|
||||
public appId: App["id"] | null;
|
||||
|
||||
@ManyToOne(type => App, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => App, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public app: App | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public name: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
})
|
||||
public description: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
})
|
||||
public iconUrl: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 64, array: true,
|
||||
default: '{}',
|
||||
@Column("varchar", {
|
||||
length: 64,
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public permission: string[];
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public fetched: boolean;
|
||||
|
|
|
@ -7,45 +7,51 @@ export class Ad {
|
|||
public id: string;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the Ad.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the Ad.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The expired date of the Ad.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The expired date of the Ad.",
|
||||
})
|
||||
public expiresAt: Date;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 32, nullable: false,
|
||||
@Column("varchar", {
|
||||
length: 32,
|
||||
nullable: false,
|
||||
})
|
||||
public place: string;
|
||||
|
||||
// 今は使われていないが将来的に活用される可能性はある
|
||||
@Column('varchar', {
|
||||
length: 32, nullable: false,
|
||||
@Column("varchar", {
|
||||
length: 32,
|
||||
nullable: false,
|
||||
})
|
||||
public priority: string;
|
||||
|
||||
@Column('integer', {
|
||||
default: 1, nullable: false,
|
||||
@Column("integer", {
|
||||
default: 1,
|
||||
nullable: false,
|
||||
})
|
||||
public ratio: number;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 1024, nullable: false,
|
||||
@Column("varchar", {
|
||||
length: 1024,
|
||||
nullable: false,
|
||||
})
|
||||
public url: string;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 1024, nullable: false,
|
||||
@Column("varchar", {
|
||||
length: 1024,
|
||||
nullable: false,
|
||||
})
|
||||
public imageUrl: string;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 8192, nullable: false,
|
||||
@Column("varchar", {
|
||||
length: 8192,
|
||||
nullable: false,
|
||||
})
|
||||
public memo: string;
|
||||
|
||||
|
|
|
@ -11,13 +11,13 @@ import { Announcement } from "./announcement.js";
|
|||
import { id } from "../id.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'announcementId'], { unique: true })
|
||||
@Index(["userId", "announcementId"], { unique: true })
|
||||
export class AnnouncementRead {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the AnnouncementRead.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the AnnouncementRead.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
|
@ -25,8 +25,8 @@ export class AnnouncementRead {
|
|||
@Column(id())
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
@ -35,8 +35,8 @@ export class AnnouncementRead {
|
|||
@Column(id())
|
||||
public announcementId: Announcement["id"];
|
||||
|
||||
@ManyToOne(type => Announcement, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => Announcement, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public announcement: Announcement | null;
|
||||
|
|
|
@ -7,29 +7,32 @@ export class Announcement {
|
|||
public id: string;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the Announcement.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the Announcement.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The updated date of the Announcement.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The updated date of the Announcement.",
|
||||
nullable: true,
|
||||
})
|
||||
public updatedAt: Date | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 8192, nullable: false,
|
||||
@Column("varchar", {
|
||||
length: 8192,
|
||||
nullable: false,
|
||||
})
|
||||
public text: string;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: false,
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
nullable: false,
|
||||
})
|
||||
public title: string;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 1024, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 1024,
|
||||
nullable: true,
|
||||
})
|
||||
public imageUrl: string | null;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import { Antenna } from "./antenna.js";
|
|||
import { id } from "../id.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['noteId', 'antennaId'], { unique: true })
|
||||
@Index(["noteId", "antennaId"], { unique: true })
|
||||
export class AntennaNote {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
@ -19,12 +19,12 @@ export class AntennaNote {
|
|||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The note ID.',
|
||||
comment: "The note ID.",
|
||||
})
|
||||
public noteId: Note["id"];
|
||||
|
||||
@ManyToOne(type => Note, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => Note, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public note: Note | null;
|
||||
|
@ -32,18 +32,18 @@ export class AntennaNote {
|
|||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The antenna ID.',
|
||||
comment: "The antenna ID.",
|
||||
})
|
||||
public antennaId: Antenna["id"];
|
||||
|
||||
@ManyToOne(type => Antenna, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => Antenna, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public antenna: Antenna | null;
|
||||
|
||||
@Index()
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public read: boolean;
|
||||
|
|
|
@ -16,31 +16,33 @@ export class Antenna {
|
|||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the Antenna.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the Antenna.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The owner ID.',
|
||||
comment: "The owner ID.",
|
||||
})
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
comment: 'The name of the Antenna.',
|
||||
comment: "The name of the Antenna.",
|
||||
})
|
||||
public name: string;
|
||||
|
||||
@Column('enum', { enum: ['home', 'all', 'users', 'list', 'group', 'instances'] })
|
||||
@Column("enum", {
|
||||
enum: ["home", "all", "users", "list", "group", "instances"],
|
||||
})
|
||||
public src: "home" | "all" | "users" | "list" | "group" | "instances";
|
||||
|
||||
@Column({
|
||||
|
@ -49,8 +51,8 @@ export class Antenna {
|
|||
})
|
||||
public userListId: UserList["id"] | null;
|
||||
|
||||
@ManyToOne(type => UserList, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => UserList, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public userList: UserList | null;
|
||||
|
@ -61,51 +63,53 @@ export class Antenna {
|
|||
})
|
||||
public userGroupJoiningId: UserGroupJoining["id"] | null;
|
||||
|
||||
@ManyToOne(type => UserGroupJoining, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => UserGroupJoining, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public userGroupJoining: UserGroupJoining | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 1024, array: true,
|
||||
default: '{}',
|
||||
@Column("varchar", {
|
||||
length: 1024,
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public users: string[];
|
||||
|
||||
@Column('jsonb', {
|
||||
@Column("jsonb", {
|
||||
default: [],
|
||||
})
|
||||
public instances: string[];
|
||||
|
||||
@Column('jsonb', {
|
||||
@Column("jsonb", {
|
||||
default: [],
|
||||
})
|
||||
public keywords: string[][];
|
||||
|
||||
@Column('jsonb', {
|
||||
@Column("jsonb", {
|
||||
default: [],
|
||||
})
|
||||
public excludeKeywords: string[][];
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public caseSensitive: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public withReplies: boolean;
|
||||
|
||||
@Column('boolean')
|
||||
@Column("boolean")
|
||||
public withFile: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 2048, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 2048,
|
||||
nullable: true,
|
||||
})
|
||||
public expression: string | null;
|
||||
|
||||
@Column('boolean')
|
||||
@Column("boolean")
|
||||
public notify: boolean;
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ export class App {
|
|||
public id: string;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the App.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the App.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
|
@ -17,44 +17,46 @@ export class App {
|
|||
@Column({
|
||||
...id(),
|
||||
nullable: true,
|
||||
comment: 'The owner ID.',
|
||||
comment: "The owner ID.",
|
||||
})
|
||||
public userId: User["id"] | null;
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'SET NULL',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "SET NULL",
|
||||
nullable: true,
|
||||
})
|
||||
public user: User | null;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 64,
|
||||
comment: 'The secret key of the App.',
|
||||
comment: "The secret key of the App.",
|
||||
})
|
||||
public secret: string;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
comment: 'The name of the App.',
|
||||
comment: "The name of the App.",
|
||||
})
|
||||
public name: string;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
comment: 'The description of the App.',
|
||||
comment: "The description of the App.",
|
||||
})
|
||||
public description: string;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 64, array: true,
|
||||
comment: 'The permission of the App.',
|
||||
@Column("varchar", {
|
||||
length: 64,
|
||||
array: true,
|
||||
comment: "The permission of the App.",
|
||||
})
|
||||
public permission: string[];
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
comment: 'The callbackUrl of the App.',
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
comment: "The callbackUrl of the App.",
|
||||
})
|
||||
public callbackUrl: string | null;
|
||||
}
|
||||
|
|
|
@ -18,27 +18,27 @@ export class AttestationChallenge {
|
|||
@PrimaryColumn(id())
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 64,
|
||||
comment: 'Hex-encoded sha256 hash of the challenge.',
|
||||
comment: "Hex-encoded sha256 hash of the challenge.",
|
||||
})
|
||||
public challenge: string;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The date challenge was created for expiry purposes.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The date challenge was created for expiry purposes.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
comment:
|
||||
'Indicates that the challenge is only for registration purposes if true to prevent the challenge for being used as authentication.',
|
||||
"Indicates that the challenge is only for registration purposes if true to prevent the challenge for being used as authentication.",
|
||||
default: false,
|
||||
})
|
||||
public registrationChallenge: boolean;
|
||||
|
|
|
@ -15,13 +15,13 @@ export class AuthSession {
|
|||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the AuthSession.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the AuthSession.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
})
|
||||
public token: string;
|
||||
|
@ -32,8 +32,8 @@ export class AuthSession {
|
|||
})
|
||||
public userId: User["id"] | null;
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
nullable: true,
|
||||
})
|
||||
@JoinColumn()
|
||||
|
@ -42,8 +42,8 @@ export class AuthSession {
|
|||
@Column(id())
|
||||
public appId: App["id"];
|
||||
|
||||
@ManyToOne(type => App, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => App, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public app: App | null;
|
||||
|
|
|
@ -10,26 +10,26 @@ import { User } from "./user.js";
|
|||
import { id } from "../id.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['blockerId', 'blockeeId'], { unique: true })
|
||||
@Index(["blockerId", "blockeeId"], { unique: true })
|
||||
export class Blocking {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the Blocking.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the Blocking.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The blockee user ID.',
|
||||
comment: "The blockee user ID.",
|
||||
})
|
||||
public blockeeId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public blockee: User | null;
|
||||
|
@ -37,12 +37,12 @@ export class Blocking {
|
|||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The blocker user ID.',
|
||||
comment: "The blocker user ID.",
|
||||
})
|
||||
public blockerId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public blocker: User | null;
|
||||
|
|
|
@ -11,26 +11,26 @@ import { id } from "../id.js";
|
|||
import { Channel } from "./channel.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['followerId', 'followeeId'], { unique: true })
|
||||
@Index(["followerId", "followeeId"], { unique: true })
|
||||
export class ChannelFollowing {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the ChannelFollowing.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the ChannelFollowing.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The followee channel ID.',
|
||||
comment: "The followee channel ID.",
|
||||
})
|
||||
public followeeId: Channel["id"];
|
||||
|
||||
@ManyToOne(type => Channel, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => Channel, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public followee: Channel | null;
|
||||
|
@ -38,12 +38,12 @@ export class ChannelFollowing {
|
|||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The follower user ID.',
|
||||
comment: "The follower user ID.",
|
||||
})
|
||||
public followerId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public follower: User | null;
|
||||
|
|
|
@ -11,13 +11,13 @@ import { Channel } from "./channel.js";
|
|||
import { id } from "../id.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['channelId', 'noteId'], { unique: true })
|
||||
@Index(["channelId", "noteId"], { unique: true })
|
||||
export class ChannelNotePining {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the ChannelNotePining.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the ChannelNotePining.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
|
@ -25,8 +25,8 @@ export class ChannelNotePining {
|
|||
@Column(id())
|
||||
public channelId: Channel["id"];
|
||||
|
||||
@ManyToOne(type => Channel, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => Channel, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public channel: Channel | null;
|
||||
|
@ -34,8 +34,8 @@ export class ChannelNotePining {
|
|||
@Column(id())
|
||||
public noteId: Note["id"];
|
||||
|
||||
@ManyToOne(type => Note, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => Note, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public note: Note | null;
|
||||
|
|
|
@ -16,13 +16,13 @@ export class Channel {
|
|||
public id: string;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the Channel.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the Channel.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
@Column("timestamp with time zone", {
|
||||
nullable: true,
|
||||
})
|
||||
public lastNotedAt: Date | null;
|
||||
|
@ -31,52 +31,53 @@ export class Channel {
|
|||
@Column({
|
||||
...id(),
|
||||
nullable: true,
|
||||
comment: 'The owner ID.',
|
||||
comment: "The owner ID.",
|
||||
})
|
||||
public userId: User["id"] | null;
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'SET NULL',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "SET NULL",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
comment: 'The name of the Channel.',
|
||||
comment: "The name of the Channel.",
|
||||
})
|
||||
public name: string;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 2048, nullable: true,
|
||||
comment: 'The description of the Channel.',
|
||||
@Column("varchar", {
|
||||
length: 2048,
|
||||
nullable: true,
|
||||
comment: "The description of the Channel.",
|
||||
})
|
||||
public description: string | null;
|
||||
|
||||
@Column({
|
||||
...id(),
|
||||
nullable: true,
|
||||
comment: 'The ID of banner Channel.',
|
||||
comment: "The ID of banner Channel.",
|
||||
})
|
||||
public bannerId: DriveFile["id"] | null;
|
||||
|
||||
@ManyToOne(type => DriveFile, {
|
||||
onDelete: 'SET NULL',
|
||||
@ManyToOne((type) => DriveFile, {
|
||||
onDelete: "SET NULL",
|
||||
})
|
||||
@JoinColumn()
|
||||
public banner: DriveFile | null;
|
||||
|
||||
@Index()
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
default: 0,
|
||||
comment: 'The count of notes.',
|
||||
comment: "The count of notes.",
|
||||
})
|
||||
public notesCount: number;
|
||||
|
||||
@Index()
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
default: 0,
|
||||
comment: 'The count of users.',
|
||||
comment: "The count of users.",
|
||||
})
|
||||
public usersCount: number;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import { Clip } from "./clip.js";
|
|||
import { id } from "../id.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['noteId', 'clipId'], { unique: true })
|
||||
@Index(["noteId", "clipId"], { unique: true })
|
||||
export class ClipNote {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
@ -19,12 +19,12 @@ export class ClipNote {
|
|||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The note ID.',
|
||||
comment: "The note ID.",
|
||||
})
|
||||
public noteId: Note["id"];
|
||||
|
||||
@ManyToOne(type => Note, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => Note, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public note: Note | null;
|
||||
|
@ -32,12 +32,12 @@ export class ClipNote {
|
|||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The clip ID.',
|
||||
comment: "The clip ID.",
|
||||
})
|
||||
public clipId: Clip["id"];
|
||||
|
||||
@ManyToOne(type => Clip, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => Clip, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public clip: Clip | null;
|
||||
|
|
|
@ -14,38 +14,39 @@ export class Clip {
|
|||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the Clip.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the Clip.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The owner ID.',
|
||||
comment: "The owner ID.",
|
||||
})
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
comment: 'The name of the Clip.',
|
||||
comment: "The name of the Clip.",
|
||||
})
|
||||
public name: string;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public isPublic: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 2048, nullable: true,
|
||||
comment: 'The description of the Clip.',
|
||||
@Column("varchar", {
|
||||
length: 2048,
|
||||
nullable: true,
|
||||
comment: "The description of the Clip.",
|
||||
})
|
||||
public description: string | null;
|
||||
}
|
||||
|
|
|
@ -12,14 +12,14 @@ import { DriveFolder } from "./drive-folder.js";
|
|||
import { DB_MAX_IMAGE_COMMENT_LENGTH } from "@/misc/hard-limits.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'folderId', 'id'])
|
||||
@Index(["userId", "folderId", "id"])
|
||||
export class DriveFile {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the DriveFile.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the DriveFile.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
|
@ -27,64 +27,67 @@ export class DriveFile {
|
|||
@Column({
|
||||
...id(),
|
||||
nullable: true,
|
||||
comment: 'The owner ID.',
|
||||
comment: "The owner ID.",
|
||||
})
|
||||
public userId: User["id"] | null;
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'SET NULL',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "SET NULL",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
comment: 'The host of owner. It will be null if the user in local.',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
comment: "The host of owner. It will be null if the user in local.",
|
||||
})
|
||||
public userHost: string | null;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 32,
|
||||
comment: 'The MD5 hash of the DriveFile.',
|
||||
comment: "The MD5 hash of the DriveFile.",
|
||||
})
|
||||
public md5: string;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
comment: 'The file name of the DriveFile.',
|
||||
comment: "The file name of the DriveFile.",
|
||||
})
|
||||
public name: string;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
comment: 'The content type (MIME) of the DriveFile.',
|
||||
comment: "The content type (MIME) of the DriveFile.",
|
||||
})
|
||||
public type: string;
|
||||
|
||||
@Column('integer', {
|
||||
comment: 'The file size (bytes) of the DriveFile.',
|
||||
@Column("integer", {
|
||||
comment: "The file size (bytes) of the DriveFile.",
|
||||
})
|
||||
public size: number;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: DB_MAX_IMAGE_COMMENT_LENGTH,
|
||||
nullable: true,
|
||||
comment: 'The comment of the DriveFile.',
|
||||
comment: "The comment of the DriveFile.",
|
||||
})
|
||||
public comment: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
comment: 'The BlurHash string.',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
comment: "The BlurHash string.",
|
||||
})
|
||||
public blurhash: string | null;
|
||||
|
||||
@Column('jsonb', {
|
||||
@Column("jsonb", {
|
||||
default: {},
|
||||
comment: 'The any properties of the DriveFile. For example, it includes image width/height.',
|
||||
comment:
|
||||
"The any properties of the DriveFile. For example, it includes image width/height.",
|
||||
})
|
||||
public properties: {
|
||||
width?: number;
|
||||
|
@ -93,59 +96,68 @@ export class DriveFile {
|
|||
avgColor?: string;
|
||||
};
|
||||
|
||||
@Column('boolean')
|
||||
@Column("boolean")
|
||||
public storedInternal: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
comment: 'The URL of the DriveFile.',
|
||||
comment: "The URL of the DriveFile.",
|
||||
})
|
||||
public url: string;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
comment: 'The URL of the thumbnail of the DriveFile.',
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
comment: "The URL of the thumbnail of the DriveFile.",
|
||||
})
|
||||
public thumbnailUrl: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
comment: 'The URL of the webpublic of the DriveFile.',
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
comment: "The URL of the webpublic of the DriveFile.",
|
||||
})
|
||||
public webpublicUrl: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public webpublicType: string | null;
|
||||
|
||||
@Index({ unique: true })
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
nullable: true,
|
||||
})
|
||||
public accessKey: string | null;
|
||||
|
||||
@Index({ unique: true })
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
nullable: true,
|
||||
})
|
||||
public thumbnailAccessKey: string | null;
|
||||
|
||||
@Index({ unique: true })
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
nullable: true,
|
||||
})
|
||||
public webpublicAccessKey: string | null;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
comment: 'The URI of the DriveFile. it will be null when the DriveFile is local.',
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
comment:
|
||||
"The URI of the DriveFile. it will be null when the DriveFile is local.",
|
||||
})
|
||||
public uri: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
})
|
||||
public src: string | null;
|
||||
|
||||
|
@ -153,32 +165,33 @@ export class DriveFile {
|
|||
@Column({
|
||||
...id(),
|
||||
nullable: true,
|
||||
comment: 'The parent folder ID. If null, it means the DriveFile is located in root.',
|
||||
comment:
|
||||
"The parent folder ID. If null, it means the DriveFile is located in root.",
|
||||
})
|
||||
public folderId: DriveFolder["id"] | null;
|
||||
|
||||
@ManyToOne(type => DriveFolder, {
|
||||
onDelete: 'SET NULL',
|
||||
@ManyToOne((type) => DriveFolder, {
|
||||
onDelete: "SET NULL",
|
||||
})
|
||||
@JoinColumn()
|
||||
public folder: DriveFolder | null;
|
||||
|
||||
@Index()
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
comment: 'Whether the DriveFile is NSFW.',
|
||||
comment: "Whether the DriveFile is NSFW.",
|
||||
})
|
||||
public isSensitive: boolean;
|
||||
|
||||
@Index()
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
comment: 'Whether the DriveFile is NSFW. (predict)',
|
||||
comment: "Whether the DriveFile is NSFW. (predict)",
|
||||
})
|
||||
public maybeSensitive: boolean;
|
||||
|
||||
@Index()
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public maybePorn: boolean;
|
||||
|
@ -187,20 +200,21 @@ export class DriveFile {
|
|||
* 外部の(信頼されていない)URLへの直リンクか否か
|
||||
*/
|
||||
@Index()
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
comment: 'Whether the DriveFile is direct link to remote server.',
|
||||
comment: "Whether the DriveFile is direct link to remote server.",
|
||||
})
|
||||
public isLink: boolean;
|
||||
|
||||
@Column('jsonb', {
|
||||
@Column("jsonb", {
|
||||
default: {},
|
||||
nullable: true,
|
||||
})
|
||||
public requestHeaders: Record<string, string> | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public requestIp: string | null;
|
||||
}
|
||||
|
|
|
@ -15,14 +15,14 @@ export class DriveFolder {
|
|||
public id: string;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the DriveFolder.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the DriveFolder.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
comment: 'The name of the DriveFolder.',
|
||||
comment: "The name of the DriveFolder.",
|
||||
})
|
||||
public name: string;
|
||||
|
||||
|
@ -30,12 +30,12 @@ export class DriveFolder {
|
|||
@Column({
|
||||
...id(),
|
||||
nullable: true,
|
||||
comment: 'The owner ID.',
|
||||
comment: "The owner ID.",
|
||||
})
|
||||
public userId: User["id"] | null;
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
@ -44,12 +44,13 @@ export class DriveFolder {
|
|||
@Column({
|
||||
...id(),
|
||||
nullable: true,
|
||||
comment: 'The parent folder ID. If null, it means the DriveFolder is located in root.',
|
||||
comment:
|
||||
"The parent folder ID. If null, it means the DriveFolder is located in root.",
|
||||
})
|
||||
public parentId: DriveFolder["id"] | null;
|
||||
|
||||
@ManyToOne(type => DriveFolder, {
|
||||
onDelete: 'SET NULL',
|
||||
@ManyToOne((type) => DriveFolder, {
|
||||
onDelete: "SET NULL",
|
||||
})
|
||||
@JoinColumn()
|
||||
public parent: DriveFolder | null;
|
||||
|
|
|
@ -2,73 +2,82 @@ import { PrimaryColumn, Entity, Index, Column } from "typeorm";
|
|||
import { id } from "../id.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['name', 'host'], { unique: true })
|
||||
@Index(["name", "host"], { unique: true })
|
||||
export class Emoji {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
@Column("timestamp with time zone", {
|
||||
nullable: true,
|
||||
})
|
||||
public updatedAt: Date | null;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
})
|
||||
public name: string;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public host: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public category: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
})
|
||||
public originalUrl: string;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
default: '',
|
||||
default: "",
|
||||
})
|
||||
public publicUrl: string;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
})
|
||||
public uri: string | null;
|
||||
|
||||
// publicUrlの方のtypeが入る
|
||||
// (mime)
|
||||
@Column('varchar', {
|
||||
length: 64, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 64,
|
||||
nullable: true,
|
||||
})
|
||||
public type: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
array: true, length: 128, default: '{}',
|
||||
@Column("varchar", {
|
||||
array: true,
|
||||
length: 128,
|
||||
default: "{}",
|
||||
})
|
||||
public aliases: string[];
|
||||
|
||||
@Column('varchar', {
|
||||
length: 1024, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 1024,
|
||||
nullable: true,
|
||||
})
|
||||
public license: string | null;
|
||||
|
||||
@Column('integer', {
|
||||
nullable: true, comment: 'Image width',
|
||||
@Column("integer", {
|
||||
nullable: true,
|
||||
comment: "Image width",
|
||||
})
|
||||
public width: number | null;
|
||||
|
||||
@Column('integer', {
|
||||
nullable: true, comment: "Image height",
|
||||
@Column("integer", {
|
||||
nullable: true,
|
||||
comment: "Image height",
|
||||
})
|
||||
public height: number | null;
|
||||
}
|
||||
|
|
|
@ -10,25 +10,25 @@ import { User } from "./user.js";
|
|||
import { id } from "../id.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['followerId', 'followeeId'], { unique: true })
|
||||
@Index(["followerId", "followeeId"], { unique: true })
|
||||
export class FollowRequest {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the FollowRequest.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the FollowRequest.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The followee user ID.',
|
||||
comment: "The followee user ID.",
|
||||
})
|
||||
public followeeId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public followee: User | null;
|
||||
|
@ -36,56 +36,63 @@ export class FollowRequest {
|
|||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The follower user ID.',
|
||||
comment: "The follower user ID.",
|
||||
})
|
||||
public followerId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public follower: User | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
comment: 'id of Follow Activity.',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
comment: "id of Follow Activity.",
|
||||
})
|
||||
public requestId: string | null;
|
||||
|
||||
//#region Denormalized fields
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
comment: '[Denormalized]',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public followerHost: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
comment: '[Denormalized]',
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public followerInbox: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
comment: '[Denormalized]',
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public followerSharedInbox: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
comment: '[Denormalized]',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public followeeHost: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
comment: '[Denormalized]',
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public followeeInbox: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
comment: '[Denormalized]',
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public followeeSharedInbox: string | null;
|
||||
//#endregion
|
||||
|
|
|
@ -10,26 +10,26 @@ import { User } from "./user.js";
|
|||
import { id } from "../id.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['followerId', 'followeeId'], { unique: true })
|
||||
@Index(["followerId", "followeeId"], { unique: true })
|
||||
export class Following {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the Following.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the Following.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The followee user ID.',
|
||||
comment: "The followee user ID.",
|
||||
})
|
||||
public followeeId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public followee: User | null;
|
||||
|
@ -37,52 +37,58 @@ export class Following {
|
|||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The follower user ID.',
|
||||
comment: "The follower user ID.",
|
||||
})
|
||||
public followerId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public follower: User | null;
|
||||
|
||||
//#region Denormalized fields
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
comment: '[Denormalized]',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public followerHost: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
comment: '[Denormalized]',
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public followerInbox: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
comment: '[Denormalized]',
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public followerSharedInbox: string | null;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
comment: '[Denormalized]',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public followeeHost: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
comment: '[Denormalized]',
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public followeeInbox: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
comment: '[Denormalized]',
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public followeeSharedInbox: string | null;
|
||||
//#endregion
|
||||
|
|
|
@ -11,20 +11,20 @@ import { id } from "../id.js";
|
|||
import { GalleryPost } from "./gallery-post.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'postId'], { unique: true })
|
||||
@Index(["userId", "postId"], { unique: true })
|
||||
export class GalleryLike {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone')
|
||||
@Column("timestamp with time zone")
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column(id())
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
@ -32,8 +32,8 @@ export class GalleryLike {
|
|||
@Column(id())
|
||||
public postId: GalleryPost["id"];
|
||||
|
||||
@ManyToOne(type => GalleryPost, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => GalleryPost, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public post: GalleryPost | null;
|
||||
|
|
|
@ -16,36 +16,37 @@ export class GalleryPost {
|
|||
public id: string;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the GalleryPost.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the GalleryPost.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The updated date of the GalleryPost.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The updated date of the GalleryPost.",
|
||||
})
|
||||
public updatedAt: Date;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
})
|
||||
public title: string;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 2048, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 2048,
|
||||
nullable: true,
|
||||
})
|
||||
public description: string | null;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The ID of author.',
|
||||
comment: "The ID of author.",
|
||||
})
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
@ -53,26 +54,29 @@ export class GalleryPost {
|
|||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
array: true, default: '{}',
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public fileIds: DriveFile["id"][];
|
||||
|
||||
@Index()
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
comment: 'Whether the post is sensitive.',
|
||||
comment: "Whether the post is sensitive.",
|
||||
})
|
||||
public isSensitive: boolean;
|
||||
|
||||
@Index()
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
default: 0,
|
||||
})
|
||||
public likedCount: number;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
length: 128, array: true, default: '{}',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public tags: string[];
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ export class Hashtag {
|
|||
public id: string;
|
||||
|
||||
@Index({ unique: true })
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
})
|
||||
public name: string;
|
||||
|
@ -20,7 +20,7 @@ export class Hashtag {
|
|||
public mentionedUserIds: User["id"][];
|
||||
|
||||
@Index()
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
default: 0,
|
||||
})
|
||||
public mentionedUsersCount: number;
|
||||
|
@ -32,7 +32,7 @@ export class Hashtag {
|
|||
public mentionedLocalUserIds: User["id"][];
|
||||
|
||||
@Index()
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
default: 0,
|
||||
})
|
||||
public mentionedLocalUsersCount: number;
|
||||
|
@ -44,7 +44,7 @@ export class Hashtag {
|
|||
public mentionedRemoteUserIds: User["id"][];
|
||||
|
||||
@Index()
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
default: 0,
|
||||
})
|
||||
public mentionedRemoteUsersCount: number;
|
||||
|
@ -56,7 +56,7 @@ export class Hashtag {
|
|||
public attachedUserIds: User["id"][];
|
||||
|
||||
@Index()
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
default: 0,
|
||||
})
|
||||
public attachedUsersCount: number;
|
||||
|
@ -68,7 +68,7 @@ export class Hashtag {
|
|||
public attachedLocalUserIds: User["id"][];
|
||||
|
||||
@Index()
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
default: 0,
|
||||
})
|
||||
public attachedLocalUsersCount: number;
|
||||
|
@ -80,7 +80,7 @@ export class Hashtag {
|
|||
public attachedRemoteUserIds: User["id"][];
|
||||
|
||||
@Index()
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
default: 0,
|
||||
})
|
||||
public attachedRemoteUsersCount: number;
|
||||
|
|
|
@ -10,8 +10,8 @@ export class Instance {
|
|||
* このインスタンスを捕捉した日時
|
||||
*/
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The caught date of the Instance.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The caught date of the Instance.",
|
||||
})
|
||||
public caughtAt: Date;
|
||||
|
||||
|
@ -19,34 +19,34 @@ export class Instance {
|
|||
* ホスト
|
||||
*/
|
||||
@Index({ unique: true })
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
comment: 'The host of the Instance.',
|
||||
comment: "The host of the Instance.",
|
||||
})
|
||||
public host: string;
|
||||
|
||||
/**
|
||||
* インスタンスのユーザー数
|
||||
*/
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
default: 0,
|
||||
comment: 'The count of the users of the Instance.',
|
||||
comment: "The count of the users of the Instance.",
|
||||
})
|
||||
public usersCount: number;
|
||||
|
||||
/**
|
||||
* インスタンスの投稿数
|
||||
*/
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
default: 0,
|
||||
comment: 'The count of the notes of the Instance.',
|
||||
comment: "The count of the notes of the Instance.",
|
||||
})
|
||||
public notesCount: number;
|
||||
|
||||
/**
|
||||
* このインスタンスのユーザーからフォローされている、自インスタンスのユーザーの数
|
||||
*/
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
default: 0,
|
||||
})
|
||||
public followingCount: number;
|
||||
|
@ -54,7 +54,7 @@ export class Instance {
|
|||
/**
|
||||
* このインスタンスのユーザーをフォローしている、自インスタンスのユーザーの数
|
||||
*/
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
default: 0,
|
||||
})
|
||||
public followersCount: number;
|
||||
|
@ -62,7 +62,7 @@ export class Instance {
|
|||
/**
|
||||
* 直近のリクエスト送信日時
|
||||
*/
|
||||
@Column('timestamp with time zone', {
|
||||
@Column("timestamp with time zone", {
|
||||
nullable: true,
|
||||
})
|
||||
public latestRequestSentAt: Date | null;
|
||||
|
@ -70,7 +70,7 @@ export class Instance {
|
|||
/**
|
||||
* 直近のリクエスト送信時のHTTPステータスコード
|
||||
*/
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
nullable: true,
|
||||
})
|
||||
public latestStatus: number | null;
|
||||
|
@ -78,7 +78,7 @@ export class Instance {
|
|||
/**
|
||||
* 直近のリクエスト受信日時
|
||||
*/
|
||||
@Column('timestamp with time zone', {
|
||||
@Column("timestamp with time zone", {
|
||||
nullable: true,
|
||||
})
|
||||
public latestRequestReceivedAt: Date | null;
|
||||
|
@ -86,13 +86,13 @@ export class Instance {
|
|||
/**
|
||||
* このインスタンスと最後にやり取りした日時
|
||||
*/
|
||||
@Column('timestamp with time zone')
|
||||
@Column("timestamp with time zone")
|
||||
public lastCommunicatedAt: Date;
|
||||
|
||||
/**
|
||||
* このインスタンスと不通かどうか
|
||||
*/
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public isNotResponding: boolean;
|
||||
|
@ -101,63 +101,72 @@ export class Instance {
|
|||
* このインスタンスへの配信を停止するか
|
||||
*/
|
||||
@Index()
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public isSuspended: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 64, nullable: true,
|
||||
comment: 'The software of the Instance.',
|
||||
@Column("varchar", {
|
||||
length: 64,
|
||||
nullable: true,
|
||||
comment: "The software of the Instance.",
|
||||
})
|
||||
public softwareName: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 64, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 64,
|
||||
nullable: true,
|
||||
})
|
||||
public softwareVersion: string | null;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
nullable: true,
|
||||
})
|
||||
public openRegistrations: boolean | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
nullable: true,
|
||||
})
|
||||
public name: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 4096, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 4096,
|
||||
nullable: true,
|
||||
})
|
||||
public description: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public maintainerName: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
nullable: true,
|
||||
})
|
||||
public maintainerEmail: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
nullable: true,
|
||||
})
|
||||
public iconUrl: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
nullable: true,
|
||||
})
|
||||
public faviconUrl: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 64, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 64,
|
||||
nullable: true,
|
||||
})
|
||||
public themeColor: string | null;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
@Column("timestamp with time zone", {
|
||||
nullable: true,
|
||||
})
|
||||
public infoUpdatedAt: Date | null;
|
||||
|
|
|
@ -17,68 +17,73 @@ export class MessagingMessage {
|
|||
public id: string;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the MessagingMessage.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the MessagingMessage.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The sender user ID.',
|
||||
comment: "The sender user ID.",
|
||||
})
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(), nullable: true,
|
||||
comment: 'The recipient user ID.',
|
||||
...id(),
|
||||
nullable: true,
|
||||
comment: "The recipient user ID.",
|
||||
})
|
||||
public recipientId: User["id"] | null;
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public recipient: User | null;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(), nullable: true,
|
||||
comment: 'The recipient group ID.',
|
||||
...id(),
|
||||
nullable: true,
|
||||
comment: "The recipient group ID.",
|
||||
})
|
||||
public groupId: UserGroup["id"] | null;
|
||||
|
||||
@ManyToOne(type => UserGroup, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => UserGroup, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public group: UserGroup | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 4096, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 4096,
|
||||
nullable: true,
|
||||
})
|
||||
public text: string | null;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public isRead: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
})
|
||||
public uri: string | null;
|
||||
|
||||
@Column({
|
||||
...id(),
|
||||
array: true, default: '{}',
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public reads: User["id"][];
|
||||
|
||||
|
@ -88,8 +93,8 @@ export class MessagingMessage {
|
|||
})
|
||||
public fileId: DriveFile["id"] | null;
|
||||
|
||||
@ManyToOne(type => DriveFile, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => DriveFile, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public file: DriveFile | null;
|
||||
|
|
|
@ -6,119 +6,144 @@ import type { Clip } from "./clip.js";
|
|||
@Entity()
|
||||
export class Meta {
|
||||
@PrimaryColumn({
|
||||
type: 'varchar',
|
||||
type: "varchar",
|
||||
length: 32,
|
||||
})
|
||||
public id: string;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public name: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 1024, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 1024,
|
||||
nullable: true,
|
||||
})
|
||||
public description: string | null;
|
||||
|
||||
/**
|
||||
* メンテナの名前
|
||||
*/
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public maintainerName: string | null;
|
||||
|
||||
/**
|
||||
* メンテナの連絡先
|
||||
*/
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public maintainerEmail: string | null;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public disableRegistration: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public disableLocalTimeline: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: true,
|
||||
})
|
||||
public disableRecommendedTimeline: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public disableGlobalTimeline: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, default: '⭐',
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
default: "⭐",
|
||||
})
|
||||
public defaultReaction: string;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 64, array: true, default: '{}',
|
||||
@Column("varchar", {
|
||||
length: 64,
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public langs: string[];
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, array: true, default: '{}',
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public pinnedUsers: string[];
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, array: true, default: '{}',
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public recommendedInstances: string[];
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, array: true, default: '{}',
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public customMOTD: string[];
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, array: true, default: '{}',
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public customSplashIcons: string[];
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, array: true, default: '{}',
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public hiddenTags: string[];
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, array: true, default: '{}',
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public blockedHosts: string[];
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, array: true, default: '{}',
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public silencedHosts: string[];
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public secureMode: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public privateMode: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, array: true, default: '{}',
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public allowedHosts: string[];
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512, array: true, default: '{/featured,/channels,/explore,/pages,/about-calckey}',
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
array: true,
|
||||
default: "{/featured,/channels,/explore,/pages,/about-calckey}",
|
||||
})
|
||||
public pinnedPages: string[];
|
||||
|
||||
|
@ -128,51 +153,51 @@ export class Meta {
|
|||
})
|
||||
public pinnedClipId: Clip["id"] | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
})
|
||||
public themeColor: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
default: '/assets/ai.png',
|
||||
default: "/assets/ai.png",
|
||||
})
|
||||
public mascotImageUrl: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
})
|
||||
public bannerUrl: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
})
|
||||
public backgroundImageUrl: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
})
|
||||
public logoImageUrl: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
default: 'https://xn--931a.moe/aiart/yubitun.png',
|
||||
default: "https://xn--931a.moe/aiart/yubitun.png",
|
||||
})
|
||||
public errorImageUrl: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
})
|
||||
public iconUrl: string | null;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: true,
|
||||
})
|
||||
public cacheRemoteFiles: boolean;
|
||||
|
@ -183,60 +208,60 @@ export class Meta {
|
|||
})
|
||||
public proxyAccountId: User["id"] | null;
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'SET NULL',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "SET NULL",
|
||||
})
|
||||
@JoinColumn()
|
||||
public proxyAccount: User | null;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public emailRequiredForSignup: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public enableHcaptcha: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 64,
|
||||
nullable: true,
|
||||
})
|
||||
public hcaptchaSiteKey: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 64,
|
||||
nullable: true,
|
||||
})
|
||||
public hcaptchaSecretKey: string | null;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public enableRecaptcha: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 64,
|
||||
nullable: true,
|
||||
})
|
||||
public recaptchaSiteKey: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 64,
|
||||
nullable: true,
|
||||
})
|
||||
public recaptchaSecretKey: string | null;
|
||||
|
||||
@Column('enum', {
|
||||
enum: ['none', 'all', 'local', 'remote'],
|
||||
default: 'none',
|
||||
@Column("enum", {
|
||||
enum: ["none", "all", "local", "remote"],
|
||||
default: "none",
|
||||
})
|
||||
public sensitiveMediaDetection: "none" | "all" | "local" | "remote";
|
||||
|
||||
@Column('enum', {
|
||||
enum: ['medium', 'low', 'high', 'veryLow', 'veryHigh'],
|
||||
default: 'medium',
|
||||
@Column("enum", {
|
||||
enum: ["medium", "low", "high", "veryLow", "veryHigh"],
|
||||
default: "medium",
|
||||
})
|
||||
public sensitiveMediaDetectionSensitivity:
|
||||
| "medium"
|
||||
|
@ -245,279 +270,279 @@ export class Meta {
|
|||
| "veryLow"
|
||||
| "veryHigh";
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public setSensitiveFlagAutomatically: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public enableSensitiveMediaDetectionForVideos: boolean;
|
||||
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
default: 1024,
|
||||
comment: 'Drive capacity of a local user (MB)',
|
||||
comment: "Drive capacity of a local user (MB)",
|
||||
})
|
||||
public localDriveCapacityMb: number;
|
||||
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
default: 32,
|
||||
comment: 'Drive capacity of a remote user (MB)',
|
||||
comment: "Drive capacity of a remote user (MB)",
|
||||
})
|
||||
public remoteDriveCapacityMb: number;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public summalyProxy: string | null;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public enableEmail: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public email: string | null;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public smtpSecure: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public smtpHost: string | null;
|
||||
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
nullable: true,
|
||||
})
|
||||
public smtpPort: number | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public smtpUser: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public smtpPass: string | null;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public enableServiceWorker: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public swPublicKey: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public swPrivateKey: string | null;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public enableTwitterIntegration: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public twitterConsumerKey: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public twitterConsumerSecret: string | null;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public enableGithubIntegration: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public githubClientId: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public githubClientSecret: string | null;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public enableDiscordIntegration: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public discordClientId: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public discordClientSecret: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public deeplAuthKey: string | null;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public deeplIsPro: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
})
|
||||
public libreTranslateApiUrl: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public libreTranslateApiKey: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
})
|
||||
public ToSUrl: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
default: 'https://codeberg.org/calckey/calckey',
|
||||
default: "https://codeberg.org/calckey/calckey",
|
||||
nullable: false,
|
||||
})
|
||||
public repositoryUrl: string;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
default: 'https://codeberg.org/calckey/calckey/issues/new',
|
||||
default: "https://codeberg.org/calckey/calckey/issues/new",
|
||||
nullable: true,
|
||||
})
|
||||
public feedbackUrl: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 8192,
|
||||
nullable: true,
|
||||
})
|
||||
public defaultLightTheme: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 8192,
|
||||
nullable: true,
|
||||
})
|
||||
public defaultDarkTheme: string | null;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public useObjectStorage: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
})
|
||||
public objectStorageBucket: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
})
|
||||
public objectStoragePrefix: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
})
|
||||
public objectStorageBaseUrl: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
})
|
||||
public objectStorageEndpoint: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
})
|
||||
public objectStorageRegion: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
})
|
||||
public objectStorageAccessKey: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
})
|
||||
public objectStorageSecretKey: string | null;
|
||||
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
nullable: true,
|
||||
})
|
||||
public objectStoragePort: number | null;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: true,
|
||||
})
|
||||
public objectStorageUseSSL: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: true,
|
||||
})
|
||||
public objectStorageUseProxy: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public objectStorageSetPublicRead: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: true,
|
||||
})
|
||||
public objectStorageS3ForcePathStyle: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public enableIpLogging: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: true,
|
||||
})
|
||||
public enableActiveEmailValidation: boolean;
|
||||
|
||||
@Column('jsonb', {
|
||||
@Column("jsonb", {
|
||||
default: {},
|
||||
})
|
||||
public experimentalFeatures: Record<string, unknown>;
|
||||
|
|
|
@ -14,8 +14,8 @@ export class ModerationLog {
|
|||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the ModerationLog.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the ModerationLog.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
|
@ -23,17 +23,17 @@ export class ModerationLog {
|
|||
@Column(id())
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
})
|
||||
public type: string;
|
||||
|
||||
@Column('jsonb')
|
||||
@Column("jsonb")
|
||||
public info: Record<string, any>;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import { id } from "../id.js";
|
|||
import { mutedNoteReasons } from "../../types.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['noteId', 'userId'], { unique: true })
|
||||
@Index(["noteId", "userId"], { unique: true })
|
||||
export class MutedNote {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
@ -20,12 +20,12 @@ export class MutedNote {
|
|||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The note ID.',
|
||||
comment: "The note ID.",
|
||||
})
|
||||
public noteId: Note["id"];
|
||||
|
||||
@ManyToOne(type => Note, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => Note, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public note: Note | null;
|
||||
|
@ -33,12 +33,12 @@ export class MutedNote {
|
|||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The user ID.',
|
||||
comment: "The user ID.",
|
||||
})
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
@ -47,9 +47,9 @@ export class MutedNote {
|
|||
* ミュートされた理由。
|
||||
*/
|
||||
@Index()
|
||||
@Column('enum', {
|
||||
@Column("enum", {
|
||||
enum: mutedNoteReasons,
|
||||
comment: 'The reason of the MutedNote.',
|
||||
comment: "The reason of the MutedNote.",
|
||||
})
|
||||
public reason: typeof mutedNoteReasons[number];
|
||||
}
|
||||
|
|
|
@ -10,19 +10,19 @@ import { User } from "./user.js";
|
|||
import { id } from "../id.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['muterId', 'muteeId'], { unique: true })
|
||||
@Index(["muterId", "muteeId"], { unique: true })
|
||||
export class Muting {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the Muting.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the Muting.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
@Column("timestamp with time zone", {
|
||||
nullable: true,
|
||||
})
|
||||
public expiresAt: Date | null;
|
||||
|
@ -30,12 +30,12 @@ export class Muting {
|
|||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The mutee user ID.',
|
||||
comment: "The mutee user ID.",
|
||||
})
|
||||
public muteeId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public mutee: User | null;
|
||||
|
@ -43,12 +43,12 @@ export class Muting {
|
|||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The muter user ID.',
|
||||
comment: "The muter user ID.",
|
||||
})
|
||||
public muterId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public muter: User | null;
|
||||
|
|
|
@ -18,34 +18,36 @@ export class NoteEdit {
|
|||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The ID of note.',
|
||||
comment: "The ID of note.",
|
||||
})
|
||||
public noteId: Note["id"];
|
||||
|
||||
@ManyToOne(type => Note, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => Note, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public note: Note | null;
|
||||
|
||||
@Column('text', {
|
||||
@Column("text", {
|
||||
nullable: true,
|
||||
})
|
||||
public text: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
})
|
||||
public cw: string | null;
|
||||
|
||||
@Column({
|
||||
...id(),
|
||||
array: true, default: '{}',
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public fileIds: DriveFile["id"][];
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The updated date of the Note.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The updated date of the Note.",
|
||||
})
|
||||
public updatedAt: Date;
|
||||
}
|
||||
|
|
|
@ -11,13 +11,13 @@ import { User } from "./user.js";
|
|||
import { id } from "../id.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'noteId'], { unique: true })
|
||||
@Index(["userId", "noteId"], { unique: true })
|
||||
export class NoteFavorite {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the NoteFavorite.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the NoteFavorite.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
|
@ -25,8 +25,8 @@ export class NoteFavorite {
|
|||
@Column(id())
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
@ -34,8 +34,8 @@ export class NoteFavorite {
|
|||
@Column(id())
|
||||
public noteId: Note["id"];
|
||||
|
||||
@ManyToOne(type => Note, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => Note, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public note: Note | null;
|
||||
|
|
|
@ -11,14 +11,14 @@ import { Note } from "./note.js";
|
|||
import { id } from "../id.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'noteId'], { unique: true })
|
||||
@Index(["userId", "noteId"], { unique: true })
|
||||
export class NoteReaction {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the NoteReaction.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the NoteReaction.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
|
@ -26,8 +26,8 @@ export class NoteReaction {
|
|||
@Column(id())
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user?: User | null;
|
||||
|
@ -36,15 +36,15 @@ export class NoteReaction {
|
|||
@Column(id())
|
||||
public noteId: Note["id"];
|
||||
|
||||
@ManyToOne(type => Note, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => Note, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public note?: Note | null;
|
||||
|
||||
// TODO: 対象noteのuserIdを非正規化したい(「受け取ったリアクション一覧」のようなものを(JOIN無しで)実装したいため)
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 260,
|
||||
})
|
||||
public reaction: string;
|
||||
|
|
|
@ -11,13 +11,12 @@ import { Note } from "./note.js";
|
|||
import { id } from "../id.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'threadId'], { unique: true })
|
||||
@Index(["userId", "threadId"], { unique: true })
|
||||
export class NoteThreadMuting {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
})
|
||||
@Column("timestamp with time zone", {})
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
|
@ -26,14 +25,14 @@ export class NoteThreadMuting {
|
|||
})
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
})
|
||||
public threadId: string;
|
||||
|
|
|
@ -12,7 +12,7 @@ import { id } from "../id.js";
|
|||
import type { Channel } from "./channel.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'noteId'], { unique: true })
|
||||
@Index(["userId", "noteId"], { unique: true })
|
||||
export class NoteUnread {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
@ -21,8 +21,8 @@ export class NoteUnread {
|
|||
@Column(id())
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
@ -31,8 +31,8 @@ export class NoteUnread {
|
|||
@Column(id())
|
||||
public noteId: Note["id"];
|
||||
|
||||
@ManyToOne(type => Note, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => Note, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public note: Note | null;
|
||||
|
@ -41,21 +41,21 @@ export class NoteUnread {
|
|||
* メンションか否か
|
||||
*/
|
||||
@Index()
|
||||
@Column('boolean')
|
||||
@Column("boolean")
|
||||
public isMentioned: boolean;
|
||||
|
||||
/**
|
||||
* ダイレクト投稿か否か
|
||||
*/
|
||||
@Index()
|
||||
@Column('boolean')
|
||||
@Column("boolean")
|
||||
public isSpecified: boolean;
|
||||
|
||||
//#region Denormalized fields
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: '[Denormalized]',
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public noteUserId: User["id"];
|
||||
|
||||
|
@ -63,7 +63,7 @@ export class NoteUnread {
|
|||
@Column({
|
||||
...id(),
|
||||
nullable: true,
|
||||
comment: '[Denormalized]',
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public noteChannelId: Channel["id"] | null;
|
||||
//#endregion
|
||||
|
|
|
@ -11,26 +11,26 @@ import { Note } from "./note.js";
|
|||
import { id } from "../id.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'noteId'], { unique: true })
|
||||
@Index(["userId", "noteId"], { unique: true })
|
||||
export class NoteWatching {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the NoteWatching.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the NoteWatching.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The watcher ID.',
|
||||
comment: "The watcher ID.",
|
||||
})
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
@ -38,12 +38,12 @@ export class NoteWatching {
|
|||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The target Note ID.',
|
||||
comment: "The target Note ID.",
|
||||
})
|
||||
public noteId: Note["id"];
|
||||
|
||||
@ManyToOne(type => Note, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => Note, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public note: Note | null;
|
||||
|
@ -52,7 +52,7 @@ export class NoteWatching {
|
|||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: '[Denormalized]',
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public noteUserId: Note["userId"];
|
||||
//#endregion
|
||||
|
|
|
@ -13,16 +13,16 @@ import { noteVisibilities } from "../../types.js";
|
|||
import { Channel } from "./channel.js";
|
||||
|
||||
@Entity()
|
||||
@Index('IDX_NOTE_TAGS', { synchronize: false })
|
||||
@Index('IDX_NOTE_MENTIONS', { synchronize: false })
|
||||
@Index('IDX_NOTE_VISIBLE_USER_IDS', { synchronize: false })
|
||||
@Index("IDX_NOTE_TAGS", { synchronize: false })
|
||||
@Index("IDX_NOTE_MENTIONS", { synchronize: false })
|
||||
@Index("IDX_NOTE_VISIBLE_USER_IDS", { synchronize: false })
|
||||
export class Note {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the Note.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the Note.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
|
@ -30,12 +30,12 @@ export class Note {
|
|||
@Column({
|
||||
...id(),
|
||||
nullable: true,
|
||||
comment: 'The ID of reply target.',
|
||||
comment: "The ID of reply target.",
|
||||
})
|
||||
public replyId: Note["id"] | null;
|
||||
|
||||
@ManyToOne(type => Note, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => Note, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public reply: Note | null;
|
||||
|
@ -44,66 +44,69 @@ export class Note {
|
|||
@Column({
|
||||
...id(),
|
||||
nullable: true,
|
||||
comment: 'The ID of renote target.',
|
||||
comment: "The ID of renote target.",
|
||||
})
|
||||
public renoteId: Note["id"] | null;
|
||||
|
||||
@ManyToOne(type => Note, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => Note, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public renote: Note | null;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
nullable: true,
|
||||
})
|
||||
public threadId: string | null;
|
||||
|
||||
@Column('text', {
|
||||
@Column("text", {
|
||||
nullable: true,
|
||||
})
|
||||
public text: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
nullable: true,
|
||||
})
|
||||
public name: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
})
|
||||
public cw: string | null;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The ID of author.',
|
||||
comment: "The ID of author.",
|
||||
})
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public localOnly: boolean;
|
||||
|
||||
@Column('smallint', {
|
||||
@Column("smallint", {
|
||||
default: 0,
|
||||
})
|
||||
public renoteCount: number;
|
||||
|
||||
@Column('smallint', {
|
||||
@Column("smallint", {
|
||||
default: 0,
|
||||
})
|
||||
public repliesCount: number;
|
||||
|
||||
@Column('jsonb', {
|
||||
@Column("jsonb", {
|
||||
default: {},
|
||||
})
|
||||
public reactions: Record<string, number>;
|
||||
|
@ -115,71 +118,84 @@ export class Note {
|
|||
* followers ... フォロワーのみ
|
||||
* specified ... visibleUserIds で指定したユーザーのみ
|
||||
*/
|
||||
@Column('enum', { enum: noteVisibilities })
|
||||
@Column("enum", { enum: noteVisibilities })
|
||||
public visibility: typeof noteVisibilities[number];
|
||||
|
||||
@Index({ unique: true })
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
comment: 'The URI of a note. it will be null when the note is local.',
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
comment: "The URI of a note. it will be null when the note is local.",
|
||||
})
|
||||
public uri: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
comment: 'The human readable url of a note. it will be null when the note is local.',
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
comment:
|
||||
"The human readable url of a note. it will be null when the note is local.",
|
||||
})
|
||||
public url: string | null;
|
||||
|
||||
@Column('integer', {
|
||||
default: 0, select: false,
|
||||
@Column("integer", {
|
||||
default: 0,
|
||||
select: false,
|
||||
})
|
||||
public score: number;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
array: true, default: '{}',
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public fileIds: DriveFile["id"][];
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
length: 256, array: true, default: '{}',
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public attachedFileTypes: string[];
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
array: true, default: '{}',
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public visibleUserIds: User["id"][];
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
array: true, default: '{}',
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public mentions: User["id"][];
|
||||
|
||||
@Column('text', {
|
||||
default: '[]',
|
||||
@Column("text", {
|
||||
default: "[]",
|
||||
})
|
||||
public mentionedRemoteUsers: string;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128, array: true, default: '{}',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public emojis: string[];
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
length: 128, array: true, default: '{}',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public tags: string[];
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public hasPoll: boolean;
|
||||
|
@ -188,53 +204,56 @@ export class Note {
|
|||
@Column({
|
||||
...id(),
|
||||
nullable: true,
|
||||
comment: 'The ID of source channel.',
|
||||
comment: "The ID of source channel.",
|
||||
})
|
||||
public channelId: Channel["id"] | null;
|
||||
|
||||
@ManyToOne(type => Channel, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => Channel, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public channel: Channel | null;
|
||||
|
||||
//#region Denormalized fields
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
comment: '[Denormalized]',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public userHost: string | null;
|
||||
|
||||
@Column({
|
||||
...id(),
|
||||
nullable: true,
|
||||
comment: '[Denormalized]',
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public replyUserId: User["id"] | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
comment: '[Denormalized]',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public replyUserHost: string | null;
|
||||
|
||||
@Column({
|
||||
...id(),
|
||||
nullable: true,
|
||||
comment: '[Denormalized]',
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public renoteUserId: User["id"] | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
comment: '[Denormalized]',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public renoteUserHost: string | null;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
@Column("timestamp with time zone", {
|
||||
nullable: true,
|
||||
comment: 'The updated date of the Note.',
|
||||
comment: "The updated date of the Note.",
|
||||
})
|
||||
public updatedAt: Date;
|
||||
//#endregion
|
||||
|
|
|
@ -20,8 +20,8 @@ export class Notification {
|
|||
public id: string;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the Notification.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the Notification.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
|
@ -31,12 +31,12 @@ export class Notification {
|
|||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The ID of recipient user of the Notification.',
|
||||
comment: "The ID of recipient user of the Notification.",
|
||||
})
|
||||
public notifieeId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public notifiee: User | null;
|
||||
|
@ -48,12 +48,12 @@ export class Notification {
|
|||
@Column({
|
||||
...id(),
|
||||
nullable: true,
|
||||
comment: 'The ID of sender user of the Notification.',
|
||||
comment: "The ID of sender user of the Notification.",
|
||||
})
|
||||
public notifierId: User["id"] | null;
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public notifier: User | null;
|
||||
|
@ -74,9 +74,9 @@ export class Notification {
|
|||
* app - App notifications.
|
||||
*/
|
||||
@Index()
|
||||
@Column('enum', {
|
||||
@Column("enum", {
|
||||
enum: notificationTypes,
|
||||
comment: 'The type of the Notification.',
|
||||
comment: "The type of the Notification.",
|
||||
})
|
||||
public type: typeof notificationTypes[number];
|
||||
|
||||
|
@ -84,9 +84,9 @@ export class Notification {
|
|||
* Whether the notification was read.
|
||||
*/
|
||||
@Index()
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
comment: 'Whether the notification was read.',
|
||||
comment: "Whether the notification was read.",
|
||||
})
|
||||
public isRead: boolean;
|
||||
|
||||
|
@ -96,8 +96,8 @@ export class Notification {
|
|||
})
|
||||
public noteId: Note["id"] | null;
|
||||
|
||||
@ManyToOne(type => Note, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => Note, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public note: Note | null;
|
||||
|
@ -108,8 +108,8 @@ export class Notification {
|
|||
})
|
||||
public followRequestId: FollowRequest["id"] | null;
|
||||
|
||||
@ManyToOne(type => FollowRequest, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => FollowRequest, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public followRequest: FollowRequest | null;
|
||||
|
@ -120,18 +120,19 @@ export class Notification {
|
|||
})
|
||||
public userGroupInvitationId: UserGroupInvitation["id"] | null;
|
||||
|
||||
@ManyToOne(type => UserGroupInvitation, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => UserGroupInvitation, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public userGroupInvitation: UserGroupInvitation | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public reaction: string | null;
|
||||
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
nullable: true,
|
||||
})
|
||||
public choice: number | null;
|
||||
|
@ -139,8 +140,9 @@ export class Notification {
|
|||
/**
|
||||
* App notification body
|
||||
*/
|
||||
@Column('varchar', {
|
||||
length: 2048, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 2048,
|
||||
nullable: true,
|
||||
})
|
||||
public customBody: string | null;
|
||||
|
||||
|
@ -148,8 +150,9 @@ export class Notification {
|
|||
* App notification header
|
||||
* (If omitted, it is expected to be displayed with the app name)
|
||||
*/
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
nullable: true,
|
||||
})
|
||||
public customHeader: string | null;
|
||||
|
||||
|
@ -157,8 +160,9 @@ export class Notification {
|
|||
* App notification icon (URL)
|
||||
* (If omitted, it is expected to be displayed as an app icon)
|
||||
*/
|
||||
@Column('varchar', {
|
||||
length: 1024, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 1024,
|
||||
nullable: true,
|
||||
})
|
||||
public customIcon: string | null;
|
||||
|
||||
|
@ -172,8 +176,8 @@ export class Notification {
|
|||
})
|
||||
public appAccessTokenId: AccessToken["id"] | null;
|
||||
|
||||
@ManyToOne(type => AccessToken, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => AccessToken, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public appAccessToken: AccessToken | null;
|
||||
|
|
|
@ -11,20 +11,20 @@ import { id } from "../id.js";
|
|||
import { Page } from "./page.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'pageId'], { unique: true })
|
||||
@Index(["userId", "pageId"], { unique: true })
|
||||
export class PageLike {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone')
|
||||
@Column("timestamp with time zone")
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column(id())
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
@ -32,8 +32,8 @@ export class PageLike {
|
|||
@Column(id())
|
||||
public pageId: Page["id"];
|
||||
|
||||
@ManyToOne(type => Page, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => Page, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public page: Page | null;
|
||||
|
|
|
@ -11,51 +11,52 @@ import { id } from "../id.js";
|
|||
import { DriveFile } from "./drive-file.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'name'], { unique: true })
|
||||
@Index(["userId", "name"], { unique: true })
|
||||
export class Page {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the Page.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the Page.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The updated date of the Page.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The updated date of the Page.",
|
||||
})
|
||||
public updatedAt: Date;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
})
|
||||
public title: string;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
})
|
||||
public name: string;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
nullable: true,
|
||||
})
|
||||
public summary: string | null;
|
||||
|
||||
@Column('boolean')
|
||||
@Column("boolean")
|
||||
public alignCenter: boolean;
|
||||
|
||||
@Column('boolean')
|
||||
@Column("boolean")
|
||||
public isPublic: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public hideTitleWhenPinned: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 32,
|
||||
})
|
||||
public font: string;
|
||||
|
@ -63,12 +64,12 @@ export class Page {
|
|||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The ID of author.',
|
||||
comment: "The ID of author.",
|
||||
})
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
@ -79,25 +80,25 @@ export class Page {
|
|||
})
|
||||
public eyeCatchingImageId: DriveFile["id"] | null;
|
||||
|
||||
@ManyToOne(type => DriveFile, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => DriveFile, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public eyeCatchingImage: DriveFile | null;
|
||||
|
||||
@Column('jsonb', {
|
||||
@Column("jsonb", {
|
||||
default: [],
|
||||
})
|
||||
public content: Record<string, any>[];
|
||||
|
||||
@Column('jsonb', {
|
||||
@Column("jsonb", {
|
||||
default: [],
|
||||
})
|
||||
public variables: Record<string, any>[];
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 16384,
|
||||
default: '',
|
||||
default: "",
|
||||
})
|
||||
public script: string;
|
||||
|
||||
|
@ -106,17 +107,18 @@ export class Page {
|
|||
* followers ... フォロワーのみ
|
||||
* specified ... visibleUserIds で指定したユーザーのみ
|
||||
*/
|
||||
@Column('enum', { enum: ['public', 'followers', 'specified'] })
|
||||
@Column("enum", { enum: ["public", "followers", "specified"] })
|
||||
public visibility: "public" | "followers" | "specified";
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
array: true, default: '{}',
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public visibleUserIds: User["id"][];
|
||||
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
default: 0,
|
||||
})
|
||||
public likedCount: number;
|
||||
|
|
|
@ -14,11 +14,11 @@ export class PasswordResetRequest {
|
|||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone')
|
||||
@Column("timestamp with time zone")
|
||||
public createdAt: Date;
|
||||
|
||||
@Index({ unique: true })
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
})
|
||||
public token: string;
|
||||
|
@ -29,8 +29,8 @@ export class PasswordResetRequest {
|
|||
})
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
|
|
@ -11,14 +11,14 @@ import { Note } from "./note.js";
|
|||
import { id } from "../id.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'noteId', 'choice'], { unique: true })
|
||||
@Index(["userId", "noteId", "choice"], { unique: true })
|
||||
export class PollVote {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the PollVote.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the PollVote.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
|
@ -26,8 +26,8 @@ export class PollVote {
|
|||
@Column(id())
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
@ -36,12 +36,12 @@ export class PollVote {
|
|||
@Column(id())
|
||||
public noteId: Note["id"];
|
||||
|
||||
@ManyToOne(type => Note, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => Note, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public note: Note | null;
|
||||
|
||||
@Column('integer')
|
||||
@Column("integer")
|
||||
public choice: number;
|
||||
}
|
||||
|
|
|
@ -16,48 +16,51 @@ export class Poll {
|
|||
@PrimaryColumn(id())
|
||||
public noteId: Note["id"];
|
||||
|
||||
@OneToOne(type => Note, {
|
||||
onDelete: 'CASCADE',
|
||||
@OneToOne((type) => Note, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public note: Note | null;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
@Column("timestamp with time zone", {
|
||||
nullable: true,
|
||||
})
|
||||
public expiresAt: Date | null;
|
||||
|
||||
@Column('boolean')
|
||||
@Column("boolean")
|
||||
public multiple: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, array: true, default: '{}',
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public choices: string[];
|
||||
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
array: true,
|
||||
})
|
||||
public votes: number[];
|
||||
|
||||
//#region Denormalized fields
|
||||
@Column('enum', {
|
||||
@Column("enum", {
|
||||
enum: noteVisibilities,
|
||||
comment: '[Denormalized]',
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public noteVisibility: typeof noteVisibilities[number];
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: '[Denormalized]',
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public userId: User["id"];
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
comment: '[Denormalized]',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public userHost: string | null;
|
||||
//#endregion
|
||||
|
|
|
@ -15,20 +15,20 @@ export class PromoNote {
|
|||
@PrimaryColumn(id())
|
||||
public noteId: Note["id"];
|
||||
|
||||
@OneToOne(type => Note, {
|
||||
onDelete: 'CASCADE',
|
||||
@OneToOne((type) => Note, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public note: Note | null;
|
||||
|
||||
@Column('timestamp with time zone')
|
||||
@Column("timestamp with time zone")
|
||||
public expiresAt: Date;
|
||||
|
||||
//#region Denormalized fields
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: '[Denormalized]',
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public userId: User["id"];
|
||||
//#endregion
|
||||
|
|
|
@ -11,13 +11,13 @@ import { User } from "./user.js";
|
|||
import { id } from "../id.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'noteId'], { unique: true })
|
||||
@Index(["userId", "noteId"], { unique: true })
|
||||
export class PromoRead {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the PromoRead.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the PromoRead.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
|
@ -25,8 +25,8 @@ export class PromoRead {
|
|||
@Column(id())
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
@ -34,8 +34,8 @@ export class PromoRead {
|
|||
@Column(id())
|
||||
public noteId: Note["id"];
|
||||
|
||||
@ManyToOne(type => Note, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => Note, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public note: Note | null;
|
||||
|
|
|
@ -6,11 +6,11 @@ export class RegistrationTicket {
|
|||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone')
|
||||
@Column("timestamp with time zone")
|
||||
public createdAt: Date;
|
||||
|
||||
@Index({ unique: true })
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 64,
|
||||
})
|
||||
public code: string;
|
||||
|
|
|
@ -15,51 +15,55 @@ export class RegistryItem {
|
|||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the RegistryItem.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the RegistryItem.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The updated date of the RegistryItem.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The updated date of the RegistryItem.",
|
||||
})
|
||||
public updatedAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The owner ID.',
|
||||
comment: "The owner ID.",
|
||||
})
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 1024,
|
||||
comment: 'The key of the RegistryItem.',
|
||||
comment: "The key of the RegistryItem.",
|
||||
})
|
||||
public key: string;
|
||||
|
||||
@Column('jsonb', {
|
||||
default: {}, nullable: true,
|
||||
comment: 'The value of the RegistryItem.',
|
||||
@Column("jsonb", {
|
||||
default: {},
|
||||
nullable: true,
|
||||
comment: "The value of the RegistryItem.",
|
||||
})
|
||||
public value: any | null;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
length: 1024, array: true, default: '{}',
|
||||
@Column("varchar", {
|
||||
length: 1024,
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public scope: string[];
|
||||
|
||||
// サードパーティアプリに開放するときのためのカラム
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
})
|
||||
public domain: string | null;
|
||||
}
|
||||
|
|
|
@ -7,13 +7,14 @@ export class Relay {
|
|||
public id: string;
|
||||
|
||||
@Index({ unique: true })
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: false,
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: false,
|
||||
})
|
||||
public inbox: string;
|
||||
|
||||
@Column('enum', {
|
||||
enum: ['requesting', 'accepted', 'rejected'],
|
||||
@Column("enum", {
|
||||
enum: ["requesting", "accepted", "rejected"],
|
||||
})
|
||||
public status: "requesting" | "accepted" | "rejected";
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ export class RenoteMuting {
|
|||
})
|
||||
public muteeId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
|
@ -41,7 +41,7 @@ export class RenoteMuting {
|
|||
})
|
||||
public muterId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
|
|
|
@ -14,8 +14,8 @@ export class Signin {
|
|||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the Signin.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the Signin.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
|
@ -23,20 +23,20 @@ export class Signin {
|
|||
@Column(id())
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
})
|
||||
public ip: string;
|
||||
|
||||
@Column('jsonb')
|
||||
@Column("jsonb")
|
||||
public headers: Record<string, any>;
|
||||
|
||||
@Column('boolean')
|
||||
@Column("boolean")
|
||||
public success: boolean;
|
||||
}
|
||||
|
|
|
@ -14,35 +14,35 @@ export class SwSubscription {
|
|||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone')
|
||||
@Column("timestamp with time zone")
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column(id())
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
})
|
||||
public endpoint: string;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
})
|
||||
public auth: string;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
})
|
||||
public publickey: string;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public sendReadMessage: boolean;
|
||||
|
|
|
@ -2,12 +2,12 @@ import { PrimaryColumn, Entity, Column } from "typeorm";
|
|||
|
||||
@Entity()
|
||||
export class UsedUsername {
|
||||
@PrimaryColumn('varchar', {
|
||||
@PrimaryColumn("varchar", {
|
||||
length: 128,
|
||||
})
|
||||
public username: string;
|
||||
|
||||
@Column('timestamp with time zone')
|
||||
@Column("timestamp with time zone")
|
||||
public createdAt: Date;
|
||||
|
||||
constructor(data: Partial<UsedUsername>) {
|
||||
|
|
|
@ -11,25 +11,25 @@ import { UserGroup } from "./user-group.js";
|
|||
import { id } from "../id.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'userGroupId'], { unique: true })
|
||||
@Index(["userId", "userGroupId"], { unique: true })
|
||||
export class UserGroupInvitation {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the UserGroupInvitation.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the UserGroupInvitation.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The user ID.',
|
||||
comment: "The user ID.",
|
||||
})
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
@ -37,12 +37,12 @@ export class UserGroupInvitation {
|
|||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The group ID.',
|
||||
comment: "The group ID.",
|
||||
})
|
||||
public userGroupId: UserGroup["id"];
|
||||
|
||||
@ManyToOne(type => UserGroup, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => UserGroup, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public userGroup: UserGroup | null;
|
||||
|
|
|
@ -11,25 +11,25 @@ import { UserGroup } from "./user-group.js";
|
|||
import { id } from "../id.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'userGroupId'], { unique: true })
|
||||
@Index(["userId", "userGroupId"], { unique: true })
|
||||
export class UserGroupJoining {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the UserGroupJoining.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the UserGroupJoining.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The user ID.',
|
||||
comment: "The user ID.",
|
||||
})
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
@ -37,12 +37,12 @@ export class UserGroupJoining {
|
|||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The group ID.',
|
||||
comment: "The group ID.",
|
||||
})
|
||||
public userGroupId: UserGroup["id"];
|
||||
|
||||
@ManyToOne(type => UserGroup, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => UserGroup, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public userGroup: UserGroup | null;
|
||||
|
|
|
@ -15,12 +15,12 @@ export class UserGroup {
|
|||
public id: string;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the UserGroup.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the UserGroup.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
})
|
||||
public name: string;
|
||||
|
@ -28,17 +28,17 @@ export class UserGroup {
|
|||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The ID of owner.',
|
||||
comment: "The ID of owner.",
|
||||
})
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public isPrivate: boolean;
|
||||
|
|
|
@ -12,20 +12,19 @@ import { Note } from "./note.js";
|
|||
import type { User } from "./user.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'ip'], { unique: true })
|
||||
@Index(["userId", "ip"], { unique: true })
|
||||
export class UserIp {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
})
|
||||
@Column("timestamp with time zone", {})
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column(id())
|
||||
public userId: User["id"];
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
})
|
||||
public ip: string;
|
||||
|
|
|
@ -7,18 +7,18 @@ export class UserKeypair {
|
|||
@PrimaryColumn(id())
|
||||
public userId: User["id"];
|
||||
|
||||
@OneToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@OneToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 4096,
|
||||
})
|
||||
public publicKey: string;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 4096,
|
||||
})
|
||||
public privateKey: string;
|
||||
|
|
|
@ -11,25 +11,25 @@ import { UserList } from "./user-list.js";
|
|||
import { id } from "../id.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'userListId'], { unique: true })
|
||||
@Index(["userId", "userListId"], { unique: true })
|
||||
export class UserListJoining {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the UserListJoining.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the UserListJoining.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The user ID.',
|
||||
comment: "The user ID.",
|
||||
})
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
@ -37,12 +37,12 @@ export class UserListJoining {
|
|||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The list ID.',
|
||||
comment: "The list ID.",
|
||||
})
|
||||
public userListId: UserList["id"];
|
||||
|
||||
@ManyToOne(type => UserList, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => UserList, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public userList: UserList | null;
|
||||
|
|
|
@ -14,27 +14,27 @@ export class UserList {
|
|||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the UserList.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the UserList.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The owner ID.',
|
||||
comment: "The owner ID.",
|
||||
})
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
comment: 'The name of the UserList.',
|
||||
comment: "The name of the UserList.",
|
||||
})
|
||||
public name: string;
|
||||
}
|
||||
|
|
|
@ -11,13 +11,13 @@ import { User } from "./user.js";
|
|||
import { id } from "../id.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'noteId'], { unique: true })
|
||||
@Index(["userId", "noteId"], { unique: true })
|
||||
export class UserNotePining {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the UserNotePinings.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the UserNotePinings.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
|
@ -25,8 +25,8 @@ export class UserNotePining {
|
|||
@Column(id())
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
@ -34,8 +34,8 @@ export class UserNotePining {
|
|||
@Column(id())
|
||||
public noteId: Note["id"];
|
||||
|
||||
@ManyToOne(type => Note, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => Note, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public note: Note | null;
|
||||
|
|
|
@ -6,26 +6,26 @@ export class UserPending {
|
|||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone')
|
||||
@Column("timestamp with time zone")
|
||||
public createdAt: Date;
|
||||
|
||||
@Index({ unique: true })
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
})
|
||||
public code: string;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
})
|
||||
public username: string;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
})
|
||||
public email: string;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
})
|
||||
public password: string;
|
||||
|
|
|
@ -18,31 +18,34 @@ export class UserProfile {
|
|||
@PrimaryColumn(id())
|
||||
public userId: User["id"];
|
||||
|
||||
@OneToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@OneToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
comment: 'The location of the User.',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
comment: "The location of the User.",
|
||||
})
|
||||
public location: string | null;
|
||||
|
||||
@Column('char', {
|
||||
length: 10, nullable: true,
|
||||
comment: 'The birthday (YYYY-MM-DD) of the User.',
|
||||
@Column("char", {
|
||||
length: 10,
|
||||
nullable: true,
|
||||
comment: "The birthday (YYYY-MM-DD) of the User.",
|
||||
})
|
||||
public birthday: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 2048, nullable: true,
|
||||
comment: 'The description (bio) of the User.',
|
||||
@Column("varchar", {
|
||||
length: 2048,
|
||||
nullable: true,
|
||||
comment: "The description (bio) of the User.",
|
||||
})
|
||||
public description: string | null;
|
||||
|
||||
@Column('jsonb', {
|
||||
@Column("jsonb", {
|
||||
default: [],
|
||||
})
|
||||
public fields: {
|
||||
|
@ -50,136 +53,145 @@ export class UserProfile {
|
|||
value: string;
|
||||
}[];
|
||||
|
||||
@Column('varchar', {
|
||||
length: 32, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 32,
|
||||
nullable: true,
|
||||
})
|
||||
public lang: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
comment: 'Remote URL of the user.',
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
comment: "Remote URL of the user.",
|
||||
})
|
||||
public url: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
comment: 'The email address of the User.',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
comment: "The email address of the User.",
|
||||
})
|
||||
public email: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public emailVerifyCode: string | null;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public emailVerified: boolean;
|
||||
|
||||
@Column('jsonb', {
|
||||
default: ['follow', 'receiveFollowRequest', 'groupInvited'],
|
||||
@Column("jsonb", {
|
||||
default: ["follow", "receiveFollowRequest", "groupInvited"],
|
||||
})
|
||||
public emailNotificationTypes: string[];
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public publicReactions: boolean;
|
||||
|
||||
@Column('enum', {
|
||||
@Column("enum", {
|
||||
enum: ffVisibility,
|
||||
default: 'public',
|
||||
default: "public",
|
||||
})
|
||||
public ffVisibility: typeof ffVisibility[number];
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public twoFactorTempSecret: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public twoFactorSecret: string | null;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public twoFactorEnabled: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public securityKeysAvailable: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public usePasswordLessLogin: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
comment: 'The password hash of the User. It will be null if the origin of the user is local.',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
comment:
|
||||
"The password hash of the User. It will be null if the origin of the user is local.",
|
||||
})
|
||||
public password: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 8192, default: '',
|
||||
@Column("varchar", {
|
||||
length: 8192,
|
||||
default: "",
|
||||
})
|
||||
public moderationNote: string | null;
|
||||
|
||||
// TODO: そのうち消す
|
||||
@Column('jsonb', {
|
||||
@Column("jsonb", {
|
||||
default: {},
|
||||
comment: 'The client-specific data of the User.',
|
||||
comment: "The client-specific data of the User.",
|
||||
})
|
||||
public clientData: Record<string, any>;
|
||||
|
||||
// TODO: そのうち消す
|
||||
@Column('jsonb', {
|
||||
@Column("jsonb", {
|
||||
default: {},
|
||||
comment: 'The room data of the User.',
|
||||
comment: "The room data of the User.",
|
||||
})
|
||||
public room: Record<string, any>;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public autoAcceptFollowed: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
comment: 'Whether reject index by crawler.',
|
||||
comment: "Whether reject index by crawler.",
|
||||
})
|
||||
public noCrawle: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: true,
|
||||
})
|
||||
public preventAiLearning: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public alwaysMarkNsfw: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public autoSensitive: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public carefulBot: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: true,
|
||||
})
|
||||
public injectFeaturedNote: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: true,
|
||||
})
|
||||
public receiveAnnouncementEmail: boolean;
|
||||
|
@ -190,35 +202,36 @@ export class UserProfile {
|
|||
})
|
||||
public pinnedPageId: Page["id"] | null;
|
||||
|
||||
@OneToOne(type => Page, {
|
||||
onDelete: 'SET NULL',
|
||||
@OneToOne((type) => Page, {
|
||||
onDelete: "SET NULL",
|
||||
})
|
||||
@JoinColumn()
|
||||
public pinnedPage: Page | null;
|
||||
|
||||
@Column('jsonb', {
|
||||
@Column("jsonb", {
|
||||
default: {},
|
||||
})
|
||||
public integrations: Record<string, any>;
|
||||
|
||||
@Index()
|
||||
@Column('boolean', {
|
||||
default: false, select: false,
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
select: false,
|
||||
})
|
||||
public enableWordMute: boolean;
|
||||
|
||||
@Column('jsonb', {
|
||||
@Column("jsonb", {
|
||||
default: [],
|
||||
})
|
||||
public mutedWords: string[][];
|
||||
|
||||
@Column('jsonb', {
|
||||
@Column("jsonb", {
|
||||
default: [],
|
||||
comment: 'List of instances muted by the user.',
|
||||
comment: "List of instances muted by the user.",
|
||||
})
|
||||
public mutedInstances: string[];
|
||||
|
||||
@Column('enum', {
|
||||
@Column("enum", {
|
||||
enum: notificationTypes,
|
||||
array: true,
|
||||
default: [],
|
||||
|
@ -227,9 +240,10 @@ export class UserProfile {
|
|||
|
||||
//#region Denormalized fields
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
comment: '[Denormalized]',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public userHost: string | null;
|
||||
//#endregion
|
||||
|
|
|
@ -14,19 +14,19 @@ export class UserPublickey {
|
|||
@PrimaryColumn(id())
|
||||
public userId: User["id"];
|
||||
|
||||
@OneToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@OneToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
||||
@Index({ unique: true })
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 256,
|
||||
})
|
||||
public keyId: string;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 4096,
|
||||
})
|
||||
public keyPem: string;
|
||||
|
|
|
@ -11,8 +11,8 @@ import { id } from "../id.js";
|
|||
|
||||
@Entity()
|
||||
export class UserSecurityKey {
|
||||
@PrimaryColumn('varchar', {
|
||||
comment: 'Variable-length id given to navigator.credentials.get()',
|
||||
@PrimaryColumn("varchar", {
|
||||
comment: "Variable-length id given to navigator.credentials.get()",
|
||||
})
|
||||
public id: string;
|
||||
|
||||
|
@ -20,27 +20,27 @@ export class UserSecurityKey {
|
|||
@Column(id())
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
comment:
|
||||
'Variable-length public key used to verify attestations (hex-encoded).',
|
||||
"Variable-length public key used to verify attestations (hex-encoded).",
|
||||
})
|
||||
public publicKey: string;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
@Column("timestamp with time zone", {
|
||||
comment:
|
||||
'The date of the last time the UserSecurityKey was successfully validated.',
|
||||
"The date of the last time the UserSecurityKey was successfully validated.",
|
||||
})
|
||||
public lastUsed: Date;
|
||||
|
||||
@Column('varchar', {
|
||||
comment: 'User-defined name for this key',
|
||||
@Column("varchar", {
|
||||
comment: "User-defined name for this key",
|
||||
length: 30,
|
||||
})
|
||||
public name: string;
|
||||
|
|
|
@ -10,99 +10,101 @@ import { id } from "../id.js";
|
|||
import { DriveFile } from "./drive-file.js";
|
||||
|
||||
@Entity()
|
||||
@Index(['usernameLower', 'host'], { unique: true })
|
||||
@Index(["usernameLower", "host"], { unique: true })
|
||||
export class User {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the User.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the User.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
@Column("timestamp with time zone", {
|
||||
nullable: true,
|
||||
comment: 'The updated date of the User.',
|
||||
comment: "The updated date of the User.",
|
||||
})
|
||||
public updatedAt: Date | null;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
@Column("timestamp with time zone", {
|
||||
nullable: true,
|
||||
})
|
||||
public lastFetchedAt: Date | null;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
@Column("timestamp with time zone", {
|
||||
nullable: true,
|
||||
})
|
||||
public lastActiveDate: Date | null;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public hideOnlineStatus: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
comment: 'The username of the User.',
|
||||
comment: "The username of the User.",
|
||||
})
|
||||
public username: string;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
length: 128, select: false,
|
||||
comment: 'The username (lowercased) of the User.',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
select: false,
|
||||
comment: "The username (lowercased) of the User.",
|
||||
})
|
||||
public usernameLower: string;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
comment: 'The name of the User.',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
comment: "The name of the User.",
|
||||
})
|
||||
public name: string | null;
|
||||
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
default: 0,
|
||||
comment: 'The count of followers.',
|
||||
comment: "The count of followers.",
|
||||
})
|
||||
public followersCount: number;
|
||||
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
default: 0,
|
||||
comment: 'The count of following.',
|
||||
comment: "The count of following.",
|
||||
})
|
||||
public followingCount: number;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
comment: 'The URI of the new account of the User',
|
||||
comment: "The URI of the new account of the User",
|
||||
})
|
||||
public movedToUri: string | null;
|
||||
|
||||
@Column('simple-array', {
|
||||
@Column("simple-array", {
|
||||
nullable: true,
|
||||
comment: 'URIs the user is known as too',
|
||||
comment: "URIs the user is known as too",
|
||||
})
|
||||
public alsoKnownAs: string[] | null;
|
||||
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
default: 0,
|
||||
comment: 'The count of notes.',
|
||||
comment: "The count of notes.",
|
||||
})
|
||||
public notesCount: number;
|
||||
|
||||
@Column({
|
||||
...id(),
|
||||
nullable: true,
|
||||
comment: 'The ID of avatar DriveFile.',
|
||||
comment: "The ID of avatar DriveFile.",
|
||||
})
|
||||
public avatarId: DriveFile["id"] | null;
|
||||
|
||||
@OneToOne(type => DriveFile, {
|
||||
onDelete: 'SET NULL',
|
||||
@OneToOne((type) => DriveFile, {
|
||||
onDelete: "SET NULL",
|
||||
})
|
||||
@JoinColumn()
|
||||
public avatar: DriveFile | null;
|
||||
|
@ -110,143 +112,162 @@ export class User {
|
|||
@Column({
|
||||
...id(),
|
||||
nullable: true,
|
||||
comment: 'The ID of banner DriveFile.',
|
||||
comment: "The ID of banner DriveFile.",
|
||||
})
|
||||
public bannerId: DriveFile["id"] | null;
|
||||
|
||||
@OneToOne(type => DriveFile, {
|
||||
onDelete: 'SET NULL',
|
||||
@OneToOne((type) => DriveFile, {
|
||||
onDelete: "SET NULL",
|
||||
})
|
||||
@JoinColumn()
|
||||
public banner: DriveFile | null;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
length: 128, array: true, default: '{}',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public tags: string[];
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
comment: 'Whether the User is suspended.',
|
||||
comment: "Whether the User is suspended.",
|
||||
})
|
||||
public isSuspended: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
comment: 'Whether the User is silenced.',
|
||||
comment: "Whether the User is silenced.",
|
||||
})
|
||||
public isSilenced: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
comment: 'Whether the User is locked.',
|
||||
comment: "Whether the User is locked.",
|
||||
})
|
||||
public isLocked: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
comment: 'Whether the User is a bot.',
|
||||
comment: "Whether the User is a bot.",
|
||||
})
|
||||
public isBot: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
comment: 'Whether the User is a cat.',
|
||||
comment: "Whether the User is a cat.",
|
||||
})
|
||||
public isCat: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: true,
|
||||
comment: 'Whether to speak as a cat if isCat.',
|
||||
comment: "Whether to speak as a cat if isCat.",
|
||||
})
|
||||
public speakAsCat: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
comment: 'Whether the User is the admin.',
|
||||
comment: "Whether the User is the admin.",
|
||||
})
|
||||
public isAdmin: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
comment: 'Whether the User is a moderator.',
|
||||
comment: "Whether the User is a moderator.",
|
||||
})
|
||||
public isModerator: boolean;
|
||||
|
||||
@Index()
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: true,
|
||||
comment: 'Whether the User is explorable.',
|
||||
comment: "Whether the User is explorable.",
|
||||
})
|
||||
public isExplorable: boolean;
|
||||
|
||||
// アカウントが削除されたかどうかのフラグだが、完全に削除される際は物理削除なので実質削除されるまでの「削除が進行しているかどうか」のフラグ
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
comment: 'Whether the User is deleted.',
|
||||
comment: "Whether the User is deleted.",
|
||||
})
|
||||
public isDeleted: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128, array: true, default: '{}',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public emojis: string[];
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
comment: 'The host of the User. It will be null if the origin of the user is local.',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
comment:
|
||||
"The host of the User. It will be null if the origin of the user is local.",
|
||||
})
|
||||
public host: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
comment: 'The inbox URL of the User. It will be null if the origin of the user is local.',
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
comment:
|
||||
"The inbox URL of the User. It will be null if the origin of the user is local.",
|
||||
})
|
||||
public inbox: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
comment: 'The sharedInbox URL of the User. It will be null if the origin of the user is local.',
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
comment:
|
||||
"The sharedInbox URL of the User. It will be null if the origin of the user is local.",
|
||||
})
|
||||
public sharedInbox: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
comment: 'The featured URL of the User. It will be null if the origin of the user is local.',
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
comment:
|
||||
"The featured URL of the User. It will be null if the origin of the user is local.",
|
||||
})
|
||||
public featured: string | null;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
comment: 'The URI of the User. It will be null if the origin of the user is local.',
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
comment:
|
||||
"The URI of the User. It will be null if the origin of the user is local.",
|
||||
})
|
||||
public uri: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
comment: 'The URI of the user Follower Collection. It will be null if the origin of the user is local.',
|
||||
@Column("varchar", {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
comment:
|
||||
"The URI of the user Follower Collection. It will be null if the origin of the user is local.",
|
||||
})
|
||||
public followersUri: string | null;
|
||||
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
comment: 'Whether to show users replying to other users in the timeline.',
|
||||
comment: "Whether to show users replying to other users in the timeline.",
|
||||
})
|
||||
public showTimelineReplies: boolean;
|
||||
|
||||
@Index({ unique: true })
|
||||
@Column('char', {
|
||||
length: 16, nullable: true, unique: true,
|
||||
comment: 'The native access token of the User. It will be null if the origin of the user is local.',
|
||||
@Column("char", {
|
||||
length: 16,
|
||||
nullable: true,
|
||||
unique: true,
|
||||
comment:
|
||||
"The native access token of the User. It will be null if the origin of the user is local.",
|
||||
})
|
||||
public token: string | null;
|
||||
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
nullable: true,
|
||||
comment: 'Overrides user drive capacity limit',
|
||||
comment: "Overrides user drive capacity limit",
|
||||
})
|
||||
public driveCapacityOverrideMb: number | null;
|
||||
|
||||
|
|
|
@ -25,48 +25,50 @@ export class Webhook {
|
|||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Column('timestamp with time zone', {
|
||||
comment: 'The created date of the Antenna.',
|
||||
@Column("timestamp with time zone", {
|
||||
comment: "The created date of the Antenna.",
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
comment: 'The owner ID.',
|
||||
comment: "The owner ID.",
|
||||
})
|
||||
public userId: User["id"];
|
||||
|
||||
@ManyToOne(type => User, {
|
||||
onDelete: 'CASCADE',
|
||||
@ManyToOne((type) => User, {
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
@JoinColumn()
|
||||
public user: User | null;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
comment: 'The name of the Antenna.',
|
||||
comment: "The name of the Antenna.",
|
||||
})
|
||||
public name: string;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
length: 128, array: true, default: '{}',
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public on: typeof webhookEventTypes[number][];
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 1024,
|
||||
})
|
||||
public url: string;
|
||||
|
||||
@Column('varchar', {
|
||||
@Column("varchar", {
|
||||
length: 1024,
|
||||
})
|
||||
public secret: string;
|
||||
|
||||
@Index()
|
||||
@Column('boolean', {
|
||||
@Column("boolean", {
|
||||
default: true,
|
||||
})
|
||||
public active: boolean;
|
||||
|
@ -74,7 +76,7 @@ export class Webhook {
|
|||
/**
|
||||
* 直近のリクエスト送信日時
|
||||
*/
|
||||
@Column('timestamp with time zone', {
|
||||
@Column("timestamp with time zone", {
|
||||
nullable: true,
|
||||
})
|
||||
public latestSentAt: Date | null;
|
||||
|
@ -82,7 +84,7 @@ export class Webhook {
|
|||
/**
|
||||
* 直近のリクエスト送信時のHTTPステータスコード
|
||||
*/
|
||||
@Column('integer', {
|
||||
@Column("integer", {
|
||||
nullable: true,
|
||||
})
|
||||
public latestStatus: number | null;
|
||||
|
|
|
@ -257,7 +257,9 @@ export const UserRepository = db.getRepository(User).extend({
|
|||
|
||||
async getHasUnreadAntenna(userId: User["id"]): Promise<boolean> {
|
||||
try {
|
||||
const myAntennas = (await getAntennas()).filter((a) => a.userId === userId);
|
||||
const myAntennas = (await getAntennas()).filter(
|
||||
(a) => a.userId === userId,
|
||||
);
|
||||
|
||||
const unread =
|
||||
myAntennas.length > 0
|
||||
|
@ -267,7 +269,10 @@ export const UserRepository = db.getRepository(User).extend({
|
|||
})
|
||||
: null;
|
||||
|
||||
return unread != null; } catch(e) { return false; }
|
||||
return unread != null;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
async getHasUnreadChannel(userId: User["id"]): Promise<boolean> {
|
||||
|
|
|
@ -5,6 +5,7 @@ import { Notes } from "@/models/index.js";
|
|||
import { MoreThan } from "typeorm";
|
||||
import { index } from "@/services/note/create.js";
|
||||
import { Note } from "@/models/entities/note.js";
|
||||
import meilisearch from "../../../db/meilisearch.js";
|
||||
|
||||
const logger = queueLogger.createSubLogger("index-all-notes");
|
||||
|
||||
|
@ -38,6 +39,7 @@ export default async function indexAllNotes(
|
|||
order: {
|
||||
id: 1,
|
||||
},
|
||||
relations: ["user"],
|
||||
});
|
||||
} catch (e) {
|
||||
logger.error(`Failed to query notes ${e}`);
|
||||
|
@ -58,7 +60,12 @@ export default async function indexAllNotes(
|
|||
|
||||
for (let i = 0; i < notes.length; i += batch) {
|
||||
const chunk = notes.slice(i, i + batch);
|
||||
await Promise.all(chunk.map((note) => index(note)));
|
||||
|
||||
if (meilisearch) {
|
||||
await meilisearch.ingestNote(chunk);
|
||||
}
|
||||
|
||||
await Promise.all(chunk.map((note) => index(note, true)));
|
||||
|
||||
indexedCount += chunk.length;
|
||||
const pct = (indexedCount / total) * 100;
|
||||
|
|
|
@ -7,6 +7,7 @@ import type { DriveFile } from "@/models/entities/drive-file.js";
|
|||
import { MoreThan } from "typeorm";
|
||||
import { deleteFileSync } from "@/services/drive/delete-file.js";
|
||||
import { sendEmail } from "@/services/send-email.js";
|
||||
import meilisearch from "@/db/meilisearch.js";
|
||||
|
||||
const logger = queueLogger.createSubLogger("delete-account");
|
||||
|
||||
|
@ -43,6 +44,9 @@ export async function deleteAccount(
|
|||
cursor = notes[notes.length - 1].id;
|
||||
|
||||
await Notes.delete(notes.map((note) => note.id));
|
||||
if (meilisearch) {
|
||||
await meilisearch.deleteNotes(notes);
|
||||
}
|
||||
}
|
||||
|
||||
logger.succ("All of notes deleted");
|
||||
|
|
|
@ -4,6 +4,7 @@ import { Note } from "@/models/entities/note.js";
|
|||
import config from "@/config/index.js";
|
||||
import es from "../../../../db/elasticsearch.js";
|
||||
import sonic from "../../../../db/sonic.js";
|
||||
import meilisearch, { MeilisearchNote } from "../../../../db/meilisearch.js";
|
||||
import define from "../../define.js";
|
||||
import { makePaginationQuery } from "../../common/make-pagination-query.js";
|
||||
import { generateVisibilityQuery } from "../../common/generate-visibility-query.js";
|
||||
|
@ -62,7 +63,7 @@ export const paramDef = {
|
|||
} as const;
|
||||
|
||||
export default define(meta, paramDef, async (ps, me) => {
|
||||
if (es == null && sonic == null) {
|
||||
if (es == null && sonic == null && meilisearch == null) {
|
||||
const query = makePaginationQuery(
|
||||
Notes.createQueryBuilder("note"),
|
||||
ps.sinceId,
|
||||
|
@ -170,6 +171,70 @@ export default define(meta, paramDef, async (ps, me) => {
|
|||
found.length = ps.limit;
|
||||
}
|
||||
|
||||
return found;
|
||||
} else if (meilisearch) {
|
||||
let start = 0;
|
||||
const chunkSize = 100;
|
||||
|
||||
// Use meilisearch to fetch and step through all search results that could match the requirements
|
||||
const ids = [];
|
||||
while (true) {
|
||||
const results = await meilisearch.search(ps.query, chunkSize, start, me);
|
||||
|
||||
start += chunkSize;
|
||||
|
||||
if (results.hits.length === 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
const res = results.hits
|
||||
.filter((key: MeilisearchNote) => {
|
||||
if (ps.userId && key.userId !== ps.userId) {
|
||||
return false;
|
||||
}
|
||||
if (ps.channelId && key.channelId !== ps.channelId) {
|
||||
return false;
|
||||
}
|
||||
if (ps.sinceId && key.id <= ps.sinceId) {
|
||||
return false;
|
||||
}
|
||||
if (ps.untilId && key.id >= ps.untilId) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.map((key) => key.id);
|
||||
|
||||
ids.push(...res);
|
||||
}
|
||||
|
||||
// Sort all the results by note id DESC (newest first)
|
||||
ids.sort((a, b) => b - a);
|
||||
|
||||
// Fetch the notes from the database until we have enough to satisfy the limit
|
||||
start = 0;
|
||||
const found = [];
|
||||
while (found.length < ps.limit && start < ids.length) {
|
||||
const chunk = ids.slice(start, start + chunkSize);
|
||||
const notes: Note[] = await Notes.find({
|
||||
where: {
|
||||
id: In(chunk),
|
||||
},
|
||||
order: {
|
||||
id: "DESC",
|
||||
},
|
||||
});
|
||||
|
||||
// The notes are checked for visibility and muted/blocked users when packed
|
||||
found.push(...(await Notes.packMany(notes, me)));
|
||||
start += chunkSize;
|
||||
}
|
||||
|
||||
// If we have more results than the limit, trim them
|
||||
if (found.length > ps.limit) {
|
||||
found.length = ps.limit;
|
||||
}
|
||||
|
||||
return found;
|
||||
} else {
|
||||
const userQuery =
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import * as os from "node:os";
|
||||
import si from "systeminformation";
|
||||
import define from "../define.js";
|
||||
import meilisearch from "../../../db/meilisearch.js";
|
||||
|
||||
export const meta = {
|
||||
requireCredential: false,
|
||||
|
@ -18,6 +19,7 @@ export const paramDef = {
|
|||
export default define(meta, paramDef, async () => {
|
||||
const memStats = await si.mem();
|
||||
const fsStats = await si.fsSize();
|
||||
const meilisearchStats = await meilisearchStatus();
|
||||
|
||||
return {
|
||||
machine: os.hostname(),
|
||||
|
@ -34,3 +36,15 @@ export default define(meta, paramDef, async () => {
|
|||
},
|
||||
};
|
||||
});
|
||||
|
||||
async function meilisearchStatus() {
|
||||
if (meilisearch) {
|
||||
return meilisearch.serverStats();
|
||||
} else {
|
||||
return {
|
||||
health: "unconfigured",
|
||||
size: 0,
|
||||
indexed_count: 0,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,5 @@
|
|||
"url": "/my/messaging"
|
||||
}
|
||||
],
|
||||
"categories": [
|
||||
"social"
|
||||
]
|
||||
"categories": ["social"]
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@ import type { UserProfile } from "@/models/entities/user-profile.js";
|
|||
import { db } from "@/db/postgre.js";
|
||||
import { getActiveWebhooks } from "@/misc/webhook-cache.js";
|
||||
import { shouldSilenceInstance } from "@/misc/should-block-instance.js";
|
||||
import meilisearch from "../../db/meilisearch.js";
|
||||
|
||||
const mutedWordsCache = new Cache<
|
||||
{ userId: UserProfile["userId"]; mutedWords: UserProfile["mutedWords"] }[]
|
||||
|
@ -748,7 +749,7 @@ async function insertNote(
|
|||
}
|
||||
}
|
||||
|
||||
export async function index(note: Note): Promise<void> {
|
||||
export async function index(note: Note, reindexing: boolean): Promise<void> {
|
||||
if (!note.text) return;
|
||||
|
||||
if (config.elasticsearch && es) {
|
||||
|
@ -776,6 +777,10 @@ export async function index(note: Note): Promise<void> {
|
|||
note.text,
|
||||
);
|
||||
}
|
||||
|
||||
if (meilisearch && !reindexing) {
|
||||
await meilisearch.ingestNote(note);
|
||||
}
|
||||
}
|
||||
|
||||
async function notifyToWatchersOfRenotee(
|
||||
|
|
|
@ -21,6 +21,7 @@ import {
|
|||
import { countSameRenotes } from "@/misc/count-same-renotes.js";
|
||||
import { registerOrFetchInstanceDoc } from "../register-or-fetch-instance-doc.js";
|
||||
import { deliverToRelays } from "../relay.js";
|
||||
import meilisearch from "@/db/meilisearch.js";
|
||||
|
||||
/**
|
||||
* 投稿を削除します。
|
||||
|
@ -119,6 +120,10 @@ export default async function (
|
|||
id: note.id,
|
||||
userId: user.id,
|
||||
});
|
||||
|
||||
if(meilisearch) {
|
||||
await meilisearch.deleteNotes(note.id);
|
||||
}
|
||||
}
|
||||
|
||||
async function findCascadingNotes(note: Note) {
|
||||
|
|
|
@ -34,9 +34,7 @@
|
|||
"tsd": "^0.19.1",
|
||||
"typescript": "4.5.4"
|
||||
},
|
||||
"files": [
|
||||
"built"
|
||||
],
|
||||
"files": ["built"],
|
||||
"dependencies": {
|
||||
"autobind-decorator": "^2.4.0",
|
||||
"eventemitter3": "^4.0.7",
|
||||
|
|
|
@ -15,11 +15,6 @@
|
|||
"noImplicitReturns": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"test/**/*"
|
||||
]
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "test/**/*"]
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
"typescript": "4.9.4",
|
||||
"uuid": "9.0.0",
|
||||
"vanilla-tilt": "1.8.0",
|
||||
"vite": "^4.1.1",
|
||||
"vite": "4.3.9",
|
||||
"vite-plugin-compression": "^0.5.1",
|
||||
"vue": "3.2.45",
|
||||
"vue-isyourpasswordsafe": "^2.0.0",
|
||||
|
|
|
@ -11,10 +11,7 @@
|
|||
:data-count="previewableCount < 5 ? previewableCount : null"
|
||||
:class="{ dmWidth: inDm }"
|
||||
>
|
||||
<div
|
||||
ref="gallery"
|
||||
@click.stop
|
||||
>
|
||||
<div ref="gallery" @click.stop>
|
||||
<template
|
||||
v-for="media in mediaList.filter((media) =>
|
||||
previewable(media)
|
||||
|
@ -189,7 +186,9 @@ const previewable = (file: misskey.entities.DriveFile): boolean => {
|
|||
FILE_TYPE_BROWSERSAFE.includes(file.type)
|
||||
);
|
||||
};
|
||||
const previewableCount = props.mediaList.filter((media) => previewable(media)).length;
|
||||
const previewableCount = props.mediaList.filter((media) =>
|
||||
previewable(media)
|
||||
).length;
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
@ -251,14 +250,14 @@ const previewableCount = props.mediaList.filter((media) => previewable(media)).l
|
|||
display: grid;
|
||||
grid-gap: 8px;
|
||||
|
||||
> div, > button {
|
||||
> div,
|
||||
> button {
|
||||
overflow: hidden;
|
||||
border-radius: 6px;
|
||||
pointer-events: all;
|
||||
min-height: 50px;
|
||||
}
|
||||
|
||||
|
||||
> :nth-child(1) {
|
||||
grid-column: 1 / 2;
|
||||
grid-row: 1 / 2;
|
||||
|
|
|
@ -75,11 +75,11 @@ const hide = ref(
|
|||
onMounted(() => {
|
||||
mini.value = plyr.value.player.media.scrollWidth < 300;
|
||||
if (mini.value) {
|
||||
plyr.value.player.on('play', () => {
|
||||
plyr.value.player.on("play", () => {
|
||||
plyr.value.player.fullscreen.enter();
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
:note="note"
|
||||
:detailedView="true"
|
||||
/>
|
||||
<MkLoading v-else-if="appearNote.reply" mini />
|
||||
<MkLoading v-else-if="note.reply" mini />
|
||||
<MkNoteSub
|
||||
v-if="appearNote.reply"
|
||||
:note="appearNote.reply"
|
||||
v-if="note.reply"
|
||||
:note="note.reply"
|
||||
class="reply-to"
|
||||
:detailedView="true"
|
||||
/>
|
||||
|
@ -29,21 +29,21 @@
|
|||
ref="noteEl"
|
||||
@contextmenu.stop="onContextmenu"
|
||||
tabindex="-1"
|
||||
:note="appearNote"
|
||||
:note="note"
|
||||
detailedView
|
||||
></MkNote>
|
||||
|
||||
<MkTab v-model="tab" :style="'underline'" @update:modelValue="loadTab">
|
||||
<option value="replies">
|
||||
<!-- <i class="ph-arrow-u-up-left ph-bold ph-lg"></i> -->
|
||||
<span v-if="appearNote.repliesCount > 0" class="count">{{
|
||||
appearNote.repliesCount
|
||||
<span v-if="note.repliesCount > 0" class="count">{{
|
||||
note.repliesCount
|
||||
}}</span>
|
||||
{{ i18n.ts._notification._types.reply }}
|
||||
</option>
|
||||
<option value="renotes" v-if="appearNote.renoteCount > 0">
|
||||
<option value="renotes" v-if="note.renoteCount > 0">
|
||||
<!-- <i class="ph-repeat ph-bold ph-lg"></i> -->
|
||||
<span class="count">{{ appearNote.renoteCount }}</span>
|
||||
<span class="count">{{ note.renoteCount }}</span>
|
||||
{{ i18n.ts._notification._types.renote }}
|
||||
</option>
|
||||
<option value="reactions" v-if="reactionsCount > 0">
|
||||
|
@ -71,11 +71,9 @@
|
|||
class="reply"
|
||||
:conversation="replies"
|
||||
:detailedView="true"
|
||||
:parentId="appearNote.id"
|
||||
/>
|
||||
<MkLoading
|
||||
v-else-if="tab === 'replies' && appearNote.repliesCount > 0"
|
||||
:parentId="note.id"
|
||||
/>
|
||||
<MkLoading v-else-if="tab === 'replies' && note.repliesCount > 0" />
|
||||
|
||||
<MkNoteSub
|
||||
v-if="directQuotes && tab === 'quotes'"
|
||||
|
@ -85,7 +83,7 @@
|
|||
class="reply"
|
||||
:conversation="replies"
|
||||
:detailedView="true"
|
||||
:parentId="appearNote.id"
|
||||
:parentId="note.id"
|
||||
/>
|
||||
<MkLoading v-else-if="tab === 'quotes' && directQuotes.length > 0" />
|
||||
|
||||
|
@ -103,9 +101,7 @@
|
|||
:with-chart="false"
|
||||
/>
|
||||
<!-- </MkPagination> -->
|
||||
<MkLoading
|
||||
v-else-if="tab === 'renotes' && appearNote.renoteCount > 0"
|
||||
/>
|
||||
<MkLoading v-else-if="tab === 'renotes' && note.renoteCount > 0" />
|
||||
|
||||
<div v-if="tab === 'clips' && clips.length > 0" class="_content clips">
|
||||
<MkA
|
||||
|
@ -132,7 +128,7 @@
|
|||
|
||||
<MkReactedUsers
|
||||
v-if="tab === 'reactions' && reactionsCount > 0"
|
||||
:note-id="appearNote.id"
|
||||
:note-id="note.id"
|
||||
></MkReactedUsers>
|
||||
</div>
|
||||
<div v-else class="_panel muted" @click="muted.muted = false">
|
||||
|
@ -217,23 +213,11 @@ if (noteViewInterruptors.length > 0) {
|
|||
});
|
||||
}
|
||||
|
||||
const isRenote =
|
||||
note.renote != null &&
|
||||
note.text == null &&
|
||||
note.fileIds.length === 0 &&
|
||||
note.poll == null;
|
||||
|
||||
const el = ref<HTMLElement>();
|
||||
const noteEl = $ref();
|
||||
const menuButton = ref<HTMLElement>();
|
||||
const starButton = ref<InstanceType<typeof XStarButton>>();
|
||||
const renoteButton = ref<InstanceType<typeof XRenoteButton>>();
|
||||
const renoteTime = ref<HTMLElement>();
|
||||
const reactButton = ref<HTMLElement>();
|
||||
let appearNote = $computed(() =>
|
||||
isRenote ? (note.renote as misskey.entities.Note) : note
|
||||
);
|
||||
const isMyRenote = $i && $i.id === note.userId;
|
||||
const showContent = ref(false);
|
||||
const isDeleted = ref(false);
|
||||
const muted = ref(getWordSoftMute(note, $i, defaultStore.state.mutedWords));
|
||||
|
@ -263,14 +247,14 @@ const keymap = {
|
|||
|
||||
useNoteCapture({
|
||||
rootEl: el,
|
||||
note: $$(appearNote),
|
||||
note: $$(note),
|
||||
isDeletedRef: isDeleted,
|
||||
});
|
||||
|
||||
function reply(viaKeyboard = false): void {
|
||||
pleaseLogin();
|
||||
os.post({
|
||||
reply: appearNote,
|
||||
reply: note,
|
||||
animation: !viaKeyboard,
|
||||
}).then(() => {
|
||||
focus();
|
||||
|
@ -284,7 +268,7 @@ function react(viaKeyboard = false): void {
|
|||
reactButton.value,
|
||||
(reaction) => {
|
||||
os.api("notes/reactions/create", {
|
||||
noteId: appearNote.id,
|
||||
noteId: note.id,
|
||||
reaction: reaction,
|
||||
});
|
||||
},
|
||||
|
@ -355,27 +339,27 @@ function blur() {
|
|||
|
||||
directReplies = null;
|
||||
os.api("notes/children", {
|
||||
noteId: appearNote.id,
|
||||
noteId: note.id,
|
||||
limit: 30,
|
||||
depth: 12,
|
||||
}).then((res) => {
|
||||
res = res.reduce((acc, note) => {
|
||||
if (note.userId == appearNote.userId) {
|
||||
return [...acc, note];
|
||||
res = res.reduce((acc, resNote) => {
|
||||
if (resNote.userId == note.userId) {
|
||||
return [...acc, resNote];
|
||||
}
|
||||
return [note, ...acc];
|
||||
return [resNote, ...acc];
|
||||
}, []);
|
||||
replies.value = res;
|
||||
directReplies = res
|
||||
.filter((note) => note.replyId === appearNote.id)
|
||||
.filter((resNote) => resNote.replyId === note.id)
|
||||
.reverse();
|
||||
directQuotes = res.filter((note) => note.renoteId === appearNote.id);
|
||||
directQuotes = res.filter((resNote) => resNote.renoteId === note.id);
|
||||
});
|
||||
|
||||
conversation = null;
|
||||
if (appearNote.replyId) {
|
||||
if (note.replyId) {
|
||||
os.api("notes/conversation", {
|
||||
noteId: appearNote.replyId,
|
||||
noteId: note.replyId,
|
||||
limit: 30,
|
||||
}).then((res) => {
|
||||
conversation = res.reverse();
|
||||
|
@ -385,14 +369,14 @@ if (appearNote.replyId) {
|
|||
|
||||
clips = null;
|
||||
os.api("notes/clips", {
|
||||
noteId: appearNote.id,
|
||||
noteId: note.id,
|
||||
}).then((res) => {
|
||||
clips = res;
|
||||
});
|
||||
|
||||
// const pagination = {
|
||||
// endpoint: "notes/renotes",
|
||||
// noteId: appearNote.id,
|
||||
// noteId: note.id,
|
||||
// limit: 10,
|
||||
// };
|
||||
|
||||
|
@ -402,7 +386,7 @@ renotes = null;
|
|||
function loadTab() {
|
||||
if (tab === "renotes" && !renotes) {
|
||||
os.api("notes/renotes", {
|
||||
noteId: appearNote.id,
|
||||
noteId: note.id,
|
||||
limit: 100,
|
||||
}).then((res) => {
|
||||
renotes = res;
|
||||
|
@ -414,7 +398,7 @@ async function onNoteUpdated(noteData: NoteUpdatedEvent): Promise<void> {
|
|||
const { type, id, body } = noteData;
|
||||
|
||||
let found = -1;
|
||||
if (id === appearNote.id) {
|
||||
if (id === note.id) {
|
||||
found = 0;
|
||||
} else {
|
||||
for (let i = 0; i < replies.value.length; i++) {
|
||||
|
|
|
@ -97,7 +97,10 @@
|
|||
:to="`/notes/${note.renoteId}`"
|
||||
>{{ i18n.ts.quoteAttached }}: ...</MkA
|
||||
>
|
||||
<XMediaList v-if="note.files.length > 0" :media-list="note.files" />
|
||||
<XMediaList
|
||||
v-if="note.files.length > 0"
|
||||
:media-list="note.files"
|
||||
/>
|
||||
<XPoll v-if="note.poll" :note="note" class="poll" />
|
||||
<template v-if="detailed">
|
||||
<MkUrlPreview
|
||||
|
@ -151,7 +154,10 @@
|
|||
<i class="ph-stop ph-bold"></i> {{ i18n.ts._mfm.stop }}
|
||||
</template>
|
||||
</MkButton>
|
||||
<div v-if="(isLong && !collapsed) || (props.note.cw && showContent)" class="fade"></div>
|
||||
<div
|
||||
v-if="(isLong && !collapsed) || (props.note.cw && showContent)"
|
||||
class="fade"
|
||||
></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -188,13 +194,13 @@ const emit = defineEmits<{
|
|||
|
||||
const cwButton = ref<HTMLElement>();
|
||||
const showMoreButton = ref<HTMLElement>();
|
||||
const isLong = !props.detailedView
|
||||
&& ( props.note.cw == null
|
||||
&& (props.note.text != null
|
||||
&& (props.note.text.split("\n").length > 9 || props.note.text.length > 500)
|
||||
)
|
||||
|| props.note.files.length > 4
|
||||
);
|
||||
const isLong =
|
||||
!props.detailedView &&
|
||||
((props.note.cw == null &&
|
||||
props.note.text != null &&
|
||||
(props.note.text.split("\n").length > 9 ||
|
||||
props.note.text.length > 500)) ||
|
||||
props.note.files.length > 4);
|
||||
|
||||
const collapsed = $ref(props.note.cw == null && isLong);
|
||||
|
||||
|
@ -238,7 +244,8 @@ function focusFooter(ev) {
|
|||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(a), :deep(button) {
|
||||
:deep(a),
|
||||
:deep(button) {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
@ -390,7 +397,7 @@ function focusFooter(ev) {
|
|||
background: var(--panel);
|
||||
mask: linear-gradient(to top, var(--gradient));
|
||||
-webkit-mask: linear-gradient(to top, var(--gradient));
|
||||
transition: background .2s;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
:name="$store.state.animation ? 'fade' : ''"
|
||||
mode="out-in"
|
||||
>
|
||||
<div v-if="note" class="note">
|
||||
<div v-if="appearNote" class="note">
|
||||
<div v-if="showNext" class="_gap">
|
||||
<XNotes
|
||||
class="_content"
|
||||
|
@ -33,12 +33,12 @@
|
|||
</MkButton>
|
||||
<div class="note _gap">
|
||||
<MkRemoteCaution
|
||||
v-if="note.user.host != null"
|
||||
:href="note.url ?? note.uri"
|
||||
v-if="appearNote.user.host != null"
|
||||
:href="appearNote.url ?? appearNote.uri"
|
||||
/>
|
||||
<XNoteDetailed
|
||||
:key="note.id"
|
||||
v-model:note="note"
|
||||
:key="appearNote.id"
|
||||
v-model:note="appearNote"
|
||||
class="note"
|
||||
/>
|
||||
</div>
|
||||
|
@ -71,7 +71,6 @@
|
|||
<script lang="ts" setup>
|
||||
import { computed, defineComponent, watch } from "vue";
|
||||
import * as misskey from "calckey-js";
|
||||
import XNote from "@/components/MkNote.vue";
|
||||
import XNoteDetailed from "@/components/MkNoteDetailed.vue";
|
||||
import XNotes from "@/components/MkNotes.vue";
|
||||
import MkRemoteCaution from "@/components/MkRemoteCaution.vue";
|
||||
|
@ -90,15 +89,17 @@ let hasNext = $ref(false);
|
|||
let showPrev = $ref(false);
|
||||
let showNext = $ref(false);
|
||||
let error = $ref();
|
||||
let isRenote = $ref(false);
|
||||
let appearNote = $ref<null | misskey.entities.Note>();
|
||||
|
||||
const prevPagination = {
|
||||
endpoint: "users/notes" as const,
|
||||
limit: 10,
|
||||
params: computed(() =>
|
||||
note
|
||||
appearNote
|
||||
? {
|
||||
userId: note.userId,
|
||||
untilId: note.id,
|
||||
userId: appearNote.userId,
|
||||
untilId: appearNote.id,
|
||||
}
|
||||
: null
|
||||
),
|
||||
|
@ -109,10 +110,10 @@ const nextPagination = {
|
|||
endpoint: "users/notes" as const,
|
||||
limit: 10,
|
||||
params: computed(() =>
|
||||
note
|
||||
appearNote
|
||||
? {
|
||||
userId: note.userId,
|
||||
sinceId: note.id,
|
||||
userId: appearNote.userId,
|
||||
sinceId: appearNote.id,
|
||||
}
|
||||
: null
|
||||
),
|
||||
|
@ -129,6 +130,15 @@ function fetchNote() {
|
|||
})
|
||||
.then((res) => {
|
||||
note = res;
|
||||
isRenote =
|
||||
note.renote != null &&
|
||||
note.text == null &&
|
||||
note.fileIds.length === 0 &&
|
||||
note.poll == null;
|
||||
appearNote = isRenote
|
||||
? (note.renote as misskey.entities.Note)
|
||||
: note;
|
||||
|
||||
Promise.all([
|
||||
os.api("users/notes", {
|
||||
userId: note.userId,
|
||||
|
@ -160,19 +170,21 @@ const headerTabs = $computed(() => []);
|
|||
|
||||
definePageMetadata(
|
||||
computed(() =>
|
||||
note
|
||||
appearNote
|
||||
? {
|
||||
title: i18n.t("noteOf", {
|
||||
user: note.user.name || note.user.username,
|
||||
user: appearNote.user.name || appearNote.user.username,
|
||||
}),
|
||||
subtitle: new Date(note.createdAt).toLocaleString(),
|
||||
avatar: note.user,
|
||||
path: `/notes/${note.id}`,
|
||||
subtitle: new Date(appearNote.createdAt).toLocaleString(),
|
||||
avatar: appearNote.user,
|
||||
path: `/notes/${appearNote.id}`,
|
||||
share: {
|
||||
title: i18n.t("noteOf", {
|
||||
user: note.user.name || note.user.username,
|
||||
user:
|
||||
appearNote.user.name ||
|
||||
appearNote.user.username,
|
||||
}),
|
||||
text: note.text,
|
||||
text: appearNote.text,
|
||||
},
|
||||
}
|
||||
: null
|
||||
|
|
|
@ -134,20 +134,19 @@
|
|||
</div>
|
||||
<div class="follow-container">
|
||||
<div class="actions">
|
||||
<MkFollowButton
|
||||
:user="user"
|
||||
@refresh="emit('refresh')"
|
||||
:inline="true"
|
||||
:transparent="false"
|
||||
:full="!narrow"
|
||||
class="koudoku"
|
||||
/>
|
||||
<button class="menu _button" @click="menu">
|
||||
<i
|
||||
class="ph-dots-three-outline ph-bold ph-lg"
|
||||
></i>
|
||||
</button>
|
||||
<!-- <MkFollowButton v-else-if="$i == null" :user="user" :remote="true" :inline="true" :transparent="false" :full="true" class="koudoku"/> -->
|
||||
<MkFollowButton
|
||||
:user="user"
|
||||
@refresh="emit('refresh')"
|
||||
:inline="true"
|
||||
:transparent="false"
|
||||
:full="true"
|
||||
class="koudoku"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="description">
|
||||
|
@ -490,29 +489,6 @@ onUnmounted(() => {
|
|||
border-radius: 6px;
|
||||
}
|
||||
|
||||
> .actions {
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
right: 12px;
|
||||
padding: 8px;
|
||||
border-radius: 24px;
|
||||
|
||||
> .menu {
|
||||
vertical-align: bottom;
|
||||
height: 31px;
|
||||
width: 31px;
|
||||
color: #fff;
|
||||
text-shadow: 0 0 8px var(--shadow);
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
> .koudoku {
|
||||
margin-left: 4px;
|
||||
width: 31px;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
}
|
||||
|
||||
> .title {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
|
@ -581,22 +557,23 @@ onUnmounted(() => {
|
|||
|
||||
> .actions {
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
top: 6px;
|
||||
right: 12px;
|
||||
padding: 8px;
|
||||
border-radius: 24px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
> .menu {
|
||||
vertical-align: bottom;
|
||||
height: 31px;
|
||||
width: 31px;
|
||||
color: --fg;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
> .koudoku {
|
||||
margin-left: 4px;
|
||||
vertical-align: bottom;
|
||||
> :deep(.follow-button) {
|
||||
margin-left: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -797,6 +774,13 @@ onUnmounted(() => {
|
|||
|
||||
> .title {
|
||||
display: block;
|
||||
border-bottom: 0;
|
||||
padding-bottom: 0;
|
||||
> .bottom {
|
||||
> .username {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
> .avatar {
|
||||
|
@ -822,15 +806,19 @@ onUnmounted(() => {
|
|||
}
|
||||
|
||||
> .description {
|
||||
top: -55px;
|
||||
top: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
> .follow-container {
|
||||
overflow: visible !important;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
height: auto;
|
||||
border-bottom: 1px solid var(--divider);
|
||||
padding-bottom: 5px;
|
||||
> .actions {
|
||||
top: -110px;
|
||||
right: 0px;
|
||||
position: static;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,17 @@ import { mainRouter } from "@/router";
|
|||
export async function search() {
|
||||
const { canceled, result: query } = await os.inputText({
|
||||
title: i18n.ts.search,
|
||||
placeholder: i18n.ts.searchPlaceholder,
|
||||
text:
|
||||
"Advanced search operators\n" +
|
||||
"from:user => filter by user\n" +
|
||||
"has:image/video/audio/text/file => filter by attachment types\n" +
|
||||
"domain:domain.com => filter by domain\n" +
|
||||
"before:Date => show posts made before Date\n" +
|
||||
"after:Date => show posts made after Date\n" +
|
||||
'"text" => get posts with exact text between quotes\n' +
|
||||
"filter:following => show results only from users you follow\n" +
|
||||
"filter:followers => show results only from followers\n",
|
||||
});
|
||||
if (canceled || query == null || query === "") return;
|
||||
|
||||
|
|
|
@ -212,6 +212,11 @@ hr {
|
|||
opacity: 0.5;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
> i:only-child {
|
||||
display: block;
|
||||
margin: auto;
|
||||
}
|
||||
}
|
||||
|
||||
._buttonPrimary {
|
||||
|
|
|
@ -89,6 +89,10 @@ export default function (app: App) {
|
|||
"MkwUserList",
|
||||
defineAsyncComponent(() => import("./user-list.vue")),
|
||||
);
|
||||
app.component(
|
||||
"MkwServerInfo",
|
||||
defineAsyncComponent(() => import("./server-info.vue")),
|
||||
);
|
||||
}
|
||||
|
||||
export const widgets = [
|
||||
|
@ -110,6 +114,7 @@ export const widgets = [
|
|||
"postForm",
|
||||
"slideshow",
|
||||
"serverMetric",
|
||||
"serverInfo",
|
||||
"onlineUsers",
|
||||
"jobQueue",
|
||||
"button",
|
||||
|
|
113
packages/client/src/widgets/server-info.vue
Normal file
113
packages/client/src/widgets/server-info.vue
Normal file
|
@ -0,0 +1,113 @@
|
|||
<template>
|
||||
<div class="_panel">
|
||||
<div
|
||||
:class="$style.container"
|
||||
:style="{
|
||||
backgroundImage: $instance.bannerUrl
|
||||
? `url(${$instance.bannerUrl})`
|
||||
: null,
|
||||
}"
|
||||
>
|
||||
<div :class="$style.iconContainer">
|
||||
<img
|
||||
:src="
|
||||
$instance.iconUrl ??
|
||||
$instance.faviconUrl ??
|
||||
'/favicon.ico'
|
||||
"
|
||||
alt=""
|
||||
:class="$style.icon"
|
||||
/>
|
||||
</div>
|
||||
<div :class="$style.bodyContainer">
|
||||
<div :class="$style.body">
|
||||
<MkA :class="$style.name" to="/about" behavior="window">{{
|
||||
$instance.name
|
||||
}}</MkA>
|
||||
<div :class="$style.host">{{ host }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {
|
||||
useWidgetPropsManager,
|
||||
Widget,
|
||||
WidgetComponentEmits,
|
||||
WidgetComponentExpose,
|
||||
WidgetComponentProps,
|
||||
} from "./widget";
|
||||
import { GetFormResultType } from "@/scripts/form";
|
||||
import { host } from "@/config";
|
||||
|
||||
const name = "serverInfo";
|
||||
|
||||
const widgetPropsDef = {};
|
||||
|
||||
type WidgetProps = GetFormResultType<typeof widgetPropsDef>;
|
||||
|
||||
const props = defineProps<{ widget?: Widget<WidgetProps> }>();
|
||||
const emit = defineEmits<{ (ev: "updateProps", props: WidgetProps) }>();
|
||||
|
||||
const { widgetProps, configure } = useWidgetPropsManager(
|
||||
name,
|
||||
widgetPropsDef,
|
||||
props,
|
||||
emit
|
||||
);
|
||||
|
||||
defineExpose<WidgetComponentExpose>({
|
||||
name,
|
||||
configure,
|
||||
id: props.widget ? props.widget.id : null,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" module>
|
||||
.container {
|
||||
position: relative;
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.iconContainer {
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.icon {
|
||||
display: inline-block;
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 8px;
|
||||
box-sizing: border-box;
|
||||
border: solid 3px var(--panelBorder);
|
||||
}
|
||||
|
||||
.bodyContainer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
padding: 0 16px 0 0;
|
||||
}
|
||||
|
||||
.body {
|
||||
text-overflow: ellipsis;
|
||||
overflow: clip;
|
||||
}
|
||||
|
||||
.name,
|
||||
.host {
|
||||
color: var(--fg);
|
||||
text-shadow: -1px -1px 0 var(--bg), 1px -1px 0 var(--bg),
|
||||
-1px 1px 0 var(--bg), 1px 1px 0 var(--bg);
|
||||
}
|
||||
|
||||
.host {
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
|
@ -38,6 +38,11 @@
|
|||
:connection="connection"
|
||||
:meta="meta"
|
||||
/>
|
||||
<XMeili
|
||||
v-else-if="widgetProps.view === 5"
|
||||
:connection="connection"
|
||||
:meta="meta"
|
||||
/>
|
||||
</div>
|
||||
</MkContainer>
|
||||
</template>
|
||||
|
@ -56,6 +61,7 @@ import XNet from "./net.vue";
|
|||
import XCpu from "./cpu.vue";
|
||||
import XMemory from "./mem.vue";
|
||||
import XDisk from "./disk.vue";
|
||||
import XMeili from "./meilisearch.vue";
|
||||
import MkContainer from "@/components/MkContainer.vue";
|
||||
import { GetFormResultType } from "@/scripts/form";
|
||||
import * as os from "@/os";
|
||||
|
@ -102,7 +108,7 @@ os.api("server-info", {}).then((res) => {
|
|||
});
|
||||
|
||||
const toggleView = () => {
|
||||
if (widgetProps.view === 4) {
|
||||
if (widgetProps.view === 5) {
|
||||
widgetProps.view = 0;
|
||||
} else {
|
||||
widgetProps.view++;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue