added missing files

pull/4/head
AdamSBlack 2021-10-31 01:15:38 +00:00
parent 29cacc6798
commit 72ff0d9457
3 changed files with 195 additions and 0 deletions

52
Anetha/helpers.js 100644
View File

@ -0,0 +1,52 @@
let wss;
const orm = require('../models/index.model');
const {v4: uuid} = require('uuid');
function invoke(command, params, dongleId, accountId) {
const websocket = wss.retropilotFunc.findFromDongle(dongleId);
if (!websocket) {
wss.retropilotFunc.actionLogger(accountId, null, "ATHENA_USER_INVOKE__FAILED_DISCONNECTED", null, null, null, dongleId);
return { connected: false }
}
const uniqueID = uuid();
wss.retropilotFunc.actionLogger(accountId, websocket.device_id, "ATHENA_USER_INVOKE__ISSUED", null, websocket._socket.remoteAddress, JSON.stringify({ command, params, uniqueID }), websocket.dongleId);
orm.models.athena_returned_data.create({
device_id: websocket.device_id,
type: command,
created_at: Date.now(),
uuid: uniqueID
})
websocket.send(JSON.stringify(wss.retropilotFunc.commandBuilder(command, params, uniqueID)))
return { dispatched: true, heartbeat: websocket.heartbeat, id: uniqueID }
}
function isDeviceConnected(accountId, deviceId, dongleId) {
const websocket = wss.retropilotFunc.findFromDongle(dongleId);
wss.retropilotFunc.actionLogger(accountId, deviceId, "ATHENA_USER_STATUS__IS_CONNECTED", null, websocket ? websocket._socket.remoteAddress : null, JSON.stringify({ connected: websocket ? true : false, heartbeat: websocket ? websocket.heartbeat : null }), dongleId);
if (!websocket) return { connected: false }
return { connected: true, heartbeat: websocket.heartbeat };
}
module.exports = (websocketServer) => {
wss = websocketServer;
return {
isDeviceConnected,
invoke
}
}

View File

@ -0,0 +1,10 @@
module.exports = {
apps : [{
name : "Retropilot Service",
script : "./server.js",
env_development: {
NODE_ENV: "development",
}
}],
}

133
exit 100644
View File

