Heavy repair.
This commit is contained in:
parent
f395d16173
commit
084f8dba20
@ -30,7 +30,6 @@ RUN apk add --no-cache \
|
||||
&& apk del .build-deps
|
||||
COPY --from=wkhtmltopdf /bin/wkhtmltopdf /bin/wkhtmltopdf
|
||||
COPY --from=wkhtmltopdf /bin/wkhtmltoimage /bin/wkhtmltoimage
|
||||
COPY setup.cfg setup.cfg
|
||||
COPY pyproject.toml pyproject.toml
|
||||
COPY src src
|
||||
RUN pip install --upgrade pip
|
||||
|
@ -4,7 +4,6 @@ RUN apk add --no-cache gcc musl-dev linux-headers git openssh
|
||||
|
||||
#WKHTMLTOPDFNEEDS
|
||||
|
||||
COPY setup.cfg setup.cfg
|
||||
COPY pyproject.toml pyproject.toml
|
||||
COPY src src
|
||||
COpy ssh_host_key ssh_host_key
|
||||
|
@ -27,6 +27,7 @@ dependencies = [
|
||||
"requests",
|
||||
"asyncssh",
|
||||
"emoji",
|
||||
"pywebpush"
|
||||
"pywebpush",
|
||||
"aiofiles"
|
||||
]
|
||||
|
||||
|
29
setup.cfg
29
setup.cfg
@ -1,29 +0,0 @@
|
||||
[metadata]
|
||||
name = snek
|
||||
version = 1.0.0
|
||||
description = Snek chat server
|
||||
author = retoor
|
||||
author_email = retoor@molodetz.nl
|
||||
license = MIT
|
||||
long_description = file: README.md
|
||||
long_description_content_type = text/markdown
|
||||
|
||||
[options]
|
||||
packages = find:
|
||||
package_dir =
|
||||
= src
|
||||
python_requires = >=3.7
|
||||
install_requires =
|
||||
app @ git+https://retoor.molodetz.nl/retoor/app
|
||||
beautifulsoup4
|
||||
gunicorn
|
||||
imgkit
|
||||
wkhtmltopdf
|
||||
shed
|
||||
|
||||
[options.packages.find]
|
||||
where = src
|
||||
|
||||
[options.entry_points]
|
||||
console_scripts =
|
||||
snek.serve = snek.server:cli
|
@ -166,9 +166,10 @@ class Socket extends EventHandler {
|
||||
if (this.ensureTimer) {
|
||||
return this.connect();
|
||||
}
|
||||
const me = this;
|
||||
this.ensureTimer = setInterval(() => {
|
||||
if (this.isConnecting) this.isConnecting = false;
|
||||
this.connect();
|
||||
if (me.isConnecting) me.isConnecting = false;
|
||||
me.connect();
|
||||
}, 5000);
|
||||
return this.connect();
|
||||
}
|
||||
@ -178,32 +179,34 @@ class Socket extends EventHandler {
|
||||
}
|
||||
|
||||
connect() {
|
||||
|
||||
const me = this
|
||||
if (this.isConnected || this.isConnecting) {
|
||||
return new Promise((resolve) => {
|
||||
this.connectPromises.push(resolve);
|
||||
if (!this.isConnected) resolve(this);
|
||||
me.connectPromises.push(resolve);
|
||||
if (!me.isConnecting) resolve(me);
|
||||
});
|
||||
}
|
||||
this.isConnecting = true;
|
||||
return new Promise((resolve) => {
|
||||
this.connectPromises.push(resolve);
|
||||
me.connectPromises.push(resolve);
|
||||
console.debug("Connecting..");
|
||||
|
||||
const ws = new WebSocket(this.url);
|
||||
const ws = new WebSocket(me.url);
|
||||
ws.onopen = () => {
|
||||
this.ws = ws;
|
||||
this.isConnected = true;
|
||||
this.isConnecting = false;
|
||||
me.ws = ws;
|
||||
me.isConnected = true;
|
||||
me.isConnecting = false;
|
||||
ws.onmessage = (event) => {
|
||||
this.onData(JSON.parse(event.data));
|
||||
me.onData(JSON.parse(event.data));
|
||||
};
|
||||
ws.onclose = () => {
|
||||
this.onClose();
|
||||
me.onClose();
|
||||
};
|
||||
ws.onerror = () => {
|
||||
this.onClose();
|
||||
me.onClose();
|
||||
};
|
||||
this.connectPromises.forEach(resolver => resolver(this));
|
||||
me.connectPromises.forEach(resolver => resolver(me));
|
||||
};
|
||||
});
|
||||
}
|
||||
@ -233,9 +236,10 @@ class Socket extends EventHandler {
|
||||
method,
|
||||
args,
|
||||
};
|
||||
const me = this
|
||||
return new Promise((resolve) => {
|
||||
this.addEventListener(call.callId, data => resolve(data));
|
||||
this.sendJson(call);
|
||||
me.addEventListener(call.callId, data => resolve(data));
|
||||
me.sendJson(call);
|
||||
});
|
||||
}
|
||||
|
||||
@ -281,12 +285,13 @@ class App extends EventHandler {
|
||||
this.ws = new Socket();
|
||||
this.rpc = this.ws.client;
|
||||
this.audio = new NotificationAudio(500);
|
||||
const me = this
|
||||
this.ws.addEventListener("channel-message", (data) => {
|
||||
this.emit(data.channel_uid, data);
|
||||
me.emit(data.channel_uid, data);
|
||||
});
|
||||
|
||||
this.rpc.getUser(null).then(user => {
|
||||
this.user = user;
|
||||
me.user = user;
|
||||
});
|
||||
}
|
||||
|
||||
@ -296,14 +301,15 @@ class App extends EventHandler {
|
||||
|
||||
async benchMark(times = 100, message = "Benchmark Message") {
|
||||
const promises = [];
|
||||
const me = this;
|
||||
for (let i = 0; i < times; i++) {
|
||||
promises.push(this.rpc.getChannels().then(channels => {
|
||||
channels.forEach(channel => {
|
||||
this.rpc.sendMessage(channel.uid, `${message} ${i}`);
|
||||
me.rpc.sendMessage(channel.uid, `${message} ${i}`);
|
||||
});
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const app = new App();
|
||||
const app = new App();
|
||||
|
Loading…
Reference in New Issue
Block a user