➖ Removing superflous css in some jquery
✨ Messages now has its own properly named type exposed for other modules to use if it's required ➕ New jquery calls in messages to actually populate the message box with the last 48 hours worth of messages
This commit is contained in:
parent
ba7b33ae62
commit
8e6c90b3c4
@ -56,12 +56,7 @@ ipcMain.on('config-request', (event, _arg) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on('config-update', (event, data, target) => {
|
ipcMain.on('config-update', (event, data, target) => {
|
||||||
config = data // update memory config first
|
config = data // update in-memory config-file first
|
||||||
cfg.update_config(data, target)
|
cfg.update_config(data, target)
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on('http-failure', (event, msg) => {
|
|
||||||
console.log(event, msg)
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
# Status
|
||||||
|
|
||||||
|
Working on Linux Debian however other systems are not tested + this
|
||||||
|
Debian build is somewhat jank and missing support for a lot of the
|
||||||
|
API.
|
||||||
|
|
||||||
# Client Build
|
# Client Build
|
||||||
|
|
||||||
This will be where we keep the code for the web-based-client.
|
This will be where we keep the code for the web-based-client.
|
||||||
|
@ -42,11 +42,12 @@ function update_channels_list(proto, hostname, port, params) {
|
|||||||
// wack jquery shit
|
// wack jquery shit
|
||||||
$('#channels-list').append(
|
$('#channels-list').append(
|
||||||
$('<li>').append(
|
$('<li>').append(
|
||||||
$('<button>').attr({
|
$('<p>').append(
|
||||||
type: 'button',
|
$('<button>').attr({
|
||||||
'class': 'btn btn-outline-secondary btn-nav-settings',
|
'class': 'btn btn-outline-secondary btn-nav-settings',
|
||||||
id: channel['name'],
|
id: channel['name'],
|
||||||
}).text(channel['name'])
|
}).text(channel['name'])
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
// why not jquery? Because the callback doesn't register
|
// why not jquery? Because the callback doesn't register
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
const got = require('got')
|
const got = require('got')
|
||||||
const $ = require('jquery')
|
const $ = require('jquery')
|
||||||
|
|
||||||
exports.Message = class _Message {
|
class Message {
|
||||||
|
|
||||||
static TYPES = ['text', 'jpeg', 'png', 'webm', 'mp4']
|
static TYPES = ['text', 'jpeg', 'png', 'webm', 'mp4']
|
||||||
|
|
||||||
@ -23,6 +23,7 @@ exports.Message = class _Message {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
exports.Message = Message
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {String} auth.jwt | jwt for quick auth
|
* @param {String} auth.jwt | jwt for quick auth
|
||||||
@ -36,7 +37,7 @@ exports.Message = class _Message {
|
|||||||
* @param {i64} start_time | Unix time to start fetching messages from
|
* @param {i64} start_time | Unix time to start fetching messages from
|
||||||
* @param {i64} end_time | Unix time to stop fetching messages from
|
* @param {i64} end_time | Unix time to stop fetching messages from
|
||||||
*
|
*
|
||||||
* @returns Array<Message>
|
* @returns {Message[]}
|
||||||
*
|
*
|
||||||
* @throws HTTPResponseError
|
* @throws HTTPResponseError
|
||||||
*/
|
*/
|
||||||
@ -54,6 +55,7 @@ async function get_range(auth, server, channel_id, start_time, end_time, limit)
|
|||||||
},
|
},
|
||||||
responseType: 'json'
|
responseType: 'json'
|
||||||
});
|
});
|
||||||
|
|
||||||
// assming 200 from this point out
|
// assming 200 from this point out
|
||||||
let messages = []
|
let messages = []
|
||||||
for(const msg of response.body['messages']) {
|
for(const msg of response.body['messages']) {
|
||||||
@ -88,11 +90,27 @@ exports.recent_messages = function (auth, server, channel, start_time, end_time,
|
|||||||
$('#channel-description').text(channel['description'])
|
$('#channel-description').text(channel['description'])
|
||||||
|
|
||||||
const now = Math.floor(new Date().getTime() / 1000)
|
const now = Math.floor(new Date().getTime() / 1000)
|
||||||
const yesterday = now - (60 * 60 * 24)
|
const yesterday = now - (60 * 60 * 48)
|
||||||
|
|
||||||
get_range(auth, server, channel['id'], yesterday, now, 1000)
|
get_range(auth, server, channel['id'], yesterday, now, 1000)
|
||||||
.then(messages => {
|
.then(messages => {
|
||||||
console.log(messages)
|
// TODO: this shit right here brother here we go html farming wew lad
|
||||||
|
//<li id="m-123"> <p class="message"> <a href="#" class="btn btn-link author-name">resident tweeker</a> some bs content </p> </li>
|
||||||
|
for(const message of messages) {
|
||||||
|
$('#messages-list').append(
|
||||||
|
$('<li>').append(
|
||||||
|
$('<p>').append(
|
||||||
|
$('<a>').attr({
|
||||||
|
id: message.uid,
|
||||||
|
href: '#',
|
||||||
|
'class': 'btn btn-link author-name'
|
||||||
|
}).text(message.uid),
|
||||||
|
message.content
|
||||||
|
).attr('class', 'message')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
console.log(message)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
http_err => {
|
http_err => {
|
||||||
console.log('Couldn\'t fetch data from server', http_err)
|
console.log('Couldn\'t fetch data from server', http_err)
|
||||||
|
Loading…
Reference in New Issue
Block a user