@ -0,0 +1,133 @@
commit 751742acf6acd427573ca5e943b86b3ad6ec762a (HEAD -> dev, origin/dev)
Reflog: HEAD@{0} (AdamSBlack <adam@adamblack.us>)
Reflog message: commit: updated readme
Author: AdamSBlack <adam@adamblack.us>
Date: Fri Oct 29 21:46:48 2021 +0100
updated readme
commit f4cb1ef1424c263e441522ce4915efac353d9227
Reflog: HEAD@{1} (AdamSBlack <adam@adamblack.us>)
Reflog message: commit: Athena, logging, etc
Author: AdamSBlack <adam@adamblack.us>
Date: Fri Oct 29 21:45:15 2021 +0100
Athena, logging, etc
commit 32325111c6bd2d0b6f7e583be45032e33290233a (main)
Reflog: HEAD@{2} (AdamSBlack <adam@adamblack.us>)
Reflog message: checkout: moving from main to dev
Author: AdamSBlack <adam@adamblack.us>
Date: Tue Oct 26 23:38:31 2021 +0100
Added new tables to database,
added logging to athena
commit 32325111c6bd2d0b6f7e583be45032e33290233a (main)
Reflog: HEAD@{3} (AdamSBlack <adam@adamblack.us>)
Reflog message: commit: Added new tables to database,
Author: AdamSBlack <adam@adamblack.us>
Date: Tue Oct 26 23:38:31 2021 +0100
Added new tables to database,
added logging to athena
commit 9361043d836e821499fade16537a7091169ce5e3
Reflog: HEAD@{4} (AdamSBlack <adam@adamblack.us>)
Reflog message: commit: Added proof of concept for Athena
Author: AdamSBlack <adam@adamblack.us>
Date: Mon Oct 25 22:56:40 2021 +0100
Added proof of concept for Athena
commit 4075e5730a3a74610da52b95e0c9f83c65efb40a (origin/main, origin/HEAD)
Reflog: HEAD@{5} (AdamSBlack <adam@adamblack.us>)
Reflog message: commit: Fixed admin API's middleware to not filter through
Author: AdamSBlack <adam@adamblack.us>
Date: Wed Oct 13 19:06:46 2021 +0100
Fixed admin API's middleware to not filter through
other routes
commit 3596013e2fc868636243d04220f24a70b3ad8207
Reflog: HEAD@{6} (AdamSBlack <adam@adamblack.us>)
Reflog message: commit: TODO: Fix admin api auth catching any undefined routes
Author: AdamSBlack <adam@adamblack.us>
Date: Mon Oct 11 19:37:58 2021 +0100
TODO: Fix admin api auth catching any undefined routes
Removed pointlessly stateful controllers, admin api fleshed out
commit e33b10e7d0e7954c6a1e649a958317662d8d303f
Reflog: HEAD@{7} (AdamSBlack <adam@adamblack.us>)
Reflog message: commit: disable useradminapi
Author: AdamSBlack <adam@adamblack.us>
Date: Sun Oct 3 17:48:52 2021 +0100
disable useradminapi
commit acf084743df3e868af0f4733f0db38818e93216c
Reflog: HEAD@{8} (AdamSBlack <adam@adamblack.us>)
Reflog message: commit: updated database, sessions managed via signed JWT
Author: AdamSBlack <adam@adamblack.us>
Date: Sun Oct 3 17:44:43 2021 +0100
updated database, sessions managed via signed JWT
token.
TODO: sign tokens based user unique token, instead of
global salt key
commit 7590e9b64473d8a0e59fdba072262f7e0efee517
Reflog: HEAD@{9} (AdamSBlack <adam@adamblack.us>)
Reflog message: commit: userAdminApi now allows users to change their
Author: AdamSBlack <adam@adamblack.us>
Date: Sun Oct 3 15:35:44 2021 +0100
userAdminApi now allows users to change their
password
commit f642360a5d6cb3015082041f805ef04ba51631c1
Reflog: HEAD@{10} (AdamSBlack <adam@adamblack.us>)
Reflog message: commit: Device pair logic removed from route
Author: AdamSBlack <adam@adamblack.us>
Date: Sun Oct 3 14:11:34 2021 +0100
Device pair logic removed from route
and moved into devices controller using
ORM now, not 100% tested
commit aaedd0bfd6db7a699640345d1444e686fa059d36
Reflog: HEAD@{11} (AdamSBlack <adam@adamblack.us>)
Reflog message: commit: minor
Author: AdamSBlack <adam@adamblack.us>
Date: Sun Oct 3 00:08:21 2021 +0100
minor
commit f5a0fc8c0dcac6edb3c63950cd319c0ae34a7e3e
Reflog: HEAD@{12} (AdamSBlack <adam@adamblack.us>)
Reflog message: commit: include new models
Author: AdamSBlack <adam@adamblack.us>
Date: Sat Oct 2 23:11:51 2021 +0100
include new models
commit cbea324a05abc8d65d26506aeb14c4c346dcf068
Reflog: HEAD@{13} (AdamSBlack <adam@adamblack.us>)
Reflog message: commit: Implemented Sequelize ORM, moved over users.js
Author: AdamSBlack <adam@adamblack.us>
Date: Sat Oct 2 23:08:56 2021 +0100
Implemented Sequelize ORM, moved over users.js
to new ORM
commit 6521cda85a69ad4442ffb55ddcf46e86f947adfa
Reflog: HEAD@{14} (AdamSBlack <adam@adamblack.us>)
Reflog message: clone: from https://github.com/AdamSBlack/retropilot-server.git
Author: AdamSBlack <adam@adamblack.us>
Date: Thu Sep 30 20:18:37 2021 +0100
Created branch "cursed"
Modified pairing to support new registrations