Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server Side Events + Edit / delete activities tests study groups + limesurvey owners #35

Open
wants to merge 115 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
52452db
adding WebSocketManager
jujusb Oct 10, 2024
54ba290
adding webSocket dependency
jujusb Oct 10, 2024
4709ad7
fix import
jujusb Oct 10, 2024
b011336
fix typo
jujusb Oct 10, 2024
e68852a
adding server side event client manager
jujusb Oct 10, 2024
0f88db3
adding more events to track
jujusb Oct 11, 2024
100efb4
adding trigger custom events
jujusb Oct 11, 2024
f589b1e
remove unnecesary require
jujusb Oct 11, 2024
f4e8c5d
fix on message to call depending on data.type received
jujusb Oct 11, 2024
ba03d11
using events in study
jujusb Oct 11, 2024
06c4ebb
fix
jujusb Oct 11, 2024
0c5539b
fix frontend jwt
jujusb Oct 11, 2024
6b0c53c
adding new endpoint
jujusb Oct 14, 2024
964fe40
adding update game activity
jujusb Oct 14, 2024
1c1ba71
fix
jujusb Oct 14, 2024
560317e
fix in gameplay painter
jujusb Oct 14, 2024
6e75134
fix username
jujusb Oct 14, 2024
dbc29a7
fix percent
jujusb Oct 14, 2024
c5e7825
fix
jujusb Oct 14, 2024
26580ad
fix
jujusb Oct 14, 2024
dceca90
fix game play
jujusb Oct 14, 2024
5fe69b6
fix
jujusb Oct 14, 2024
592cf03
fix
jujusb Oct 14, 2024
28b5584
fix
jujusb Oct 14, 2024
300ef7c
fix
jujusb Oct 14, 2024
373ff4d
fix refresh for scheduler + gameplay painter
jujusb Oct 14, 2024
5fc2b98
fix
jujusb Oct 14, 2024
26780d6
adding construct map parameters for signature for signed url
jujusb Oct 14, 2024
d493705
adding manual and fixing gameplay activity
jujusb Oct 15, 2024
9e11bbd
adding limesurvey painter update activity
jujusb Oct 15, 2024
fbfd622
update limesurvey events
jujusb Oct 15, 2024
316f510
fix limesurvey activity painter
jujusb Oct 16, 2024
06a537c
adding edit activity button (not enabled for the moment)
jujusb Oct 16, 2024
6e4b1f2
edit test
jujusb Oct 16, 2024
995da7c
adding token signature encoder
jujusb Oct 16, 2024
c6ae097
fix import generation of signature hmac in sse
jujusb Oct 16, 2024
ca411a6
remove comment
jujusb Oct 16, 2024
d99f167
fix edit study, test and activities
jujusb Oct 17, 2024
95e1912
fix
jujusb Oct 17, 2024
97fdb34
fix percentage + edit study name
jujusb Oct 17, 2024
e7ace4b
fix using patch
jujusb Oct 17, 2024
81c1e7f
adding hmac signature
jujusb Oct 18, 2024
7ac0e73
trying to import key after generating it
jujusb Oct 18, 2024
304b9ff
fix using browserify ./public/libs/SSEClientManager.js -o ./public/li…
jujusb Oct 18, 2024
f0de437
adding import/export study
jujusb Oct 21, 2024
b4fdcff
adding image + fix file upload
jujusb Oct 21, 2024
9fcb92e
fix update activity progress
jujusb Oct 22, 2024
145c257
function in utils instead of repeating functions
jujusb Oct 23, 2024
7d4d431
adding edit group name
jujusb Oct 23, 2024
c431423
fix config
jujusb Oct 23, 2024
9b89d59
fix using hmacKeyConfig for hmac config
jujusb Oct 23, 2024
1a6c48d
remove extra variables
jujusb Oct 23, 2024
9e1212e
adding duplicate test button
jujusb Oct 23, 2024
4a7f0f5
fix using generated presigned url in simva api
jujusb Oct 24, 2024
2078f5b
adding update limesurvey
jujusb Oct 24, 2024
161b5c9
button edit limesurvey + update owner of survey
jujusb Oct 24, 2024
26da497
fix copy survey when editing
jujusb Oct 24, 2024
3be27d6
remove extra file
jujusb Oct 24, 2024
13ef3c2
remove ws package
jujusb Oct 24, 2024
3b8a74c
delete group
jujusb Oct 24, 2024
9128c9d
fix get survey list when edit
jujusb Oct 28, 2024
2929c7b
fix update survey list
jujusb Oct 28, 2024
5a4b6d8
adding name in confirm when removing group owner participants, study,…
jujusb Oct 30, 2024
5ad0d1f
set study active / archived
jujusb Nov 12, 2024
1eb2431
redirect to first not completed study
jujusb Nov 12, 2024
55910f8
fix activity result
jujusb Nov 12, 2024
c58942e
fix see backup
jujusb Nov 12, 2024
c65fa5f
fix update activity painter
jujusb Nov 12, 2024
1035c26
fix update activity result limesurvey
jujusb Nov 14, 2024
8ad5da7
fix redirect to scheduler view
jujusb Nov 14, 2024
e620a16
redirect to studies and groups page when accessing to a group you don…
jujusb Nov 14, 2024
c620dca
fix error bad gateway
jujusb Nov 14, 2024
ac99365
fix update result gameplay
jujusb Nov 14, 2024
0b8c45f
fix gameplay activity completion via adding checkbox in teacher dashb…
jujusb Nov 14, 2024
ba8297a
Adding refresh button
jujusb Nov 17, 2024
e0d8cdf
fix
jujusb Nov 17, 2024
d6336c3
Adding redirect tor openid with only token to enter
jujusb Nov 20, 2024
cc7b547
fix openidscheduler
jujusb Nov 22, 2024
f8c625b
fix register token users + update xasu config
jujusb Nov 27, 2024
d5f7cd9
choose with new and previous generation + update passport to keycloak…
jujusb Nov 28, 2024
7f239ff
fix save username + participant row pdf
jujusb Nov 28, 2024
6e3b1a3
fix getUsernameOrToken in activities display
jujusb Nov 28, 2024
e169fbb
fix url
jujusb Nov 28, 2024
532237d
fix group page as deprecated
jujusb Nov 29, 2024
8e19578
fix group view
jujusb Nov 29, 2024
2fe0b31
disable simva event
jujusb Dec 3, 2024
a8abd2f
remove some extra logs for debugging
jujusb Dec 3, 2024
9614e29
fix activity painter backup result
jujusb Dec 3, 2024
e97d5d0
adding pino in backend for frontend
jujusb Dec 4, 2024
6bd2403
adding presigned events url
jujusb Dec 4, 2024
b28287f
adding kafka consumer
jujusb Dec 4, 2024
9d99653
fix processMessage from kafka and send them to clients
jujusb Dec 4, 2024
374232e
adding display of student token in simva
jujusb Dec 5, 2024
a37b312
disable access to sso page when it is a token
jujusb Dec 5, 2024
efa2ffa
fix display
jujusb Dec 5, 2024
8e46315
adding ping message at first + every 5 minutes when new message recei…
jujusb Dec 9, 2024
f1db932
move events to /events instead of /studies/id/events and /scheduler/i…
jujusb Dec 9, 2024
1984963
fix sse adding schedule task
jujusb Dec 10, 2024
34b2fd6
fix schedule task
jujusb Dec 10, 2024
32a4f7a
fix refresh token
jujusb Dec 10, 2024
4709add
fix refresh auth scheduler
jujusb Dec 10, 2024
ba8fd01
fix some some to debug
jujusb Dec 10, 2024
ac3214e
use ping event to refresh simva token
jujusb Dec 12, 2024
90dc527
fix update jwt token
jujusb Dec 12, 2024
9ce0524
fix using client list for case of multiple tabs opened
jujusb Dec 12, 2024
608d602
fix logout
jujusb Dec 12, 2024
c9ed94e
fix remove client
jujusb Dec 12, 2024
7ece2c7
fix refresh token in all pages
jujusb Dec 13, 2024
9fd9ac2
fix reconnection and close connection on error in SSE
jujusb Dec 13, 2024
bc7c1d6
adding bff call to simva to remove afterward jwt from frontend
jujusb Dec 13, 2024
8643c05
adding bff all requests
jujusb Dec 16, 2024
3502b6e
fix some bff functions
jujusb Dec 16, 2024
32ead2c
adding shlink config url tiny generation
jujusb Dec 16, 2024
f7e9365
fix generateShlinkURL
jujusb Dec 16, 2024
c3076c2
fix survey
jujusb Dec 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions bin/www
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
const app = require('../routes');
const http = require('http');
const config = require('../config');


