This commit is contained in:
Troplo 2022-08-07 23:17:49 +10:00
parent 5a7902ff47
commit 3a6d7942a6
7 changed files with 60 additions and 32 deletions

View file

@ -7,6 +7,8 @@ let os = require("os")
app.set("trust proxy", true) app.set("trust proxy", true)
app.locals.config = require("./config/config.json") app.locals.config = require("./config/config.json")
const socket = require("./lib/socket") const socket = require("./lib/socket")
const { User } = require("./models")
const { Op } = require("sequelize")
const server = require("http").createServer(app) const server = require("http").createServer(app)
app.use(bodyParser.json({ limit: "15mb" })) app.use(bodyParser.json({ limit: "15mb" }))
@ -47,6 +49,18 @@ console.log(os.hostname())
app.use(require("./lib/errorHandler")) app.use(require("./lib/errorHandler"))
server.listen(23998, () => { server.listen(23998, () => {
User.update(
{
status: "offline"
},
{
where: {
status: {
[Op.ne]: "offline"
}
}
}
)
console.log("Initialized") console.log("Initialized")
console.log("Listening on port 0.0.0.0:" + 23998) console.log("Listening on port 0.0.0.0:" + 23998)

View file

@ -1,5 +1,6 @@
const auth = require("../lib/authorize_socket.js") const auth = require("../lib/authorize_socket.js")
const { User, Friend, Session, Theme } = require("../models") const { User, Friend, Session, Theme } = require("../models")
const { Op } = require("sequelize")
module.exports = { module.exports = {
init(app, server) { init(app, server) {
const io = require("socket.io")(server, { const io = require("socket.io")(server, {

View file

@ -5,7 +5,7 @@
publish: ["github"] publish: ["github"]
}, },
linux: { linux: {
target: ["AppImage", "deb", "tar.gz", "snap", "pacman"], target: ["AppImage", "deb", "tar.gz", "snap"],
publish: ["github"], publish: ["github"],
category: "Network", category: "Network",
synopsis: "Instant Messaging", synopsis: "Instant Messaging",

View file

@ -1,6 +1,6 @@
{ {
"name": "colubrina", "name": "colubrina",
"version": "1.0.20", "version": "1.0.21",
"description": "Simple instant communication.", "description": "Simple instant communication.",
"private": true, "private": true,
"author": "Troplo <troplo@troplo.com>", "author": "Troplo <troplo@troplo.com>",

View file

@ -1,14 +1,19 @@
>>>.max-v-list-height {
max-height: 10px;
overflow-y: auto;
}
.mentioned-message { .mentioned-message {
box-shadow: -2px 0 0 0 var(--v-primary-base); box-shadow: -2px 0 0 0 var(--v-primary-base);
} }
.offset-message { .offset-message {
padding-left: 53px; margin-left: 53px;
} }
.message-action-card { .message-action-card {
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 0;
margin-top: 5px; margin-top: -15px;
margin-right: 5px; margin-right: 5px;
} }
/* large codeblock */ /* large codeblock */

View file

@ -36,12 +36,14 @@
{{ message.reply.content.substring(0, 100) }} {{ message.reply.content.substring(0, 100) }}
</v-toolbar> </v-toolbar>
<v-list-item <v-list-item
class="max-v-list-height"
:key="message.keyId" :key="message.keyId"
:class="{ :class="{
'message-hover': hover, 'message-hover': hover,
'pa-0': $vuetify.breakpoint.mobile, 'pa-0': $vuetify.breakpoint.mobile,
'mentioned-message': mentioned 'mentioned-message': mentioned
}" }"
:dense="lastMessage"
:id="'message-' + index" :id="'message-' + index"
@contextmenu="show($event, 'message', message)" @contextmenu="show($event, 'message', message)"
:style="lastMessage ? 'margin-bottom: -5px; margin-top: -5px;' : ''" :style="lastMessage ? 'margin-bottom: -5px; margin-top: -5px;' : ''"
@ -400,7 +402,8 @@
></CommsInput> ></CommsInput>
</v-list-item-content> </v-list-item-content>
<v-card <v-card
elevation="3" elevation="8"
color="card"
class="message-action-card" class="message-action-card"
v-if="!$vuetify.breakpoint.mobile && hover" v-if="!$vuetify.breakpoint.mobile && hover"
> >

View file

@ -51,6 +51,9 @@
class="rounded-l" class="rounded-l"
> >
<v-list class="rounded-l" v-if="context.message.item"> <v-list class="rounded-l" v-if="context.message.item">
<v-list-item @click="copy(context.message.item.content)">
<v-list-item-title>Copy Message Content</v-list-item-title>
</v-list-item>
<v-list-item @click="replying = context.message.item"> <v-list-item @click="replying = context.message.item">
<v-list-item-title>Reply to Message</v-list-item-title> <v-list-item-title>Reply to Message</v-list-item-title>
</v-list-item> </v-list-item>
@ -126,6 +129,7 @@
v-if="!loading && $vuetify.breakpoint.mobile" v-if="!loading && $vuetify.breakpoint.mobile"
app app
right right
style="z-index: 100"
> >
<v-list two-line color="card"> <v-list two-line color="card">
<v-list-item-group class="rounded-xl"> <v-list-item-group class="rounded-xl">
@ -275,33 +279,31 @@
</template> </template>
<v-tooltip top> <v-tooltip top>
<template v-slot:activator="{ on }"> <template v-slot:activator="{ on }">
<span> <v-btn
<v-btn icon
icon small
small fab
fab width="20"
width="20" height="20"
height="20" class="ml-2 mt-2"
class="ml-2 mt-2" style="float: right"
style="float: right" @click="openUserPanel($store.state.user)"
@click="openUserPanel($store.state.user)" >
> <v-avatar size="20" v-on="on" color="primary">
<v-avatar size="20" v-on="on" color="primary"> <img
<img v-if="$store.state.user.avatar"
v-if="$store.state.user.avatar" :src="
:src=" $store.state.baseURL +
$store.state.baseURL + '/usercontent/' +
'/usercontent/' + $store.state.user.avatar
$store.state.user.avatar "
" alt="avatar"
alt="avatar" />
/> <span v-else>{{
<span v-else>{{ $store.state.user.username[0].toUpperCase()
$store.state.user.username[0].toUpperCase() }}</span>
}}</span> </v-avatar>
</v-avatar> </v-btn>
</v-btn>
</span>
</template> </template>
<span> <span>
{{ $store.state.user.username }} has read up to this point. {{ $store.state.user.username }} has read up to this point.
@ -723,6 +725,9 @@ export default {
} }
}, },
methods: { methods: {
copy(content) {
navigator.clipboard.writeText(content)
},
removePin(id) { removePin(id) {
this.axios this.axios
.post(`/api/v1/communications/${this.chat.id}/pins`, { .post(`/api/v1/communications/${this.chat.id}/pins`, {