Merge branch 'develop' into pyrox-aiscript-0.13

This commit is contained in:
ThatOneCalculator 2023-06-06 21:02:23 -07:00
commit 10b146fb2d
No known key found for this signature in database
GPG key ID: 8703CACD01000000
14 changed files with 48 additions and 14 deletions

View file

@ -23,6 +23,12 @@ export const meta = {
code: "NO_SUCH_USER_GROUP",
id: "aa3c0b9a-8cae-47c0-92ac-202ce5906682",
},
tooManyAntennas: {
message: "Too many antennas.",
code: "TOO_MANY_ANTENNAS",
id: "c3a5a51e-04d4-11ee-be56-0242ac120002",
},
},
res: {
@ -97,6 +103,13 @@ export default define(meta, paramDef, async (ps, user) => {
let userList;
let userGroupJoining;
const antennas = await Antennas.findBy({
userId: user.id,
});
if (antennas.length > 5 && !user.isAdmin) {
throw new ApiError(meta.errors.tooManyAntennas);
}
if (ps.src === "list" && ps.userListId) {
userList = await UserLists.findOneBy({
id: ps.userListId,

View file

@ -323,7 +323,7 @@ export const meta = {
optional: false,
nullable: false,
},
elasticsearch: {
searchFilters: {
type: "boolean",
optional: false,
nullable: false,
@ -521,7 +521,7 @@ export default define(meta, paramDef, async (ps, me) => {
recommendedTimeline: !instance.disableRecommendedTimeline,
globalTimeLine: !instance.disableGlobalTimeline,
emailRequiredForSignup: instance.emailRequiredForSignup,
elasticsearch: config.elasticsearch ? true : false,
searchFilters: config.meilisearch ? true : false,
hcaptcha: instance.enableHcaptcha,
recaptcha: instance.enableRecaptcha,
objectStorage: instance.useObjectStorage,

View file

@ -82,6 +82,9 @@ const nodeinfo2 = async () => {
disableRecommendedTimeline: meta.disableRecommendedTimeline,
disableGlobalTimeline: meta.disableGlobalTimeline,
emailRequiredForSignup: meta.emailRequiredForSignup,
searchFilters: config.meilisearch ? true : false,
postEditing: meta.experimentalFeatures?.postEditing || false,
postImports: meta.experimentalFeatures?.postImports || false,
enableHcaptcha: meta.enableHcaptcha,
enableRecaptcha: meta.enableRecaptcha,
maxNoteTextLength: MAX_NOTE_TEXT_LENGTH,

View file

@ -422,6 +422,10 @@ router.get("/notes/:note", async (ctx, next) => {
});
ctx.set("Cache-Control", "public, max-age=15");
ctx.set(
"Content-Security-Policy",
"default-src 'self'; frame-ancestors '*'",
);
return;
}

View file

@ -1,6 +1,7 @@
import * as os from "@/os";
import { i18n } from "@/i18n";
import { mainRouter } from "@/router";
// import { instance } from "@/instance";
export async function search() {
// const searchOptions =
@ -14,6 +15,8 @@ export async function search() {
// "filter:following => show results only from users you follow\n" +
// "filter:followers => show results only from followers\n";
// const searchFiltersAvailable = instance.searchFilters;
const { canceled, result: query } = await os.inputText({
title: i18n.ts.search,
placeholder: i18n.ts.searchPlaceholder,

View file

@ -39,7 +39,7 @@
:meta="meta"
/>
<XMeili
v-else-if="widgetProps.view === 5"
v-else-if="instance.searchFilters && widgetProps.view === 5"
:connection="connection"
:meta="meta"
/>
@ -67,6 +67,7 @@ import { GetFormResultType } from "@/scripts/form";
import * as os from "@/os";
import { stream } from "@/stream";
import { i18n } from "@/i18n";
import { instance } from "@/instance";
const name = "serverMetric";
@ -108,7 +109,10 @@ os.api("server-info", {}).then((res) => {
});
const toggleView = () => {
if (widgetProps.view === 5) {
if (
(widgetProps.view === 5 && instance.searchFilters) ||
(widgetProps.view === 4 && !instance.searchFilters)
) {
widgetProps.view = 0;
} else {
widgetProps.view++;

View file

@ -5,7 +5,7 @@
"build": "webpack",
"watch": "pnpm swc src -d built -D -w",
"lint": "pnpm rome check \"src/**/*.ts\"",
"format": "pnpm rome format * --write && pnpm rome check --apply *"
"format": "pnpm rome format * --write"
},
"devDependencies": {
"@swc/cli": "^0.1.62",

View file

@ -1,7 +1,7 @@
/*
* Notification manager for SW
*/
declare var self: ServiceWorkerGlobalScope;
declare let self: ServiceWorkerGlobalScope;
import { swLang } from "@/scripts/lang";
import { cli } from "@/scripts/operations";
@ -45,7 +45,7 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(
*/
case "notification":
switch (data.body.type) {
case "follow":
case "follow": {
// users/showの型定義をswos.apiへ当てはめるのが困難なのでapiFetch.requestを直接使用
const account = await getAccountFromId(data.userId);
if (!account) return null;
@ -71,6 +71,7 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(
],
},
];
}
case "mention":
return [
@ -157,7 +158,7 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(
},
];
case "reaction":
case "reaction": {
let reaction = data.body.reaction;
let badge: string | undefined;
@ -214,6 +215,7 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(
],
},
];
}
case "pollVote":
return [

View file

@ -1,7 +1,7 @@
/*
* Language manager for SW
*/
declare var self: ServiceWorkerGlobalScope;
declare let self: ServiceWorkerGlobalScope;
import { get, set } from "idb-keyval";
import { I18n } from "@/scripts/i18n";
@ -23,7 +23,7 @@ class SwLang {
public i18n: Promise<I18n<any>> | null = null;
public fetchLocale() {
return (this.i18n = this._fetch());
return this.i18n === this._fetch();
}
private async _fetch() {

View file

@ -1,4 +1,4 @@
declare var self: ServiceWorkerGlobalScope;
declare let self: ServiceWorkerGlobalScope;
import { get } from "idb-keyval";
import { pushNotificationDataMap } from "@/types";

View file

@ -2,7 +2,7 @@
* Operations
*
*/
declare var self: ServiceWorkerGlobalScope;
declare let self: ServiceWorkerGlobalScope;
import * as Misskey from "calckey-js";
import { SwMessage, swMessageOrderType } from "@/types";

View file

@ -1,4 +1,4 @@
declare var self: ServiceWorkerGlobalScope;
declare let self: ServiceWorkerGlobalScope;
import {
createEmptyNotification,

View file

@ -47,6 +47,11 @@
"@natalie@prismst.one",
"@KelsonV@wandering.shop",
"@breakfastmtn@calckey.social",
"@richardazia@mastodon.social",
"@joestone@calckey.social",
"@aj@calckey.social",
"@zepfanman@ramblingreaders.org",
"@kimby@stop.voring.me",
"\nInterkosmos Link"
]
}

View file

@ -13,7 +13,7 @@
"packages/*/package-lock.json",
"packages/backend/src/server/web/manifest.ts",
"packages/backend/built/",
"packages/backend/nsfw-model/",
"*/model.json",
"packages/client/src/emojilist.json",
"*.md",
"**/tsconfig.json",