const logger = require('../logger');
//XXX
//require('https').globalAgent.options.ca = require('ssl-root-cas/latest').create();

Expand Down Expand Up @@ -58,17 +57,17 @@ function onError (error) {

const bind = typeof port === 'string' ? `Pipe ${port}` : `Port ${port}`;

console.log(error.code);
console.log(error);
logger.info(error.code);
logger.info(error);

// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.log(`${bind} requires elevated privileges`);
logger.info(`${bind} requires elevated privileges`);
process.exit(1);
break;
case 'EADDRINUSE':
console.log(`${bind} is already in use`);
logger.info(`${bind} is already in use`);
process.exit(1);
break;
default:
Expand All @@ -82,5 +81,5 @@ function onError (error) {
function onListening () {
const addr = server.address();
const bind = typeof addr === 'string' ? `pipe ${addr}` : `port ${addr.port}`;
console.log(`Listening on ${bind}`);
logger.info(`Listening on ${bind}`);
}
20 changes: 20 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,27 @@ config.limesurvey.url = `${config.limesurvey.protocol}://${config.limesurvey.ho
config.limesurvey.adminUser = process.env.LIMESURVEY_ADMIN_USER || 'admin'
config.limesurvey.adminPassword = process.env.LIMESURVEY_ADMIN_PASSWORD || 'password'

config.hmac = {}
config.hmac.password = process.env.HMAC_PASSWORD || 'mypassword'
config.hmac.salt = process.env.HMAC_SALT || 'mysalt'
config.hmac.key = process.env.HMAC_KEY || 'mykey'
config.hmac.hmacKey = null

config.lti = {}
config.lti.enabled = process.env.LTI_ENABLED || 'false'

config.kafka = {}
config.kafka.clientId= process.env.SIMVA_KAFKA_CLIENTID || 'my-client-id'
config.kafka.brokers= [ process.env.SIMVA_KAFKA_BROKER ] || ['localhost:9092']
config.kafka.groupId= process.env.SIMVA_KAFKA_GROUPID || 'my-group-id'
config.kafka.topic= process.env.SIMVA_KAFKA_SIMVA_EVENTS_TOPIC || 'minio-events'

config.shlink = {}
config.shlink.apihost = process.env.SHLINK_SERVER_HOST || 'shlink.external.test'
config.shlink.protocol = process.env.SHLINK_PROTOCOL || 'https'
config.shlink.port = process.env.SHLINK_PORT || '443'
config.shlink.apiurl = `${config.shlink.protocol}://${config.shlink.apihost}:${config.shlink.port}`
config.shlink.apikey = process.env.SHLINK_SERVER_API_KEY || 'myapikey'


module.exports = config;
73 changes: 73 additions & 0 deletions logger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
const pino = require('pino');
const config = require('./config.js');
const path = require('path');
const logsFolder = path.join(__dirname, '../logs');
var now = new Date();
const logFile = `${logsFolder.pathname}/${now.toISOString()}.log`;

/** @type {{targets:import('pino').TransportTargetOptions[]}} */
let transport = {
targets: [
{
target: 'pino/file',
level: (process.env.LOG_LEVEL || 'info').toLowerCase(),
options: {
destination: logFile,
mkdir: true
}
}
]
};
if (process.env.NODE_ENV !== 'production') {
transport.targets.push(
{
target: 'pino-pretty',
level: (process.env.LOG_LEVEL || 'info').toLowerCase(),
options: {
ignore: 'pid,hostname'
}
}
);
} else {
transport.targets.push(
{
target: 'pino/file',
level: (process.env.LOG_LEVEL || 'info').toLowerCase(),
options: {
singleLine: true,
ignore: 'pid,hostname'
}
}
);
}

/** @type {import('pino').LoggerOptions} */
const options = {
level: (process.env.LOG_LEVEL || 'info').toLowerCase(),
redact: {
paths: ['config.password', 'config.api.adminPassword', 'config.JWT.secret', 'config.limesurvey.adminPassword', 'config.sso.clientSecret', 'config.sso.adminPassword', 'config.a2.adminPassword', 'config.LTI.platform.mongo.password', 'config.LTI.platform.key'],
censor: '**REDACTED**'
},
customLevels: { log: 30 },
serializers: {
err: pino.stdSerializers.err,
req: pino.stdSerializers.req,
res: pino.stdSerializers.res
},
transport
}


const logger = pino.pino(options);


process.on('uncaughtException', err => {
logger.fatal(err, 'uncaughtException')
process.exitCode = 1
});

process.on('unhandledRejection', reason =>
logger.fatal(reason, 'unhandledRejection')
);

module.exports = logger;
Loading