diff --git a/css/posts.css b/css/posts.css index 521be95..ae51421 100644 --- a/css/posts.css +++ b/css/posts.css @@ -39,7 +39,7 @@ } .boticon { - + } .mention { @@ -87,3 +87,13 @@ button { resize: none; overflow-wrap: break-word; } + +.channelTab { + text-align: left; + float: left; + padding-right: 20px +} + +#scriptonly { + margin: auto; +} diff --git a/js/posts.js b/js/posts.js index 798a60e..6062317 100644 --- a/js/posts.js +++ b/js/posts.js @@ -220,8 +220,6 @@ function unreply() { reply_id = 0 } -main() - var cansendNoti = false async function askNotiPerms() { @@ -234,8 +232,6 @@ async function firstAsk() { } } -firstAsk() - async function mainNoti(user) { if(Notification.permission === 'denied' || Notification.permission === 'default') { await askNotiPerms() @@ -262,3 +258,27 @@ if(window.location.href.includes("mention=")) { if(window.location.href.includes("message=")) { document.getElementById("post-text").innerText = `${decodeURIComponent(window.location.href.split("message=")[1])} ` } + +async function loadChannels() { + // + + let channels = await (await fetch("/api/getChannels")).json() + let tab = document.getElementById("channelTab") + tab.innerHTML = "" + for (let i = 0; i < channels.length; i++) { + let channelname = channels[i].post_receiver_name + let channelp = document.createElement("p") + channelp.classList.add("channel") + let textnode = document.createTextNode(channelname) + channelp.appendChild(textnode) + tab.appendChild(channelp) + } +} + +function init() { + main() + firstAsk() + loadChannels() +} + +init() diff --git a/server.js b/server.js index e1e9493..6c6c2e1 100644 --- a/server.js +++ b/server.js @@ -740,7 +740,7 @@ router.get("/api/getPersonalPosts", async function(req,res) { router.get("/api/getChannels", async function(req,res) { res.set("Access-Control-Allow-Origin","*") - let sql = `select post_receiver_name from ipost.posts where post_is_private = false group by post_receiver_name order by post_id desc;` + let sql = `select post_receiver_name from ipost.posts where post_is_private = '0' group by post_receiver_name;` con.query(sql, [], function (err, result) { if (err) throw err; res.json(result) diff --git a/views/posts.html b/views/posts.html index 7a36896..0adb65d 100644 --- a/views/posts.html +++ b/views/posts.html @@ -32,6 +32,10 @@
+
+ + +