➖ 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:
shockrah
2021-03-05 17:48:59 -08:00
parent ba7b33ae62
commit 8e6c90b3c4
4 changed files with 35 additions and 15 deletions

View File

@@ -56,12 +56,7 @@ ipcMain.on('config-request', (event, _arg) => {
})
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)
})
ipcMain.on('http-failure', (event, msg) => {
console.log(event, msg)
})

View File

@@ -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
This will be where we keep the code for the web-based-client.

View File

@@ -42,11 +42,12 @@ function update_channels_list(proto, hostname, port, params) {
// wack jquery shit
$('#channels-list').append(
$('<li>').append(
$('<button>').attr({
type: 'button',
'class': 'btn btn-outline-secondary btn-nav-settings',
id: channel['name'],
}).text(channel['name'])
$('<p>').append(
$('<button>').attr({
'class': 'btn btn-outline-secondary btn-nav-settings',
id: channel['name'],
}).text(channel['name'])
)
)
)
// why not jquery? Because the callback doesn't register

View File

@@ -1,7 +1,7 @@
const got = require('got')
const $ = require('jquery')
exports.Message = class _Message {
class Message {
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
@@ -36,7 +37,7 @@ exports.Message = class _Message {
* @param {i64} start_time | Unix time to start fetching messages from
* @param {i64} end_time | Unix time to stop fetching messages from
*
* @returns Array<Message>
* @returns {Message[]}
*
* @throws HTTPResponseError
*/
@@ -54,6 +55,7 @@ async function get_range(auth, server, channel_id, start_time, end_time, limit)
},
responseType: 'json'
});
// assming 200 from this point out
let 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'])
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)
.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 => {
console.log('Couldn\'t fetch data from server', http_err)