mirror of
https://github.com/owncast/owncast.git
synced 2024-10-10 19:16:02 +00:00
Update API tests (#3894)
* fix(test): remove done callback in tests * fix(test): expect correct status code * fix(test): remove logging of var
This commit is contained in:
parent
545b9983f7
commit
04b1b30b7d
1
.earthlyignore
Normal file
1
.earthlyignore
Normal file
@ -0,0 +1 @@
|
||||
test/automated/api/node_modules
|
@ -1,10 +1,11 @@
|
||||
var request = require('supertest');
|
||||
request = request('http://127.0.0.1:8080');
|
||||
|
||||
test('service is online', (done) => {
|
||||
request.get('/api/status').expect(200)
|
||||
.then((res) => {
|
||||
expect(res.body.online).toBe(true);
|
||||
done();
|
||||
});
|
||||
test('service is online', () => {
|
||||
request
|
||||
.get('/api/status')
|
||||
.expect(200)
|
||||
.then((res) => {
|
||||
expect(res.body.online).toBe(true);
|
||||
});
|
||||
});
|
||||
|
@ -8,13 +8,11 @@ const publicPath = path.resolve(__dirname, '../../../data/public');
|
||||
const filename = randomString() + '.txt';
|
||||
const fileContent = randomString();
|
||||
|
||||
test('random public static file does not exist', async (done) => {
|
||||
request.get('/public/' + filename).expect(404);
|
||||
|
||||
done();
|
||||
test('random public static file does not exist', async () => {
|
||||
await request.get('/public/' + filename).expect(404);
|
||||
});
|
||||
|
||||
test('public directory is writable', async (done) => {
|
||||
test('public directory is writable', async () => {
|
||||
try {
|
||||
writeFileToPublic();
|
||||
} catch (err) {
|
||||
@ -28,27 +26,23 @@ test('public directory is writable', async (done) => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
test('public static file is accessible', async (done) => {
|
||||
request
|
||||
test('public static file is accessible', async () => {
|
||||
await request
|
||||
.get('/public/' + filename)
|
||||
.expect(200)
|
||||
.then((res) => {
|
||||
expect(res.text).toEqual(fileContent);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('public static file is persistent and not locked', async (done) => {
|
||||
test('public static file is persistent and not locked', async () => {
|
||||
fs.unlink(path.join(publicPath, filename), (err) => {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
done();
|
||||
});
|
||||
|
||||
function writeFileToPublic() {
|
||||
|
@ -15,15 +15,15 @@ const testMessage = {
|
||||
type: 'CHAT',
|
||||
};
|
||||
|
||||
test('send a chat message', async (done) => {
|
||||
test('send a chat message', async () => {
|
||||
const registration = await registerChat();
|
||||
const accessToken = registration.accessToken;
|
||||
userDisplayName = registration.displayName;
|
||||
|
||||
sendChatMessage(testMessage, accessToken, done);
|
||||
sendChatMessage(testMessage, accessToken);
|
||||
});
|
||||
|
||||
test('fetch chat messages by admin', async (done) => {
|
||||
test('fetch chat messages by admin', async () => {
|
||||
const res = await getAdminResponse('chat/messages');
|
||||
const expectedBody = `<p>` + testMessage.body + `</p>`;
|
||||
|
||||
@ -35,26 +35,22 @@ test('fetch chat messages by admin', async (done) => {
|
||||
expect(message.body).toBe(expectedBody);
|
||||
expect(message.user.displayName).toBe(userDisplayName);
|
||||
expect(message.type).toBe(testMessage.type);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
test('derive display name from user header', async (done) => {
|
||||
test('derive display name from user header', async () => {
|
||||
const res = await request
|
||||
.post('/api/chat/register')
|
||||
.set('X-Forwarded-User', 'test-user')
|
||||
.expect(200);
|
||||
|
||||
expect(res.body.displayName).toBe('test-user');
|
||||
done();
|
||||
});
|
||||
|
||||
test('overwrite user header derived display name with body', async (done) => {
|
||||
test('overwrite user header derived display name with body', async () => {
|
||||
const res = await request
|
||||
.post('/api/chat/register')
|
||||
.send({ displayName: 'TestUserChat' })
|
||||
.expect(200);
|
||||
|
||||
expect(res.body.displayName).toBe('TestUserChat');
|
||||
done();
|
||||
});
|
||||
|
@ -21,34 +21,30 @@ const testVisibilityMessage = {
|
||||
|
||||
var userId;
|
||||
var accessToken;
|
||||
test('register a user', async (done) => {
|
||||
test('register a user', async () => {
|
||||
const registration = await registerChat();
|
||||
userId = registration.id;
|
||||
accessToken = registration.accessToken;
|
||||
done();
|
||||
});
|
||||
|
||||
test('send a chat message', async (done) => {
|
||||
sendChatMessage(testVisibilityMessage, accessToken, done);
|
||||
test('send a chat message', async () => {
|
||||
await sendChatMessage(testVisibilityMessage, accessToken);
|
||||
});
|
||||
|
||||
test('set the user as moderator', async (done) => {
|
||||
test('set the user as moderator', async () => {
|
||||
const res = await sendAdminPayload('chat/users/setmoderator', {
|
||||
userId: userId,
|
||||
isModerator: true,
|
||||
});
|
||||
done();
|
||||
});
|
||||
|
||||
test('verify user is a moderator', async (done) => {
|
||||
test('verify user is a moderator', async () => {
|
||||
const response = await getAdminResponse('chat/users/moderators');
|
||||
const tokenCheck = response.body.filter((user) => user.id === userId);
|
||||
expect(tokenCheck).toHaveLength(1);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
test('verify user list is populated', async (done) => {
|
||||
test('verify user list is populated', async () => {
|
||||
const ws = new WebSocket(
|
||||
`ws://localhost:8080/ws?accessToken=${accessToken}`,
|
||||
{
|
||||
@ -74,12 +70,10 @@ test('verify user list is populated', async (done) => {
|
||||
ws.close();
|
||||
});
|
||||
|
||||
ws.on('close', function incoming(data) {
|
||||
done();
|
||||
});
|
||||
ws.on('close', function incoming(data) {});
|
||||
});
|
||||
|
||||
test('disable a user by admin', async (done) => {
|
||||
test('disable a user by admin', async () => {
|
||||
// To allow for visually being able to see the test hiding the
|
||||
// message add a short delay.
|
||||
await new Promise((r) => setTimeout(r, 1500));
|
||||
@ -97,42 +91,36 @@ test('disable a user by admin', async (done) => {
|
||||
});
|
||||
|
||||
await new Promise((r) => setTimeout(r, 1500));
|
||||
done();
|
||||
});
|
||||
|
||||
test('verify user is disabled', async (done) => {
|
||||
test('verify user is disabled', async () => {
|
||||
const response = await getAdminResponse('chat/users/disabled');
|
||||
const tokenCheck = response.body.filter((user) => user.id === userId);
|
||||
expect(tokenCheck).toHaveLength(1);
|
||||
done();
|
||||
});
|
||||
|
||||
test('verify messages from user are hidden', async (done) => {
|
||||
test('verify messages from user are hidden', async () => {
|
||||
const response = await getAdminResponse('chat/messages');
|
||||
const message = response.body.filter((obj) => {
|
||||
return obj.user.id === userId;
|
||||
});
|
||||
expect(message[0].user.disabledAt).toBeTruthy();
|
||||
done();
|
||||
});
|
||||
|
||||
test('re-enable a user by admin', async (done) => {
|
||||
test('re-enable a user by admin', async () => {
|
||||
const res = await sendAdminPayload('chat/users/setenabled', {
|
||||
userId: userId,
|
||||
enabled: true,
|
||||
});
|
||||
done();
|
||||
});
|
||||
|
||||
test('verify user is enabled', async (done) => {
|
||||
test('verify user is enabled', async () => {
|
||||
const response = await getAdminResponse('chat/users/disabled');
|
||||
const tokenCheck = response.body.filter((user) => user.id === userId);
|
||||
expect(tokenCheck).toHaveLength(0);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
test('ban an ip address by admin', async (done) => {
|
||||
test('ban an ip address by admin', async () => {
|
||||
const resIPv4 = await sendAdminRequest(
|
||||
'chat/users/ipbans/create',
|
||||
localIPAddressV4
|
||||
@ -141,23 +129,20 @@ test('ban an ip address by admin', async (done) => {
|
||||
'chat/users/ipbans/create',
|
||||
localIPAddressV6
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
test('verify IP address is blocked from the ban', async (done) => {
|
||||
test('verify IP address is blocked from the ban', async () => {
|
||||
const response = await getAdminResponse('chat/users/ipbans');
|
||||
|
||||
expect(response.body).toHaveLength(2);
|
||||
expect(onlyLocalIPAddress(response.body)).toBe(true);
|
||||
done();
|
||||
});
|
||||
|
||||
test('verify access is denied', async (done) => {
|
||||
test('verify access is denied', async () => {
|
||||
await request.get(`/api/chat?accessToken=${accessToken}`).expect(401);
|
||||
done();
|
||||
});
|
||||
|
||||
test('remove an ip address ban by admin', async (done) => {
|
||||
test('remove an ip address ban by admin', async () => {
|
||||
const resIPv4 = await sendAdminRequest(
|
||||
'chat/users/ipbans/remove',
|
||||
localIPAddressV4
|
||||
@ -166,19 +151,16 @@ test('remove an ip address ban by admin', async (done) => {
|
||||
'chat/users/ipbans/remove',
|
||||
localIPAddressV6
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
test('verify IP address is no longer banned', async (done) => {
|
||||
test('verify IP address is no longer banned', async () => {
|
||||
const response = await getAdminResponse('chat/users/ipbans');
|
||||
|
||||
expect(response.body).toHaveLength(0);
|
||||
done();
|
||||
});
|
||||
|
||||
test('verify access is allowed after unban', async (done) => {
|
||||
test('verify access is allowed after unban', async () => {
|
||||
await request.get(`/api/chat?accessToken=${accessToken}`).expect(200);
|
||||
done();
|
||||
});
|
||||
|
||||
// This function expects the local address to be localIPAddressV4 & localIPAddressV6
|
||||
|
@ -22,14 +22,14 @@ const establishedUserFailedChatMessage = {
|
||||
type: 'CHAT',
|
||||
};
|
||||
|
||||
test('send a chat message', async (done) => {
|
||||
test('send a chat message', async () => {
|
||||
const registration = await registerChat();
|
||||
const accessToken = registration.accessToken;
|
||||
|
||||
sendChatMessage(testVisibilityMessage, accessToken, done);
|
||||
await sendChatMessage(testVisibilityMessage, accessToken);
|
||||
});
|
||||
|
||||
test('verify admin can make API call to mark message as hidden', async (done) => {
|
||||
test('verify admin can make API call to mark message as hidden', async () => {
|
||||
const registration = await registerChat();
|
||||
const accessToken = registration.accessToken;
|
||||
const ws = new WebSocket(
|
||||
@ -47,7 +47,6 @@ test('verify admin can make API call to mark message as hidden', async (done) =>
|
||||
|
||||
if (event.type === 'VISIBILITY-UPDATE') {
|
||||
ws.close();
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -62,7 +61,7 @@ test('verify admin can make API call to mark message as hidden', async (done) =>
|
||||
});
|
||||
});
|
||||
|
||||
test('verify message has become hidden', async (done) => {
|
||||
test('verify message has become hidden', async () => {
|
||||
await new Promise((r) => setTimeout(r, 2000));
|
||||
|
||||
const res = await getAdminResponse('chat/messages');
|
||||
@ -72,22 +71,20 @@ test('verify message has become hidden', async (done) => {
|
||||
});
|
||||
expect(message.length).toBe(1);
|
||||
// expect(message[0].hiddenAt).toBeTruthy();
|
||||
done();
|
||||
});
|
||||
|
||||
test('enable established chat user mode', async (done) => {
|
||||
test('enable established chat user mode', async () => {
|
||||
await sendAdminRequest('config/chat/establishedusermode', true);
|
||||
done();
|
||||
});
|
||||
|
||||
test('send a message after established user mode is enabled', async (done) => {
|
||||
test('send a message after established user mode is enabled', async () => {
|
||||
const registration = await registerChat();
|
||||
const accessToken = registration.accessToken;
|
||||
|
||||
sendChatMessage(establishedUserFailedChatMessage, accessToken, done);
|
||||
await sendChatMessage(establishedUserFailedChatMessage, accessToken);
|
||||
});
|
||||
|
||||
test('verify rejected message is not in the chat feed', async (done) => {
|
||||
test('verify rejected message is not in the chat feed', async () => {
|
||||
const res = await getAdminResponse('chat/messages');
|
||||
|
||||
const message = res.body.filter((obj) => {
|
||||
@ -95,10 +92,8 @@ test('verify rejected message is not in the chat feed', async (done) => {
|
||||
});
|
||||
|
||||
expect(message.length).toBe(0);
|
||||
done();
|
||||
});
|
||||
|
||||
test('disable established chat user mode', async (done) => {
|
||||
test('disable established chat user mode', async () => {
|
||||
await sendAdminRequest('config/chat/establishedusermode', false);
|
||||
done();
|
||||
});
|
||||
|
@ -10,7 +10,7 @@ var webhookID;
|
||||
const webhook = 'https://super.duper.cool.thing.biz/owncast';
|
||||
const events = ['CHAT'];
|
||||
|
||||
test('create webhook', async (done) => {
|
||||
test('create webhook', async () => {
|
||||
const res = await sendAdminPayload('webhooks/create', {
|
||||
url: webhook,
|
||||
events: events,
|
||||
@ -19,7 +19,6 @@ test('create webhook', async (done) => {
|
||||
expect(res.body.url).toBe(webhook);
|
||||
expect(res.body.timestamp).toBeTruthy();
|
||||
expect(res.body.events).toStrictEqual(events);
|
||||
done();
|
||||
});
|
||||
|
||||
test('check webhooks', (done) => {
|
||||
@ -32,12 +31,11 @@ test('check webhooks', (done) => {
|
||||
});
|
||||
});
|
||||
|
||||
test('delete webhook', async (done) => {
|
||||
test('delete webhook', async () => {
|
||||
const res = await sendAdminPayload('webhooks/delete', {
|
||||
id: webhookID,
|
||||
});
|
||||
expect(res.body.success).toBe(true);
|
||||
done();
|
||||
});
|
||||
|
||||
test('check that webhook was deleted', (done) => {
|
||||
@ -47,7 +45,7 @@ test('check that webhook was deleted', (done) => {
|
||||
});
|
||||
});
|
||||
|
||||
test('create access token', async (done) => {
|
||||
test('create access token', async () => {
|
||||
const name = 'Automated integration test';
|
||||
const scopes = [
|
||||
'CAN_SEND_SYSTEM_MESSAGES',
|
||||
@ -64,44 +62,39 @@ test('create access token', async (done) => {
|
||||
expect(res.body.displayName).toBe(name);
|
||||
expect(res.body.scopes).toStrictEqual(scopes);
|
||||
accessToken = res.body.accessToken;
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
test('check access tokens', async (done) => {
|
||||
test('check access tokens', async () => {
|
||||
const res = await getAdminResponse('accesstokens');
|
||||
const tokenCheck = res.body.filter(
|
||||
(token) => token.accessToken === accessToken
|
||||
);
|
||||
expect(tokenCheck).toHaveLength(1);
|
||||
done();
|
||||
});
|
||||
|
||||
test('send a system message using access token', async (done) => {
|
||||
test('send a system message using access token', async () => {
|
||||
const payload = {
|
||||
body: 'This is a test system message from the automated integration test',
|
||||
};
|
||||
const res = await request
|
||||
await request
|
||||
.post('/api/integrations/chat/system')
|
||||
.set('Authorization', 'bearer ' + accessToken)
|
||||
.send(payload)
|
||||
.expect(200);
|
||||
done();
|
||||
});
|
||||
|
||||
test('send an external integration message using access token', async (done) => {
|
||||
test('send an external integration message using access token', async () => {
|
||||
const payload = {
|
||||
body: 'This is a test external message from the automated integration test',
|
||||
};
|
||||
const res = await request
|
||||
await request
|
||||
.post('/api/integrations/chat/send')
|
||||
.set('Authorization', 'Bearer ' + accessToken)
|
||||
.send(payload)
|
||||
.expect(200);
|
||||
done();
|
||||
});
|
||||
|
||||
test('send an external integration action using access token', async (done) => {
|
||||
test('send an external integration action using access token', async () => {
|
||||
const payload = {
|
||||
body: 'This is a test external action from the automated integration test',
|
||||
};
|
||||
@ -110,51 +103,45 @@ test('send an external integration action using access token', async (done) => {
|
||||
.set('Authorization', 'Bearer ' + accessToken)
|
||||
.send(payload)
|
||||
.expect(200);
|
||||
done();
|
||||
});
|
||||
|
||||
test('test fetch chat history using access token', async (done) => {
|
||||
const res = await request
|
||||
test('test fetch chat history using access token', async () => {
|
||||
await request
|
||||
.get('/api/integrations/chat')
|
||||
.set('Authorization', 'Bearer ' + accessToken)
|
||||
.expect(200);
|
||||
done();
|
||||
});
|
||||
|
||||
test('test fetch chat history failure using invalid access token', async (done) => {
|
||||
const res = await request
|
||||
test('test fetch chat history failure using invalid access token', async () => {
|
||||
await request
|
||||
.get('/api/integrations/chat')
|
||||
.set('Authorization', 'Bearer ' + 'invalidToken')
|
||||
.expect(401);
|
||||
done();
|
||||
});
|
||||
|
||||
test('test fetch chat history OPTIONS request', async (done) => {
|
||||
test('test fetch chat history OPTIONS request', async () => {
|
||||
const res = await request
|
||||
.options('/api/integrations/chat')
|
||||
.set('Authorization', 'Bearer ' + accessToken)
|
||||
.expect(204);
|
||||
done();
|
||||
});
|
||||
|
||||
test('delete access token', async (done) => {
|
||||
test('delete access token', async () => {
|
||||
const res = await sendAdminPayload('accesstokens/delete', {
|
||||
token: accessToken,
|
||||
});
|
||||
expect(res.body.success).toBe(true);
|
||||
done();
|
||||
});
|
||||
|
||||
test('check token delete was successful', async (done) => {
|
||||
test('check token delete was successful', async () => {
|
||||
const res = await getAdminResponse('accesstokens');
|
||||
const tokenCheck = res.body.filter(
|
||||
(token) => token.accessToken === accessToken
|
||||
);
|
||||
expect(tokenCheck).toHaveLength(0);
|
||||
done();
|
||||
});
|
||||
|
||||
test('send an external integration action using access token expecting failure', async (done) => {
|
||||
test('send an external integration action using access token expecting failure', async () => {
|
||||
const payload = {
|
||||
body: 'This is a test external action from the automated integration test',
|
||||
};
|
||||
@ -163,5 +150,4 @@ test('send an external integration action using access token expecting failure',
|
||||
.set('Authorization', 'Bearer ' + accessToken)
|
||||
.send(payload)
|
||||
.expect(401);
|
||||
done();
|
||||
});
|
||||
|
@ -13,62 +13,49 @@ const serverName = 'owncast.server.test';
|
||||
const serverURL = 'http://' + serverName;
|
||||
const fediUsername = 'streamer';
|
||||
|
||||
test('disable federation', async (done) => {
|
||||
const res = await sendAdminRequest('config/federation/enable', false);
|
||||
done();
|
||||
test('disable federation', async () => {
|
||||
await sendAdminRequest('config/federation/enable', false);
|
||||
});
|
||||
|
||||
test('verify responses of /.well-known/webfinger when federation is disabled', async (done) => {
|
||||
const res = request.get('/.well-known/webfinger').expect(405);
|
||||
done();
|
||||
test('verify responses of /.well-known/webfinger when federation is disabled', async () => {
|
||||
await request.get('/.well-known/webfinger').expect(405);
|
||||
});
|
||||
|
||||
test('verify responses of /.well-known/host-meta when federation is disabled', async (done) => {
|
||||
const res = request.get('/.well-known/host-meta').expect(405);
|
||||
done();
|
||||
test('verify responses of /.well-known/host-meta when federation is disabled', async () => {
|
||||
await request.get('/.well-known/host-meta').expect(405);
|
||||
});
|
||||
|
||||
test('verify responses of /.well-known/nodeinfo when federation is disabled', async (done) => {
|
||||
const res = request.get('/.well-known/nodeinfo').expect(405);
|
||||
done();
|
||||
test('verify responses of /.well-known/nodeinfo when federation is disabled', async () => {
|
||||
await request.get('/.well-known/nodeinfo').expect(405);
|
||||
});
|
||||
|
||||
test('verify responses of /.well-known/x-nodeinfo2 when federation is disabled', async (done) => {
|
||||
const res = request.get('/.well-known/x-nodeinfo2').expect(405);
|
||||
done();
|
||||
test('verify responses of /.well-known/x-nodeinfo2 when federation is disabled', async () => {
|
||||
await request.get('/.well-known/x-nodeinfo2').expect(405);
|
||||
});
|
||||
|
||||
test('verify responses of /nodeinfo/2.0 when federation is disabled', async (done) => {
|
||||
const res = request.get('/nodeinfo/2.0').expect(405);
|
||||
done();
|
||||
test('verify responses of /nodeinfo/2.0 when federation is disabled', async () => {
|
||||
await request.get('/nodeinfo/2.0').expect(405);
|
||||
});
|
||||
|
||||
test('verify responses of /api/v1/instance when federation is disabled', async (done) => {
|
||||
const res = request.get('/api/v1/instance').expect(405);
|
||||
done();
|
||||
test('verify responses of /api/v1/instance when federation is disabled', async () => {
|
||||
await request.get('/api/v1/instance').expect(405);
|
||||
});
|
||||
|
||||
test('verify responses of /federation/user/ when federation is disabled', async (done) => {
|
||||
const res = request.get('/federation/user/').expect(405);
|
||||
done();
|
||||
test('verify responses of /federation/user/ when federation is disabled', async () => {
|
||||
await request.get('/federation/user/').expect(405);
|
||||
});
|
||||
|
||||
test('verify responses of /federation/ when federation is disabled', async (done) => {
|
||||
const res = request.get('/federation/').expect(405);
|
||||
done();
|
||||
test('verify responses of /federation/ when federation is disabled', async () => {
|
||||
await request.get('/federation/').expect(405);
|
||||
});
|
||||
|
||||
test('set required parameters and enable federation', async (done) => {
|
||||
const res1 = await sendAdminRequest('config/serverurl', serverURL);
|
||||
const res2 = await sendAdminRequest(
|
||||
'config/federation/username',
|
||||
fediUsername
|
||||
);
|
||||
const res3 = await sendAdminRequest('config/federation/enable', true);
|
||||
done();
|
||||
test('set required parameters and enable federation', async () => {
|
||||
await sendAdminRequest('config/serverurl', serverURL);
|
||||
await sendAdminRequest('config/federation/username', fediUsername);
|
||||
await sendAdminRequest('config/federation/enable', true);
|
||||
});
|
||||
|
||||
test('verify responses of /.well-known/webfinger when federation is enabled', async (done) => {
|
||||
test('verify responses of /.well-known/webfinger when federation is enabled', async () => {
|
||||
const resNoResource = request.get('/.well-known/webfinger').expect(400);
|
||||
const resBadResource = request
|
||||
.get('/.well-known/webfinger?resource=' + fediUsername + '@' + serverName)
|
||||
@ -115,64 +102,58 @@ test('verify responses of /.well-known/webfinger when federation is enabled', as
|
||||
.expect('Content-Type', /json/)
|
||||
.then((res) => {
|
||||
parseJson(res.text);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('verify responses of /.well-known/host-meta when federation is enabled', async (done) => {
|
||||
const res = request
|
||||
test('verify responses of /.well-known/host-meta when federation is enabled', async () => {
|
||||
request
|
||||
.get('/.well-known/host-meta')
|
||||
.expect(200)
|
||||
.expect('Content-Type', /xml/);
|
||||
done();
|
||||
});
|
||||
|
||||
test('verify responses of /.well-known/nodeinfo when federation is enabled', async (done) => {
|
||||
const res = request
|
||||
test('verify responses of /.well-known/nodeinfo when federation is enabled', async () => {
|
||||
await request
|
||||
.get('/.well-known/nodeinfo')
|
||||
.expect(200)
|
||||
.expect('Content-Type', /json/)
|
||||
.then((res) => {
|
||||
parseJson(res.text);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('verify responses of /.well-known/x-nodeinfo2 when federation is enabled', async (done) => {
|
||||
const res = request
|
||||
test('verify responses of /.well-known/x-nodeinfo2 when federation is enabled', async () => {
|
||||
await request
|
||||
.get('/.well-known/x-nodeinfo2')
|
||||
.expect(200)
|
||||
.expect('Content-Type', /json/)
|
||||
.then((res) => {
|
||||
parseJson(res.text);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('verify responses of /nodeinfo/2.0 when federation is enabled', async (done) => {
|
||||
const res = request
|
||||
test('verify responses of /nodeinfo/2.0 when federation is enabled', async () => {
|
||||
await request
|
||||
.get('/nodeinfo/2.0')
|
||||
.expect(200)
|
||||
.expect('Content-Type', /json/)
|
||||
.then((res) => {
|
||||
parseJson(res.text);
|
||||
expect(ajv.validate(nodeInfoSchema, res.body)).toBe(true);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('verify responses of /api/v1/instance when federation is enabled', async (done) => {
|
||||
const res = request
|
||||
test('verify responses of /api/v1/instance when federation is enabled', async () => {
|
||||
await request
|
||||
.get('/api/v1/instance')
|
||||
.expect(200)
|
||||
.expect('Content-Type', /json/)
|
||||
.then((res) => {
|
||||
parseJson(res.text);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('verify responses of /federation/user/ when federation is enabled', async (done) => {
|
||||
test('verify responses of /federation/user/ when federation is enabled', async () => {
|
||||
const resNoAccept = request.get('/federation/user/').expect(307);
|
||||
const resWithAccept = request
|
||||
.get('/federation/user/')
|
||||
@ -189,15 +170,13 @@ test('verify responses of /federation/user/ when federation is enabled', async (
|
||||
.expect('Content-Type', /json/)
|
||||
.then((res) => {
|
||||
parseJson(res.text);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('verify responses of /federation/ when federation is enabled', async (done) => {
|
||||
test('verify responses of /federation/ when federation is enabled', async () => {
|
||||
const resNoAccept = request.get('/federation/').expect(307);
|
||||
const resWithAccept = request
|
||||
.get('/federation/')
|
||||
.set('Accept', 'application/json')
|
||||
.expect(404);
|
||||
done();
|
||||
});
|
||||
|
@ -139,7 +139,7 @@ const overriddenWebsocketHost = 'ws://lolcalhost.biz';
|
||||
const customCSS = randomString();
|
||||
const customJavascript = randomString();
|
||||
|
||||
test('verify default config values', async (done) => {
|
||||
test('verify default config values', async () => {
|
||||
const res = await request.get('/api/config');
|
||||
expect(res.body.name).toBe(defaultServerName);
|
||||
expect(res.body.streamTitle).toBe(defaultStreamTitle);
|
||||
@ -148,10 +148,9 @@ test('verify default config values', async (done) => {
|
||||
expect(res.body.offlineMessage).toBe(defaultOfflineMessage);
|
||||
expect(res.body.logo).toBe(defaultLogo);
|
||||
expect(res.body.socialHandles).toStrictEqual(defaultSocialHandles);
|
||||
done();
|
||||
});
|
||||
|
||||
test('verify default admin configuration', async (done) => {
|
||||
test('verify default admin configuration', async () => {
|
||||
const res = await getAdminResponse('serverconfig');
|
||||
|
||||
expect(res.body.instanceDetails.name).toBe(defaultServerName);
|
||||
@ -167,9 +166,13 @@ test('verify default admin configuration', async (done) => {
|
||||
expect(res.body.yp.enabled).toBe(defaultYPConfig.enabled);
|
||||
// expect(res.body.yp.instanceUrl).toBe(defaultYPConfig.instanceUrl);
|
||||
|
||||
bcrypt.compare(defaultAdminPassword, res.body.adminPassword, function (err, result) {
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
bcrypt.compare(
|
||||
defaultAdminPassword,
|
||||
res.body.adminPassword,
|
||||
function (err, result) {
|
||||
expect(result).toBe(true);
|
||||
}
|
||||
);
|
||||
|
||||
expect(res.body.s3.enabled).toBe(defaultS3Config.enabled);
|
||||
expect(res.body.s3.forcePathStyle).toBe(defaultS3Config.forcePathStyle);
|
||||
@ -187,217 +190,177 @@ test('verify default admin configuration', async (done) => {
|
||||
expect(res.body.federation.blockedDomains).toStrictEqual(
|
||||
defaultFederationConfig.blockedDomains
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
test('verify stream key validation', async (done) => {
|
||||
test('verify stream key validation', async () => {
|
||||
const badPayload = { id: 'zz', comment: 'ouch' };
|
||||
const url = '/api/admin/config/streamkeys';
|
||||
const res = await request
|
||||
await request
|
||||
.post(url)
|
||||
.auth('admin', defaultAdminPassword)
|
||||
.send(badPayload)
|
||||
.expect(400);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
test('set server name', async (done) => {
|
||||
const res = await sendAdminRequest('config/name', newServerName);
|
||||
done();
|
||||
test('set server name', async () => {
|
||||
await sendAdminRequest('config/name', newServerName);
|
||||
});
|
||||
|
||||
test('set stream title', async (done) => {
|
||||
const res = await sendAdminRequest('config/streamtitle', newStreamTitle);
|
||||
done();
|
||||
test('set stream title', async () => {
|
||||
await sendAdminRequest('config/streamtitle', newStreamTitle);
|
||||
});
|
||||
|
||||
test('set server summary', async (done) => {
|
||||
const res = await sendAdminRequest('config/serversummary', newServerSummary);
|
||||
done();
|
||||
test('set server summary', async () => {
|
||||
await sendAdminRequest('config/serversummary', newServerSummary);
|
||||
});
|
||||
|
||||
test('set extra page content', async (done) => {
|
||||
const res = await sendAdminRequest('config/pagecontent', newPageContent);
|
||||
done();
|
||||
test('set extra page content', async () => {
|
||||
await sendAdminRequest('config/pagecontent', newPageContent);
|
||||
});
|
||||
|
||||
test('set tags', async (done) => {
|
||||
const res = await sendAdminRequest('config/tags', newTags);
|
||||
done();
|
||||
test('set tags', async () => {
|
||||
await sendAdminRequest('config/tags', newTags);
|
||||
});
|
||||
|
||||
test('set stream keys', async (done) => {
|
||||
const res = await sendAdminRequest('config/streamkeys', newStreamKeys);
|
||||
done();
|
||||
test('set stream keys', async () => {
|
||||
await sendAdminRequest('config/streamkeys', newStreamKeys);
|
||||
});
|
||||
|
||||
test('set latency level', async (done) => {
|
||||
const res = await sendAdminRequest(
|
||||
'config/video/streamlatencylevel',
|
||||
latencyLevel
|
||||
);
|
||||
done();
|
||||
test('set latency level', async () => {
|
||||
await sendAdminRequest('config/video/streamlatencylevel', latencyLevel);
|
||||
});
|
||||
|
||||
test('set video stream output variants', async (done) => {
|
||||
const res = await sendAdminRequest('config/video/streamoutputvariants', [
|
||||
test('set video stream output variants', async () => {
|
||||
await sendAdminRequest('config/video/streamoutputvariants', [
|
||||
streamOutputVariants,
|
||||
]);
|
||||
done();
|
||||
});
|
||||
|
||||
test('set social handles', async (done) => {
|
||||
const res = await sendAdminRequest('config/socialhandles', newSocialHandles);
|
||||
done();
|
||||
test('set social handles', async () => {
|
||||
await sendAdminRequest('config/socialhandles', newSocialHandles);
|
||||
});
|
||||
|
||||
test('set s3 configuration', async (done) => {
|
||||
const res = await sendAdminRequest('config/s3', newS3Config);
|
||||
done();
|
||||
test('set s3 configuration', async () => {
|
||||
await sendAdminRequest('config/s3', newS3Config);
|
||||
});
|
||||
|
||||
test('set forbidden usernames', async (done) => {
|
||||
const res = await sendAdminRequest(
|
||||
test('set forbidden usernames', async () => {
|
||||
await sendAdminRequest(
|
||||
'config/chat/forbiddenusernames',
|
||||
newForbiddenUsernames
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
test('set server url', async (done) => {
|
||||
const resBadURL = await failAdminRequest('config/serverurl', 'not.valid.url');
|
||||
const res = await sendAdminRequest(
|
||||
'config/serverurl',
|
||||
newYPConfig.instanceUrl
|
||||
);
|
||||
done();
|
||||
test('set server url', async () => {
|
||||
await failAdminRequest('config/serverurl', 'not.valid.url');
|
||||
await sendAdminRequest('config/serverurl', newYPConfig.instanceUrl);
|
||||
});
|
||||
|
||||
test('set federation username', async (done) => {
|
||||
const res = await sendAdminRequest(
|
||||
test('set federation username', async () => {
|
||||
await sendAdminRequest(
|
||||
'config/federation/username',
|
||||
newFederationConfig.username
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
test('set federation goLiveMessage', async (done) => {
|
||||
const res = await sendAdminRequest(
|
||||
test('set federation goLiveMessage', async () => {
|
||||
await sendAdminRequest(
|
||||
'config/federation/livemessage',
|
||||
newFederationConfig.goLiveMessage
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
test('toggle private federation mode', async (done) => {
|
||||
const res = await sendAdminRequest(
|
||||
test('toggle private federation mode', async () => {
|
||||
await sendAdminRequest(
|
||||
'config/federation/private',
|
||||
newFederationConfig.isPrivate
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
test('toggle federation engagement', async (done) => {
|
||||
test('toggle federation engagement', async () => {
|
||||
const res = await sendAdminRequest(
|
||||
'config/federation/showengagement',
|
||||
newFederationConfig.showEngagement
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
test('set federation blocked domains', async (done) => {
|
||||
const res = await sendAdminRequest(
|
||||
test('set federation blocked domains', async () => {
|
||||
await sendAdminRequest(
|
||||
'config/federation/blockdomains',
|
||||
newFederationConfig.blockedDomains
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
test('set offline message', async (done) => {
|
||||
const res = await sendAdminRequest(
|
||||
'config/offlinemessage',
|
||||
newOfflineMessage
|
||||
);
|
||||
done();
|
||||
test('set offline message', async () => {
|
||||
await sendAdminRequest('config/offlinemessage', newOfflineMessage);
|
||||
});
|
||||
|
||||
test('set hide viewer count', async (done) => {
|
||||
const res = await sendAdminRequest(
|
||||
'config/hideviewercount',
|
||||
newHideViewerCount
|
||||
);
|
||||
done();
|
||||
test('set hide viewer count', async () => {
|
||||
await sendAdminRequest('config/hideviewercount', newHideViewerCount);
|
||||
});
|
||||
|
||||
test('set custom style values', async (done) => {
|
||||
const res = await sendAdminRequest('config/appearance', appearanceValues);
|
||||
done();
|
||||
test('set custom style values', async () => {
|
||||
await sendAdminRequest('config/appearance', appearanceValues);
|
||||
});
|
||||
|
||||
test('set custom css', async (done) => {
|
||||
test('set custom css', async () => {
|
||||
await sendAdminRequest('config/customstyles', customCSS);
|
||||
done();
|
||||
});
|
||||
|
||||
test('set custom javascript', async (done) => {
|
||||
test('set custom javascript', async () => {
|
||||
await sendAdminRequest('config/customjavascript', customJavascript);
|
||||
done();
|
||||
});
|
||||
|
||||
test('enable directory', async (done) => {
|
||||
const res = await sendAdminRequest('config/directoryenabled', true);
|
||||
done();
|
||||
test('enable directory', async () => {
|
||||
await sendAdminRequest('config/directoryenabled', true);
|
||||
});
|
||||
|
||||
test('enable federation', async (done) => {
|
||||
const res = await sendAdminRequest(
|
||||
test('enable federation', async () => {
|
||||
await sendAdminRequest(
|
||||
'config/federation/enable',
|
||||
newFederationConfig.enabled
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
test('disable search indexing', async (done) => {
|
||||
test('disable search indexing', async () => {
|
||||
await sendAdminRequest(
|
||||
'config/disablesearchindexing',
|
||||
newDisableSearchIndexing
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
test('change admin password', async (done) => {
|
||||
const res = await sendAdminRequest('config/adminpass', newAdminPassword);
|
||||
done();
|
||||
test('change admin password', async () => {
|
||||
await sendAdminRequest('config/adminpass', newAdminPassword);
|
||||
});
|
||||
|
||||
test('verify admin password change', async (done) => {
|
||||
test('verify admin password change', async () => {
|
||||
const res = await getAdminResponse(
|
||||
'serverconfig',
|
||||
(adminPassword = newAdminPassword)
|
||||
);
|
||||
|
||||
bcrypt.compare(newAdminPassword, res.body.adminPassword, function(err, result) {
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
done();
|
||||
bcrypt.compare(
|
||||
newAdminPassword,
|
||||
res.body.adminPassword,
|
||||
function (err, result) {
|
||||
expect(result).toBe(true);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
test('reset admin password', async (done) => {
|
||||
const res = await sendAdminRequest(
|
||||
test('reset admin password', async () => {
|
||||
await sendAdminRequest(
|
||||
'config/adminpass',
|
||||
defaultAdminPassword,
|
||||
(adminPassword = newAdminPassword)
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
test('set override websocket host', async (done) => {
|
||||
test('set override websocket host', async () => {
|
||||
await sendAdminRequest('config/sockethostoverride', overriddenWebsocketHost);
|
||||
done();
|
||||
});
|
||||
|
||||
test('verify updated config values', async (done) => {
|
||||
test('verify updated config values', async () => {
|
||||
const res = await request.get('/api/config');
|
||||
|
||||
expect(res.body.name).toBe(newServerName);
|
||||
@ -409,11 +372,10 @@ test('verify updated config values', async (done) => {
|
||||
expect(res.body.socialHandles).toStrictEqual(newSocialHandles);
|
||||
expect(res.body.socketHostOverride).toBe(overriddenWebsocketHost);
|
||||
expect(res.body.customStyles).toBe(customCSS);
|
||||
done();
|
||||
});
|
||||
|
||||
// Test that the raw video details being broadcasted are coming through
|
||||
test('verify admin stream details', async (done) => {
|
||||
test('verify admin stream details', async () => {
|
||||
const res = await getAdminResponse('status');
|
||||
|
||||
expect(res.body.broadcaster.streamDetails.width).toBe(1280);
|
||||
@ -422,10 +384,9 @@ test('verify admin stream details', async (done) => {
|
||||
expect(res.body.broadcaster.streamDetails.videoCodec).toBe('H.264');
|
||||
expect(res.body.broadcaster.streamDetails.audioCodec).toBe('AAC');
|
||||
expect(res.body.online).toBe(true);
|
||||
done();
|
||||
});
|
||||
|
||||
test('verify updated admin configuration', async (done) => {
|
||||
test('verify updated admin configuration', async () => {
|
||||
const res = await getAdminResponse('serverconfig');
|
||||
|
||||
expect(res.body.instanceDetails.name).toBe(newServerName);
|
||||
@ -453,9 +414,13 @@ test('verify updated admin configuration', async (done) => {
|
||||
expect(res.body.yp.enabled).toBe(newYPConfig.enabled);
|
||||
// expect(res.body.yp.instanceUrl).toBe(newYPConfig.instanceUrl);
|
||||
|
||||
bcrypt.compare(defaultAdminPassword, res.body.adminPassword, function(err, result) {
|
||||
expect(result).toBe(true);
|
||||
})
|
||||
bcrypt.compare(
|
||||
defaultAdminPassword,
|
||||
res.body.adminPassword,
|
||||
function (err, result) {
|
||||
expect(result).toBe(true);
|
||||
}
|
||||
);
|
||||
|
||||
expect(res.body.s3.enabled).toBe(newS3Config.enabled);
|
||||
expect(res.body.s3.endpoint).toBe(newS3Config.endpoint);
|
||||
@ -478,28 +443,25 @@ test('verify updated admin configuration', async (done) => {
|
||||
expect(res.body.federation.blockedDomains).toStrictEqual(
|
||||
newFederationConfig.blockedDomains
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
test('verify updated frontend configuration', (done) => {
|
||||
request
|
||||
test('verify updated frontend configuration', async () => {
|
||||
await request
|
||||
.get('/api/config')
|
||||
.expect(200)
|
||||
.then((res) => {
|
||||
expect(res.body.name).toBe(newServerName);
|
||||
expect(res.body.logo).toBe('/logo');
|
||||
expect(res.body.socialHandles).toStrictEqual(newSocialHandles);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('verify frontend status', (done) => {
|
||||
request
|
||||
test('verify frontend status', async () => {
|
||||
await request
|
||||
.get('/api/status')
|
||||
.expect(200)
|
||||
.then((res) => {
|
||||
expect(res.body.viewerCount).toBe(undefined);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -1,19 +1,16 @@
|
||||
var request = require('supertest');
|
||||
request = request('http://127.0.0.1:8080');
|
||||
|
||||
test('main page requires no auth', async (done) => {
|
||||
test('main page requires no auth', async () => {
|
||||
await request.get('/').expect(200);
|
||||
done();
|
||||
});
|
||||
|
||||
test('admin without trailing slash redirects', async (done) => {
|
||||
test('admin without trailing slash redirects', async () => {
|
||||
await request.get('/admin').expect(301);
|
||||
done();
|
||||
});
|
||||
|
||||
test('admin with trailing slash requires auth', async (done) => {
|
||||
test('admin with trailing slash requires auth', async () => {
|
||||
await request.get('/admin/').expect(401);
|
||||
done();
|
||||
});
|
||||
|
||||
const paths = [
|
||||
@ -41,18 +38,16 @@ const paths = [
|
||||
// Test a bunch of paths to make sure random different pages don't slip by for some reason.
|
||||
// Technically this shouldn't be possible but it's a sanity check anyway.
|
||||
paths.forEach((path) => {
|
||||
test(`admin path ${path} requires auth and should fail`, async (done) => {
|
||||
test(`admin path ${path} requires auth and should fail`, async () => {
|
||||
await request.get(path).expect(401);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
// Try them again with auth. Some with trailing slashes some without.
|
||||
// Allow redirects.
|
||||
paths.forEach((path) => {
|
||||
test(`admin path ${path} requires auth and should pass`, async (done) => {
|
||||
test(`admin path ${path} requires auth and should pass`, async () => {
|
||||
const r = await request.get(path).auth('admin', 'abc123');
|
||||
expect([200, 301]).toContain(r.status);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
@ -3,41 +3,41 @@ request = request('http://127.0.0.1:8080');
|
||||
const WebSocket = require('ws');
|
||||
|
||||
async function registerChat() {
|
||||
try {
|
||||
const response = await request.post('/api/chat/register');
|
||||
return response.body;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
try {
|
||||
const response = await request.post('/api/chat/register');
|
||||
return response.body;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
async function sendChatMessage(message, accessToken, done) {
|
||||
const ws = new WebSocket(`ws://localhost:8080/ws?accessToken=${accessToken}`);
|
||||
const ws = new WebSocket(`ws://localhost:8080/ws?accessToken=${accessToken}`);
|
||||
|
||||
async function onOpen() {
|
||||
ws.send(JSON.stringify(message), async function () {
|
||||
ws.close();
|
||||
done();
|
||||
});
|
||||
}
|
||||
async function onOpen() {
|
||||
ws.send(JSON.stringify(message), async function () {
|
||||
ws.close();
|
||||
// done();
|
||||
});
|
||||
}
|
||||
|
||||
ws.on('open', onOpen);
|
||||
ws.on('open', onOpen);
|
||||
}
|
||||
|
||||
async function listenForEvent(name, accessToken, done) {
|
||||
const ws = new WebSocket(`ws://localhost:8080/ws?accessToken=${accessToken}`);
|
||||
const ws = new WebSocket(`ws://localhost:8080/ws?accessToken=${accessToken}`);
|
||||
|
||||
ws.on('message', function incoming(message) {
|
||||
const messages = message.split('\n');
|
||||
messages.forEach(function (message) {
|
||||
const event = JSON.parse(message);
|
||||
ws.on('message', function incoming(message) {
|
||||
const messages = message.split('\n');
|
||||
messages.forEach(function (message) {
|
||||
const event = JSON.parse(message);
|
||||
|
||||
if (event.type === name) {
|
||||
done();
|
||||
ws.close();
|
||||
}
|
||||
});
|
||||
});
|
||||
if (event.type === name) {
|
||||
done();
|
||||
ws.close();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
module.exports.sendChatMessage = sendChatMessage;
|
||||
|
@ -4,7 +4,7 @@
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "jest --runInBand *.test.js"
|
||||
"test": "jest *.test.js"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
@ -23,8 +23,8 @@
|
||||
"ws": "^7.5.9"
|
||||
},
|
||||
"jest": {
|
||||
"verbose": true,
|
||||
"verbose": false,
|
||||
"maxWorkers": 1,
|
||||
"testRunner": "jest-jasmine2"
|
||||
}
|
||||
}
|
||||
}
|
@ -13,5 +13,7 @@ start_owncast
|
||||
|
||||
start_stream
|
||||
|
||||
sleep 10
|
||||
|
||||
# Run the tests against the instance.
|
||||
npm test
|
||||
|
@ -5,7 +5,7 @@ set -e
|
||||
source ../tools.sh
|
||||
|
||||
# Install the node test framework
|
||||
npm install --silent >/dev/null
|
||||
npm install --quiet --no-progress
|
||||
|
||||
install_ffmpeg
|
||||
|
||||
|
@ -5,14 +5,17 @@ set -e
|
||||
function install_ffmpeg() {
|
||||
# install a specific version of ffmpeg
|
||||
|
||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
if [[ "$OSTYPE" == "linux-"* ]]; then
|
||||
OS="linux"
|
||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
OS="macos"
|
||||
else
|
||||
echo "Exiting!!!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
OS="linux"
|
||||
|
||||
FFMPEG_VER="5.1"
|
||||
FFMPEG_PATH="$(pwd)/ffmpeg-$FFMPEG_VER"
|
||||
PATH=$FFMPEG_PATH:$PATH
|
||||
@ -48,7 +51,7 @@ function start_owncast() {
|
||||
# Build and run owncast from source
|
||||
echo "Building owncast..."
|
||||
pushd "$(git rev-parse --show-toplevel)" >/dev/null
|
||||
go build -o owncast main.go
|
||||
CGO_ENABLED=1 go build -o owncast main.go
|
||||
|
||||
echo "Running owncast..."
|
||||
./owncast -database "$TEMP_DB" &
|
||||
|
Loading…
x
Reference in New Issue
Block a user