mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-23 00:46:16 -04:00
pad_utils: Factor out author token generation
This commit is contained in:
parent
4e1674ceaf
commit
8053875d45
4 changed files with 10 additions and 3 deletions
|
@ -5,6 +5,7 @@ const apiHandler = require('../../node/handler/APIHandler');
|
|||
const assert = require('assert').strict;
|
||||
const io = require('socket.io-client');
|
||||
const log4js = require('log4js');
|
||||
const {padutils} = require('../../static/js/pad_utils');
|
||||
const process = require('process');
|
||||
const server = require('../../node/server');
|
||||
const setCookieParser = require('set-cookie-parser');
|
||||
|
@ -172,7 +173,7 @@ exports.connect = async (res = null) => {
|
|||
* @param {string} padId - Which pad to join.
|
||||
* @returns The CLIENT_VARS message from the server.
|
||||
*/
|
||||
exports.handshake = async (socket, padId, token = 't.12345') => {
|
||||
exports.handshake = async (socket, padId, token = padutils.generateAuthorToken()) => {
|
||||
logger.debug('sending CLIENT_READY...');
|
||||
socket.send({
|
||||
component: 'pad',
|
||||
|
|
|
@ -37,7 +37,7 @@ describe(__filename, function () {
|
|||
roPadId = await readOnlyManager.getReadOnlyId(padId);
|
||||
res = await agent.get(`/p/${roPadId}`).expect(200);
|
||||
roSocket = await common.connect(res);
|
||||
await common.handshake(roSocket, roPadId, `t.${common.randomString(8)}`);
|
||||
await common.handshake(roSocket, roPadId);
|
||||
});
|
||||
|
||||
afterEach(async function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue