aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
Diffstat (limited to 'shared')
-rw-r--r--shared/extra-utils/bulk/bulk.ts24
-rw-r--r--shared/extra-utils/index.ts1
-rw-r--r--shared/extra-utils/server/config.ts6
-rw-r--r--shared/extra-utils/videos/video-comments.ts7
-rw-r--r--shared/extra-utils/videos/videos.ts9
-rw-r--r--shared/models/bulk/bulk-remove-comments-of-body.model.ts4
-rw-r--r--shared/models/bulk/index.ts1
-rw-r--r--shared/models/i18n/i18n.ts1
-rw-r--r--shared/models/index.ts1
-rw-r--r--shared/models/server/broadcast-message-level.type.ts1
-rw-r--r--shared/models/server/custom-config.model.ts8
-rw-r--r--shared/models/server/index.ts1
-rw-r--r--shared/models/server/server-config.model.ts10
13 files changed, 72 insertions, 2 deletions
diff --git a/shared/extra-utils/bulk/bulk.ts b/shared/extra-utils/bulk/bulk.ts
new file mode 100644
index 000000000..d6798ceb7
--- /dev/null
+++ b/shared/extra-utils/bulk/bulk.ts
@@ -0,0 +1,24 @@
1import { BulkRemoveCommentsOfBody } from "@shared/models/bulk/bulk-remove-comments-of-body.model"
2import { makePostBodyRequest } from "../requests/requests"
3
4function bulkRemoveCommentsOf (options: {
5 url: string
6 token: string
7 attributes: BulkRemoveCommentsOfBody
8 expectedStatus?: number
9}) {
10 const { url, token, attributes, expectedStatus } = options
11 const path = '/api/v1/bulk/remove-comments-of'
12
13 return makePostBodyRequest({
14 url,
15 path,
16 token,
17 fields: attributes,
18 statusCodeExpected: expectedStatus || 204
19 })
20}
21
22export {
23 bulkRemoveCommentsOf
24}
diff --git a/shared/extra-utils/index.ts b/shared/extra-utils/index.ts
index d3f010b20..2ac0c6338 100644
--- a/shared/extra-utils/index.ts
+++ b/shared/extra-utils/index.ts
@@ -1,4 +1,5 @@
1export * from './server/activitypub' 1export * from './server/activitypub'
2export * from './bulk/bulk'
2export * from './cli/cli' 3export * from './cli/cli'
3export * from './server/clients' 4export * from './server/clients'
4export * from './server/config' 5export * from './server/config'
diff --git a/shared/extra-utils/server/config.ts b/shared/extra-utils/server/config.ts
index 743d10316..98cd435f6 100644
--- a/shared/extra-utils/server/config.ts
+++ b/shared/extra-utils/server/config.ts
@@ -159,6 +159,12 @@ function updateCustomSubConfig (url: string, token: string, newConfig: DeepParti
159 enabled: false 159 enabled: false
160 } 160 }
161 } 161 }
162 },
163 broadcastMessage: {
164 enabled: true,
165 level: 'warning',
166 message: 'hello',
167 dismissable: true
162 } 168 }
163 } 169 }
164 170
diff --git a/shared/extra-utils/videos/video-comments.ts b/shared/extra-utils/videos/video-comments.ts
index 81c48412d..831e5e7d4 100644
--- a/shared/extra-utils/videos/video-comments.ts
+++ b/shared/extra-utils/videos/video-comments.ts
@@ -61,6 +61,12 @@ function addVideoCommentReply (
61 .expect(expectedStatus) 61 .expect(expectedStatus)
62} 62}
63 63
64async function findCommentId (url: string, videoId: number | string, text: string) {
65 const res = await getVideoCommentThreads(url, videoId, 0, 25, '-createdAt')
66
67 return res.body.data.find(c => c.text === text).id as number
68}
69
64function deleteVideoComment ( 70function deleteVideoComment (
65 url: string, 71 url: string,
66 token: string, 72 token: string,
@@ -85,5 +91,6 @@ export {
85 getVideoThreadComments, 91 getVideoThreadComments,
86 addVideoCommentThread, 92 addVideoCommentThread,
87 addVideoCommentReply, 93 addVideoCommentReply,
94 findCommentId,
88 deleteVideoComment 95 deleteVideoComment
89} 96}
diff --git a/shared/extra-utils/videos/videos.ts b/shared/extra-utils/videos/videos.ts
index 0d36a38a2..99e591cb2 100644
--- a/shared/extra-utils/videos/videos.ts
+++ b/shared/extra-utils/videos/videos.ts
@@ -95,6 +95,12 @@ function getVideo (url: string, id: number | string, expectedStatus = 200) {
95 .expect(expectedStatus) 95 .expect(expectedStatus)
96} 96}
97 97
98async function getVideoIdFromUUID (url: string, uuid: string) {
99 const res = await getVideo(url, uuid)
100
101 return res.body.id
102}
103
98function getVideoFileMetadataUrl (url: string) { 104function getVideoFileMetadataUrl (url: string) {
99 return request(url) 105 return request(url)
100 .get('/') 106 .get('/')
@@ -669,5 +675,6 @@ export {
669 checkVideoFilesWereRemoved, 675 checkVideoFilesWereRemoved,
670 getPlaylistVideos, 676 getPlaylistVideos,
671 uploadVideoAndGetId, 677 uploadVideoAndGetId,
672 getLocalIdByUUID 678 getLocalIdByUUID,
679 getVideoIdFromUUID
673} 680}
diff --git a/shared/models/bulk/bulk-remove-comments-of-body.model.ts b/shared/models/bulk/bulk-remove-comments-of-body.model.ts
new file mode 100644
index 000000000..31e018c2a
--- /dev/null
+++ b/shared/models/bulk/bulk-remove-comments-of-body.model.ts
@@ -0,0 +1,4 @@
1export interface BulkRemoveCommentsOfBody {
2 accountName: string
3 scope: 'my-videos' | 'instance'
4}
diff --git a/shared/models/bulk/index.ts b/shared/models/bulk/index.ts
new file mode 100644
index 000000000..168c8cd48
--- /dev/null
+++ b/shared/models/bulk/index.ts
@@ -0,0 +1 @@
export * from './bulk-remove-comments-of-body.model'
diff --git a/shared/models/i18n/i18n.ts b/shared/models/i18n/i18n.ts
index 46940772f..9a5ea27dc 100644
--- a/shared/models/i18n/i18n.ts
+++ b/shared/models/i18n/i18n.ts
@@ -18,6 +18,7 @@ export const I18N_LOCALES = {
18 'it-IT': 'Italiano', 18 'it-IT': 'Italiano',
19 'ja-JP': '日本語', 19 'ja-JP': '日本語',
20 'nl-NL': 'Nederlands', 20 'nl-NL': 'Nederlands',
21 'oc': 'Occitan',
21 'pl-PL': 'Polski', 22 'pl-PL': 'Polski',
22 'pt-BR': 'Português (Brasil)', 23 'pt-BR': 'Português (Brasil)',
23 'pt-PT': 'Português (Portugal)', 24 'pt-PT': 'Português (Portugal)',
diff --git a/shared/models/index.ts b/shared/models/index.ts
index 062533834..b562e04a3 100644
--- a/shared/models/index.ts
+++ b/shared/models/index.ts
@@ -2,6 +2,7 @@ export * from './activitypub'
2export * from './actors' 2export * from './actors'
3export * from './avatars' 3export * from './avatars'
4export * from './blocklist' 4export * from './blocklist'
5export * from './bulk'
5export * from './redundancy' 6export * from './redundancy'
6export * from './users' 7export * from './users'
7export * from './videos' 8export * from './videos'
diff --git a/shared/models/server/broadcast-message-level.type.ts b/shared/models/server/broadcast-message-level.type.ts
new file mode 100644
index 000000000..bf43e18b5
--- /dev/null
+++ b/shared/models/server/broadcast-message-level.type.ts
@@ -0,0 +1 @@
export type BroadcastMessageLevel = 'info' | 'warning' | 'error'
diff --git a/shared/models/server/custom-config.model.ts b/shared/models/server/custom-config.model.ts
index 07e17bda2..851bf1854 100644
--- a/shared/models/server/custom-config.model.ts
+++ b/shared/models/server/custom-config.model.ts
@@ -1,4 +1,5 @@
1import { NSFWPolicyType } from '../videos/nsfw-policy.type' 1import { NSFWPolicyType } from '../videos/nsfw-policy.type'
2import { BroadcastMessageLevel } from './broadcast-message-level.type'
2 3
3export interface CustomConfig { 4export interface CustomConfig {
4 instance: { 5 instance: {
@@ -131,4 +132,11 @@ export interface CustomConfig {
131 } 132 }
132 } 133 }
133 } 134 }
135
136 broadcastMessage: {
137 enabled: boolean
138 message: string
139 level: BroadcastMessageLevel
140 dismissable: boolean
141 }
134} 142}
diff --git a/shared/models/server/index.ts b/shared/models/server/index.ts
index b0afb2c66..2bb443d46 100644
--- a/shared/models/server/index.ts
+++ b/shared/models/server/index.ts
@@ -1,4 +1,5 @@
1export * from './about.model' 1export * from './about.model'
2export * from './broadcast-message-level.type'
2export * from './contact-form.model' 3export * from './contact-form.model'
3export * from './custom-config.model' 4export * from './custom-config.model'
4export * from './debug.model' 5export * from './debug.model'
diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts
index a1f9b3b5d..9c903b7ee 100644
--- a/shared/models/server/server-config.model.ts
+++ b/shared/models/server/server-config.model.ts
@@ -1,5 +1,6 @@
1import { NSFWPolicyType } from '../videos/nsfw-policy.type'
2import { ClientScript } from '../plugins/plugin-package-json.model' 1import { ClientScript } from '../plugins/plugin-package-json.model'
2import { NSFWPolicyType } from '../videos/nsfw-policy.type'
3import { BroadcastMessageLevel } from './broadcast-message-level.type'
3 4
4export interface ServerConfigPlugin { 5export interface ServerConfigPlugin {
5 name: string 6 name: string
@@ -161,4 +162,11 @@ export interface ServerConfig {
161 } 162 }
162 } 163 }
163 } 164 }
165
166 broadcastMessage: {
167 enabled: boolean
168 message: string
169 level: BroadcastMessageLevel
170 dismissable: boolean
171 }
164} 172}