Compare commits
No commits in common. "7d750db1f8235c8231699c2da39c1075ac678841" and "a06e3f404a15d8115fa65ba8533ff7774baa0beb" have entirely different histories.
7d750db1f8
...
a06e3f404a
@ -26,7 +26,6 @@ dependencies = [
|
|||||||
"cryptography",
|
"cryptography",
|
||||||
"requests",
|
"requests",
|
||||||
"asyncssh",
|
"asyncssh",
|
||||||
"emoji",
|
"emoji"
|
||||||
"pywebpush"
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,81 @@
|
|||||||
|
|
||||||
|
|
||||||
|
/*class Message {
|
||||||
|
uid = null
|
||||||
|
author = null
|
||||||
|
avatar = null
|
||||||
|
text = null
|
||||||
|
time = null
|
||||||
|
constructor(uid,avatar,author,text,time){
|
||||||
|
this.uid = uid
|
||||||
|
this.avatar = avatar
|
||||||
|
this.author = author
|
||||||
|
this.text = text
|
||||||
|
this.time = time
|
||||||
|
}
|
||||||
|
|
||||||
|
get links() {
|
||||||
|
if(!this.text)
|
||||||
|
return []
|
||||||
|
let result = []
|
||||||
|
for(let part in this.text.split(/[,; ]/)){
|
||||||
|
if(part.startsWith("http") || part.startsWith("www.") || part.indexOf(".com") || part.indexOf(".net") || part.indexOf(".io") || part.indexOf(".nl")){
|
||||||
|
result.push(part)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
get mentions() {
|
||||||
|
if(!this.text)
|
||||||
|
return []
|
||||||
|
let result = []
|
||||||
|
for(let part in this.text.split(/[,; ]/)){
|
||||||
|
if(part.startsWith("@")){
|
||||||
|
result.push(part)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
class Messages {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Room {
|
||||||
|
name = null
|
||||||
|
messages = []
|
||||||
|
constructor(name) {
|
||||||
|
this.name = name
|
||||||
|
}
|
||||||
|
setMessages(list) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class InlineAppElement extends HTMLElement {
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
// this.
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class Page {
|
||||||
|
elements = []
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
class RESTClient {
|
class RESTClient {
|
||||||
debug = false
|
debug = false
|
||||||
@ -298,13 +374,14 @@ class NotificationAudio {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class App extends EventHandler {
|
class App extends EventHandler {
|
||||||
|
rooms = []
|
||||||
rest = rest
|
rest = rest
|
||||||
ws = null
|
ws = null
|
||||||
rpc = null
|
rpc = null
|
||||||
audio = null
|
audio = null
|
||||||
user = {}
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
|
this.rooms.push(new Room("General"))
|
||||||
this.ws = new Socket()
|
this.ws = new Socket()
|
||||||
this.rpc = this.ws.client
|
this.rpc = this.ws.client
|
||||||
const me = this
|
const me = this
|
||||||
@ -312,10 +389,6 @@ class App extends EventHandler {
|
|||||||
this.ws.addEventListener("channel-message", (data) => {
|
this.ws.addEventListener("channel-message", (data) => {
|
||||||
me.emit(data.channel_uid, data)
|
me.emit(data.channel_uid, data)
|
||||||
})
|
})
|
||||||
|
|
||||||
this.rpc.getUser(null).then(user=>{
|
|
||||||
me.user = user
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
playSound(index){
|
playSound(index){
|
||||||
this.audio.play(index)
|
this.audio.play(index)
|
||||||
|
|||||||
@ -6,12 +6,10 @@ class ChatWindowElement extends HTMLElement {
|
|||||||
super();
|
super();
|
||||||
this.attachShadow({ mode: 'open' });
|
this.attachShadow({ mode: 'open' });
|
||||||
this.component = document.createElement('section');
|
this.component = document.createElement('section');
|
||||||
this.app = app
|
|
||||||
this.shadowRoot.appendChild(this.component);
|
this.shadowRoot.appendChild(this.component);
|
||||||
}
|
}
|
||||||
get user() {
|
|
||||||
return this.app.user
|
|
||||||
}
|
|
||||||
async connectedCallback() {
|
async connectedCallback() {
|
||||||
const link = document.createElement('link')
|
const link = document.createElement('link')
|
||||||
link.rel = 'stylesheet'
|
link.rel = 'stylesheet'
|
||||||
@ -63,7 +61,6 @@ class ChatWindowElement extends HTMLElement {
|
|||||||
})
|
})
|
||||||
const me = this
|
const me = this
|
||||||
channelElement.addEventListener("message",(message)=>{
|
channelElement.addEventListener("message",(message)=>{
|
||||||
if(me.user.uid != message.detail.user_uid)
|
|
||||||
app.playSound(0)
|
app.playSound(0)
|
||||||
message.detail.element.scrollIntoView()
|
message.detail.element.scrollIntoView()
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user