diff options
-rw-r--r-- | client/src/app/+about/about-instance/about-instance.component.html | 12 | ||||
-rw-r--r-- | client/src/app/+about/about-instance/about-instance.component.ts | 3 | ||||
-rw-r--r-- | client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html | 14 | ||||
-rw-r--r-- | client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | 2 | ||||
-rw-r--r-- | client/src/app/shared/instance/instance.service.ts | 5 | ||||
-rw-r--r-- | config/default.yaml | 4 | ||||
-rw-r--r-- | config/production.yaml.example | 4 | ||||
-rw-r--r-- | server/controllers/api/config.ts | 3 | ||||
-rw-r--r-- | server/initializers/config.ts | 1 | ||||
-rw-r--r-- | server/tests/api/check-params/config.ts | 1 | ||||
-rw-r--r-- | server/tests/api/server/config.ts | 14 | ||||
-rw-r--r-- | shared/extra-utils/server/config.ts | 1 | ||||
-rw-r--r-- | shared/models/server/about.model.ts | 1 | ||||
-rw-r--r-- | shared/models/server/custom-config.model.ts | 1 |
14 files changed, 62 insertions, 4 deletions
diff --git a/client/src/app/+about/about-instance/about-instance.component.html b/client/src/app/+about/about-instance/about-instance.component.html index 8b21137af..9499bbe4e 100644 --- a/client/src/app/+about/about-instance/about-instance.component.html +++ b/client/src/app/+about/about-instance/about-instance.component.html | |||
@@ -73,11 +73,21 @@ | |||
73 | <div [innerHTML]="html.codeOfConduct"></div> | 73 | <div [innerHTML]="html.codeOfConduct"></div> |
74 | </div> | 74 | </div> |
75 | 75 | ||
76 | <div class="block terms" id="terms-section"> | 76 | <div class="block terms"> |
77 | <div i18n class="section-title">Terms</div> | 77 | <div i18n class="section-title">Terms</div> |
78 | 78 | ||
79 | <div [innerHTML]="html.terms"></div> | 79 | <div [innerHTML]="html.terms"></div> |
80 | </div> | 80 | </div> |
81 | |||
82 | <div class="middle-title" *ngIf="html.hardwareInformation"> | ||
83 | Other information | ||
84 | </div> | ||
85 | |||
86 | <div class="block hardware-information"> | ||
87 | <div i18n class="section-title">Hardware information</div> | ||
88 | |||
89 | <div [innerHTML]="html.hardwareInformation"></div> | ||
90 | </div> | ||
81 | </div> | 91 | </div> |
82 | 92 | ||
83 | <div class="col-md-12 col-xl-6"> | 93 | <div class="col-md-12 col-xl-6"> |
diff --git a/client/src/app/+about/about-instance/about-instance.component.ts b/client/src/app/+about/about-instance/about-instance.component.ts index b6cade4fe..16ccae2e2 100644 --- a/client/src/app/+about/about-instance/about-instance.component.ts +++ b/client/src/app/+about/about-instance/about-instance.component.ts | |||
@@ -22,7 +22,8 @@ export class AboutInstanceComponent implements OnInit { | |||
22 | terms: '', | 22 | terms: '', |
23 | codeOfConduct: '', | 23 | codeOfConduct: '', |
24 | moderationInformation: '', | 24 | moderationInformation: '', |
25 | administrator: '' | 25 | administrator: '', |
26 | hardwareInformation: '' | ||
26 | } | 27 | } |
27 | 28 | ||
28 | creationReason = '' | 29 | creationReason = '' |
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html index ef24e5b24..54115055a 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html | |||
@@ -174,6 +174,20 @@ | |||
174 | <div *ngIf="formErrors.instance.businessModel" class="form-error">{{ formErrors.instance.businessModel }}</div> | 174 | <div *ngIf="formErrors.instance.businessModel" class="form-error">{{ formErrors.instance.businessModel }}</div> |
175 | </div> | 175 | </div> |
176 | 176 | ||
177 | <div i18n class="inner-form-title">Other information</div> | ||
178 | |||
179 | <div class="form-group"> | ||
180 | <label i18n for="instanceHardwareInformation">On what server/hardware the instance runs?</label> | ||
181 | <div class="label-small-info">2vCore 2GB RAM/or directly the link to the server you rent etc</div> | ||
182 | |||
183 | <my-markdown-textarea | ||
184 | id="instanceHardwareInformation" formControlName="hardwareInformation" textareaWidth="500px" textareaHeight="75px" [previewColumn]="true" | ||
185 | [classes]="{ 'input-error': formErrors['instance.hardwareInformation'] }" | ||
186 | ></my-markdown-textarea> | ||
187 | |||
188 | <div *ngIf="formErrors.instance.hardwareInformation" class="form-error">{{ formErrors.instance.hardwareInformation }}</div> | ||
189 | </div> | ||
190 | |||
177 | </ng-container> | 191 | </ng-container> |
178 | </ng-template> | 192 | </ng-template> |
179 | </ngb-tab> | 193 | </ngb-tab> |
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index e6f56bc97..0a69f3481 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | |||
@@ -107,6 +107,8 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
107 | maintenanceLifetime: null, | 107 | maintenanceLifetime: null, |
108 | businessModel: null, | 108 | businessModel: null, |
109 | 109 | ||
110 | hardwareInformation: null, | ||
111 | |||
110 | categories: null, | 112 | categories: null, |
111 | languages: null, | 113 | languages: null, |
112 | 114 | ||
diff --git a/client/src/app/shared/instance/instance.service.ts b/client/src/app/shared/instance/instance.service.ts index 7c76bc98b..44b413fa4 100644 --- a/client/src/app/shared/instance/instance.service.ts +++ b/client/src/app/shared/instance/instance.service.ts | |||
@@ -46,10 +46,11 @@ export class InstanceService { | |||
46 | terms: '', | 46 | terms: '', |
47 | codeOfConduct: '', | 47 | codeOfConduct: '', |
48 | moderationInformation: '', | 48 | moderationInformation: '', |
49 | administrator: '' | 49 | administrator: '', |
50 | hardwareInformation: '' | ||
50 | } | 51 | } |
51 | 52 | ||
52 | for (const key of [ 'description', 'terms', 'codeOfConduct', 'moderationInformation', 'administrator' ]) { | 53 | for (const key of Object.keys(html)) { |
53 | html[ key ] = await this.markdownService.textMarkdownToHTML(about.instance[ key ]) | 54 | html[ key ] = await this.markdownService.textMarkdownToHTML(about.instance[ key ]) |
54 | } | 55 | } |
55 | 56 | ||
diff --git a/config/default.yaml b/config/default.yaml index 7ed096dcd..5ebfdeddb 100644 --- a/config/default.yaml +++ b/config/default.yaml | |||
@@ -255,6 +255,10 @@ instance: | |||
255 | # How will you pay the PeerTube instance server? With you own funds? With users donations? Advertising? | 255 | # How will you pay the PeerTube instance server? With you own funds? With users donations? Advertising? |
256 | business_model: '' | 256 | business_model: '' |
257 | 257 | ||
258 | # If you want to explain on what type of hardware your PeerTube instance runs | ||
259 | # Example: "2 vCore, 2GB RAM..." | ||
260 | hardware_information: '' # Supports Markdown | ||
261 | |||
258 | # What are the main languages of your instance? To interact with your users for example | 262 | # What are the main languages of your instance? To interact with your users for example |
259 | # Uncomment or add the languages you want | 263 | # Uncomment or add the languages you want |
260 | # List of supported languages: https://peertube.cpy.re/api/v1/videos/languages | 264 | # List of supported languages: https://peertube.cpy.re/api/v1/videos/languages |
diff --git a/config/production.yaml.example b/config/production.yaml.example index b86068bde..96d676a35 100644 --- a/config/production.yaml.example +++ b/config/production.yaml.example | |||
@@ -270,6 +270,10 @@ instance: | |||
270 | # How will you pay the PeerTube instance server? With you own funds? With users donations? Advertising? | 270 | # How will you pay the PeerTube instance server? With you own funds? With users donations? Advertising? |
271 | business_model: '' | 271 | business_model: '' |
272 | 272 | ||
273 | # If you want to explain on what type of hardware your PeerTube instance runs | ||
274 | # Example: "2 vCore, 2GB RAM..." | ||
275 | hardware_information: '' # Supports Markdown | ||
276 | |||
273 | # What are the main languages of your instance? To interact with your users for example | 277 | # What are the main languages of your instance? To interact with your users for example |
274 | # Uncomment or add the languages you want | 278 | # Uncomment or add the languages you want |
275 | # List of supported languages: https://peertube.cpy.re/api/v1/videos/languages | 279 | # List of supported languages: https://peertube.cpy.re/api/v1/videos/languages |
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts index 909907ad6..39a124fc5 100644 --- a/server/controllers/api/config.ts +++ b/server/controllers/api/config.ts | |||
@@ -161,6 +161,8 @@ function getAbout (req: express.Request, res: express.Response) { | |||
161 | terms: CONFIG.INSTANCE.TERMS, | 161 | terms: CONFIG.INSTANCE.TERMS, |
162 | codeOfConduct: CONFIG.INSTANCE.CODE_OF_CONDUCT, | 162 | codeOfConduct: CONFIG.INSTANCE.CODE_OF_CONDUCT, |
163 | 163 | ||
164 | hardwareInformation: CONFIG.INSTANCE.HARDWARE_INFORMATION, | ||
165 | |||
164 | creationReason: CONFIG.INSTANCE.CREATION_REASON, | 166 | creationReason: CONFIG.INSTANCE.CREATION_REASON, |
165 | moderationInformation: CONFIG.INSTANCE.MODERATION_INFORMATION, | 167 | moderationInformation: CONFIG.INSTANCE.MODERATION_INFORMATION, |
166 | administrator: CONFIG.INSTANCE.ADMINISTRATOR, | 168 | administrator: CONFIG.INSTANCE.ADMINISTRATOR, |
@@ -238,6 +240,7 @@ function customConfig (): CustomConfig { | |||
238 | administrator: CONFIG.INSTANCE.ADMINISTRATOR, | 240 | administrator: CONFIG.INSTANCE.ADMINISTRATOR, |
239 | maintenanceLifetime: CONFIG.INSTANCE.MAINTENANCE_LIFETIME, | 241 | maintenanceLifetime: CONFIG.INSTANCE.MAINTENANCE_LIFETIME, |
240 | businessModel: CONFIG.INSTANCE.BUSINESS_MODEL, | 242 | businessModel: CONFIG.INSTANCE.BUSINESS_MODEL, |
243 | hardwareInformation: CONFIG.INSTANCE.HARDWARE_INFORMATION, | ||
241 | 244 | ||
242 | languages: CONFIG.INSTANCE.LANGUAGES, | 245 | languages: CONFIG.INSTANCE.LANGUAGES, |
243 | categories: CONFIG.INSTANCE.CATEGORIES, | 246 | categories: CONFIG.INSTANCE.CATEGORIES, |
diff --git a/server/initializers/config.ts b/server/initializers/config.ts index 8df411ca5..164d714d6 100644 --- a/server/initializers/config.ts +++ b/server/initializers/config.ts | |||
@@ -217,6 +217,7 @@ const CONFIG = { | |||
217 | get ADMINISTRATOR () { return config.get<string>('instance.administrator') }, | 217 | get ADMINISTRATOR () { return config.get<string>('instance.administrator') }, |
218 | get MAINTENANCE_LIFETIME () { return config.get<string>('instance.maintenance_lifetime') }, | 218 | get MAINTENANCE_LIFETIME () { return config.get<string>('instance.maintenance_lifetime') }, |
219 | get BUSINESS_MODEL () { return config.get<string>('instance.business_model') }, | 219 | get BUSINESS_MODEL () { return config.get<string>('instance.business_model') }, |
220 | get HARDWARE_INFORMATION () { return config.get<string>('instance.hardware_information') }, | ||
220 | 221 | ||
221 | get LANGUAGES () { return config.get<string[]>('instance.languages') || [] }, | 222 | get LANGUAGES () { return config.get<string[]>('instance.languages') || [] }, |
222 | get CATEGORIES () { return config.get<number[]>('instance.categories') || [] }, | 223 | get CATEGORIES () { return config.get<number[]>('instance.categories') || [] }, |
diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts index 9b902a1cd..9435bb1e8 100644 --- a/server/tests/api/check-params/config.ts +++ b/server/tests/api/check-params/config.ts | |||
@@ -34,6 +34,7 @@ describe('Test config API validators', function () { | |||
34 | administrator: 'Kuja', | 34 | administrator: 'Kuja', |
35 | maintenanceLifetime: 'forever', | 35 | maintenanceLifetime: 'forever', |
36 | businessModel: 'my super business model', | 36 | businessModel: 'my super business model', |
37 | hardwareInformation: '2vCore 3GB RAM', | ||
37 | 38 | ||
38 | languages: [ 'en', 'es' ], | 39 | languages: [ 'en', 'es' ], |
39 | categories: [ 1, 2 ], | 40 | categories: [ 1, 2 ], |
diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts index 85d0f9702..97cc99eea 100644 --- a/server/tests/api/server/config.ts +++ b/server/tests/api/server/config.ts | |||
@@ -36,6 +36,7 @@ function checkInitialConfig (server: ServerInfo, data: CustomConfig) { | |||
36 | expect(data.instance.administrator).to.be.empty | 36 | expect(data.instance.administrator).to.be.empty |
37 | expect(data.instance.maintenanceLifetime).to.be.empty | 37 | expect(data.instance.maintenanceLifetime).to.be.empty |
38 | expect(data.instance.businessModel).to.be.empty | 38 | expect(data.instance.businessModel).to.be.empty |
39 | expect(data.instance.hardwareInformation).to.be.empty | ||
39 | 40 | ||
40 | expect(data.instance.languages).to.have.lengthOf(0) | 41 | expect(data.instance.languages).to.have.lengthOf(0) |
41 | expect(data.instance.categories).to.have.lengthOf(0) | 42 | expect(data.instance.categories).to.have.lengthOf(0) |
@@ -97,6 +98,7 @@ function checkUpdatedConfig (data: CustomConfig) { | |||
97 | expect(data.instance.administrator).to.equal('Kuja') | 98 | expect(data.instance.administrator).to.equal('Kuja') |
98 | expect(data.instance.maintenanceLifetime).to.equal('forever') | 99 | expect(data.instance.maintenanceLifetime).to.equal('forever') |
99 | expect(data.instance.businessModel).to.equal('my super business model') | 100 | expect(data.instance.businessModel).to.equal('my super business model') |
101 | expect(data.instance.hardwareInformation).to.equal('2vCore 3GB RAM') | ||
100 | 102 | ||
101 | expect(data.instance.languages).to.deep.equal([ 'en', 'es' ]) | 103 | expect(data.instance.languages).to.deep.equal([ 'en', 'es' ]) |
102 | expect(data.instance.categories).to.deep.equal([ 1, 2 ]) | 104 | expect(data.instance.categories).to.deep.equal([ 1, 2 ]) |
@@ -219,6 +221,7 @@ describe('Test config', function () { | |||
219 | administrator: 'Kuja', | 221 | administrator: 'Kuja', |
220 | maintenanceLifetime: 'forever', | 222 | maintenanceLifetime: 'forever', |
221 | businessModel: 'my super business model', | 223 | businessModel: 'my super business model', |
224 | hardwareInformation: '2vCore 3GB RAM', | ||
222 | 225 | ||
223 | languages: [ 'en', 'es' ], | 226 | languages: [ 'en', 'es' ], |
224 | categories: [ 1, 2 ], | 227 | categories: [ 1, 2 ], |
@@ -362,6 +365,17 @@ describe('Test config', function () { | |||
362 | expect(data.instance.shortDescription).to.equal('my short description') | 365 | expect(data.instance.shortDescription).to.equal('my short description') |
363 | expect(data.instance.description).to.equal('my super description') | 366 | expect(data.instance.description).to.equal('my super description') |
364 | expect(data.instance.terms).to.equal('my super terms') | 367 | expect(data.instance.terms).to.equal('my super terms') |
368 | expect(data.instance.codeOfConduct).to.equal('my super coc') | ||
369 | |||
370 | expect(data.instance.creationReason).to.equal('my super creation reason') | ||
371 | expect(data.instance.moderationInformation).to.equal('my super moderation information') | ||
372 | expect(data.instance.administrator).to.equal('Kuja') | ||
373 | expect(data.instance.maintenanceLifetime).to.equal('forever') | ||
374 | expect(data.instance.businessModel).to.equal('my super business model') | ||
375 | expect(data.instance.hardwareInformation).to.equal('2vCore 3GB RAM') | ||
376 | |||
377 | expect(data.instance.languages).to.deep.equal([ 'en', 'es' ]) | ||
378 | expect(data.instance.categories).to.deep.equal([ 1, 2 ]) | ||
365 | }) | 379 | }) |
366 | 380 | ||
367 | it('Should remove the custom configuration', async function () { | 381 | it('Should remove the custom configuration', async function () { |
diff --git a/shared/extra-utils/server/config.ts b/shared/extra-utils/server/config.ts index 66e0a008e..578dd35cf 100644 --- a/shared/extra-utils/server/config.ts +++ b/shared/extra-utils/server/config.ts | |||
@@ -60,6 +60,7 @@ function updateCustomSubConfig (url: string, token: string, newConfig: DeepParti | |||
60 | administrator: 'Kuja', | 60 | administrator: 'Kuja', |
61 | maintenanceLifetime: 'forever', | 61 | maintenanceLifetime: 'forever', |
62 | businessModel: 'my super business model', | 62 | businessModel: 'my super business model', |
63 | hardwareInformation: '2vCore 3GB RAM', | ||
63 | 64 | ||
64 | languages: [ 'en', 'es' ], | 65 | languages: [ 'en', 'es' ], |
65 | categories: [ 1, 2 ], | 66 | categories: [ 1, 2 ], |
diff --git a/shared/models/server/about.model.ts b/shared/models/server/about.model.ts index bde4e0b50..6d4ba63c4 100644 --- a/shared/models/server/about.model.ts +++ b/shared/models/server/about.model.ts | |||
@@ -6,6 +6,7 @@ export interface About { | |||
6 | terms: string | 6 | terms: string |
7 | 7 | ||
8 | codeOfConduct: string | 8 | codeOfConduct: string |
9 | hardwareInformation: string | ||
9 | 10 | ||
10 | creationReason: string | 11 | creationReason: string |
11 | moderationInformation: string | 12 | moderationInformation: string |
diff --git a/shared/models/server/custom-config.model.ts b/shared/models/server/custom-config.model.ts index a7c2a3bab..c9957f825 100644 --- a/shared/models/server/custom-config.model.ts +++ b/shared/models/server/custom-config.model.ts | |||
@@ -13,6 +13,7 @@ export interface CustomConfig { | |||
13 | administrator: string | 13 | administrator: string |
14 | maintenanceLifetime: string | 14 | maintenanceLifetime: string |
15 | businessModel: string | 15 | businessModel: string |
16 | hardwareInformation: string | ||
16 | 17 | ||
17 | languages: string[] | 18 | languages: string[] |
18 | categories: number[] | 19 | categories: number[] |