get_channels now has nearly no logic in it
Doing this because there are other mechanisms in place to protect against bs JWT's which really just adds a ton of complexity to every function
This commit is contained in:
parent
e693d7e62b
commit
316b5ad1fd
@ -1,4 +1,5 @@
|
||||
// Requesting channel data here
|
||||
const { ipcRenderer } = require('electron')
|
||||
const auth = require('./auth.js')
|
||||
const { Request } = require('./request.js')
|
||||
|
||||
@ -20,30 +21,30 @@ class Channel {
|
||||
* @param {Object} params | basic object with jwt + id fields
|
||||
*/
|
||||
function channels_list(domain, port, params) {
|
||||
const url = `http://${domain}:${port}/channels/list` // input sanitzation is for bitches
|
||||
Request('get', url, params).then(
|
||||
response => {
|
||||
const channels = response.body
|
||||
console.log(channels)
|
||||
|
||||
Request('get', domain, port, '/channels/list', params).then(
|
||||
channels => {
|
||||
// fill the DOM with stuff here
|
||||
console.log('sucess', channels)
|
||||
},
|
||||
reason => {
|
||||
console.log('Request for /channels/list rejected', reason)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Only requests
|
||||
* Listener callback for actually getting a list of channels
|
||||
* @param {Object} server_conf Should contain at least id/secret + domain/port
|
||||
*
|
||||
*/
|
||||
exports.get_channels = function(server_conf) {
|
||||
// the first two checks are here to rpevent getting a 401 due to a bad/missing jwt
|
||||
if('jwt' in server_conf) {
|
||||
if(auth.valid_jwt(server['jwt'])) {
|
||||
const params = { jwt: server['jwt'], id: server['id'] }
|
||||
}
|
||||
// do something else idk
|
||||
} else {
|
||||
// complain here
|
||||
console.log(server_conf)
|
||||
const params = {
|
||||
id: server_conf['id'],
|
||||
jwt: server_conf['jwt']
|
||||
}
|
||||
|
||||
channels_list(server_conf['domain'], server_conf['port'], params)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user