Add custom offline message+api. Part of #1901
This commit is contained in:
@@ -4,6 +4,7 @@ request = request('http://127.0.0.1:8080');
|
||||
const serverName = randomString();
|
||||
const streamTitle = randomString();
|
||||
const serverSummary = randomString();
|
||||
const offlineMessage = randomString();
|
||||
const pageContent = `<p>${randomString()}</p>`;
|
||||
const tags = [randomString(), randomString(), randomString()];
|
||||
const latencyLevel = Math.floor(Math.random() * 4);
|
||||
@@ -97,12 +98,18 @@ test('set hide viewer count', async (done) => {
|
||||
done();
|
||||
});
|
||||
|
||||
test('set offline message', async (done) => {
|
||||
const res = await sendConfigChangeRequest('offlinemessage', offlineMessage);
|
||||
done();
|
||||
});
|
||||
|
||||
test('verify updated config values', async (done) => {
|
||||
const res = await request.get('/api/config');
|
||||
expect(res.body.name).toBe(serverName);
|
||||
expect(res.body.streamTitle).toBe(streamTitle);
|
||||
expect(res.body.summary).toBe(`${serverSummary}`);
|
||||
expect(res.body.extraPageContent).toBe(pageContent);
|
||||
expect(res.body.offlineMessage).toBe(offlineMessage);
|
||||
expect(res.body.logo).toBe('/logo');
|
||||
expect(res.body.socialHandles).toStrictEqual(socialHandles);
|
||||
done();
|
||||
@@ -134,6 +141,7 @@ test('admin configuration is correct', (done) => {
|
||||
.then((res) => {
|
||||
expect(res.body.instanceDetails.name).toBe(serverName);
|
||||
expect(res.body.instanceDetails.summary).toBe(serverSummary);
|
||||
expect(res.body.instanceDetails.offlineMessage).toBe(offlineMessage);
|
||||
expect(res.body.instanceDetails.tags).toStrictEqual(tags);
|
||||
expect(res.body.instanceDetails.socialHandles).toStrictEqual(
|
||||
socialHandles
|
||||
|
||||
@@ -124,3 +124,23 @@ curl 'http://localhost:8080/api/admin/config/externalactions' \
|
||||
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36' \
|
||||
--data-raw '{"value":[{"url":"https://owncast.online/docs","title":"Documentation","description":"","icon":"","color":"","openExternally":false},{"url":"https://media1.giphy.com/media/Ju7l5y9osyymQ/giphy.gif?cid=ecf05e47otegqpl9mqfz880pi861dnjm5loy6kyrquy9lku0&rid=giphy.gif&ct=g","title":"Important","description":"","icon":"https://findicons.com/files/icons/1184/quickpix_2008/128/rick_roll_d.png","color":"#c87fd7","openExternally":false},{"url":"https://randommer.io/random-images","title":"New Tab","description":"","icon":"","color":"","openExternally":true}]}' \
|
||||
--compressed
|
||||
|
||||
# Offline message
|
||||
|
||||
curl 'http://localhost:8080/api/admin/config/offlinemessage' \
|
||||
-H 'Accept: */*' \
|
||||
-H 'Accept-Language: en-US,en;q=0.9' \
|
||||
-H 'Authorization: Basic YWRtaW46YWJjMTIz' \
|
||||
-H 'Cache-Control: no-cache' \
|
||||
-H 'Connection: keep-alive' \
|
||||
-H 'Content-Type: text/plain;charset=UTF-8' \
|
||||
-H 'Origin: http://localhost:8080' \
|
||||
-H 'Pragma: no-cache' \
|
||||
-H 'Referer: http://localhost:8080/admin/config-public-details/' \
|
||||
-H 'Sec-Fetch-Dest: empty' \
|
||||
-H 'Sec-Fetch-Mode: cors' \
|
||||
-H 'Sec-Fetch-Site: same-origin' \
|
||||
-H 'Sec-GPC: 1' \
|
||||
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36' \
|
||||
--data-raw '{"value":"Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. I am offline. This is my message."}' \
|
||||
--compressed
|
||||
|
||||
Reference in New Issue
Block a user