Merge pull request #144 from ragestudio/dev

This commit is contained in:
srgooglo 2025-05-15 16:14:15 +02:00 committed by GitHub
commit 96dfcdb250
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 48 additions and 20 deletions

@ -1 +1 @@
Subproject commit fe5cb1a9a275444abd7307bbd8a4e7c68221369b Subproject commit 7c11af2643de00423a6ac680bba235c3352620a0

View File

@ -1,6 +1,6 @@
{ {
"name": "@comty/app", "name": "@comty/app",
"version": "1.42.0@alpha", "version": "1.42.1@alpha",
"license": "ComtyLicense", "license": "ComtyLicense",
"main": "electron/main", "main": "electron/main",
"type": "module", "type": "module",
@ -34,7 +34,7 @@
"axios": "^1.7.7", "axios": "^1.7.7",
"bear-react-carousel": "^4.0.10-alpha.0", "bear-react-carousel": "^4.0.10-alpha.0",
"classnames": "2.3.1", "classnames": "2.3.1",
"comty.js": "^0.66.0", "comty.js": "^0.66.1",
"d3": "^7.9.0", "d3": "^7.9.0",
"dashjs": "^5.0.0", "dashjs": "^5.0.0",
"dompurify": "^3.0.0", "dompurify": "^3.0.0",

View File

@ -40,11 +40,15 @@ class ComtyApp extends React.Component {
await this.auth.flush() await this.auth.flush()
await this.initialization() await this.initialization()
app.cores.api.reset()
app.navigation.goMain() app.navigation.goMain()
}, },
onLogout: async () => { onLogout: async () => {
await this.auth.flush() await this.auth.flush()
app.cores.api.reset()
app.navigation.goAuth() app.navigation.goAuth()
}, },
onInvalidSession: async (error) => { onInvalidSession: async (error) => {

View File

@ -24,6 +24,7 @@ export default class APICore extends Core {
listenEvent: this.listenEvent.bind(this), listenEvent: this.listenEvent.bind(this),
unlistenEvent: this.unlistenEvent.bind(this), unlistenEvent: this.unlistenEvent.bind(this),
emitEvent: this.emitEvent.bind(this), emitEvent: this.emitEvent.bind(this),
reset: this.reset.bind(this),
measurePing: measurePing, measurePing: measurePing,
useRequest: useRequest, useRequest: useRequest,
} }
@ -84,6 +85,10 @@ export default class APICore extends Core {
return this.client.ws.sockets.get(instance).off(key, handler) return this.client.ws.sockets.get(instance).off(key, handler)
} }
async reset() {
this.client.ws.connectAll()
}
async onInitialize() { async onInitialize() {
this.client = await createClient({ this.client = await createClient({
eventBus: app.eventBus, eventBus: app.eventBus,
@ -93,15 +98,6 @@ export default class APICore extends Core {
}, },
}) })
// handle auth events
this.client.eventBus.on("auth:login_success", () => {
this.client.ws.connectAll()
})
this.client.eventBus.on("auth:logout_success", () => {
this.client.ws.connectAll()
})
// make a basic request to check if the API is available // make a basic request to check if the API is available
await this.client await this.client
.baseRequest({ .baseRequest({

View File

@ -8,8 +8,9 @@ RUN apt install -y --no-install-recommends git
RUN apt install -y --no-install-recommends ssh RUN apt install -y --no-install-recommends ssh
RUN apt install -y --no-install-recommends curl RUN apt install -y --no-install-recommends curl
RUN apt install -y --no-install-recommends nscd RUN apt install -y --no-install-recommends nscd
RUN apt install -y --no-install-recommends bash
RUN apt install -y --no-install-recommends which
RUN apt install -y --no-install-recommends ca-certificates RUN apt install -y --no-install-recommends ca-certificates
RUN apt install -y --no-install-recommends ffmpeg
# Create workdir # Create workdir
RUN mkdir -p /comty-server RUN mkdir -p /comty-server
@ -41,6 +42,12 @@ RUN /comty-server/nginx-bin -v
RUN chmod -R 777 /comty-server RUN chmod -R 777 /comty-server
RUN chown -R node:node /comty-server RUN chown -R node:node /comty-server
# Install manual server dependencies
RUN mkdir -p /root/.local/bin
RUN "/comty-server/scripts/installLatestFfmpeg.sh"
RUN mv /root/.local/bin/ffmpeg /bin/ffmpeg
RUN mv /root/.local/bin/ffprobe /bin/ffprobe
# Set user to node # Set user to node
USER node USER node

View File

@ -57,6 +57,10 @@ export class FFMPEGLib extends EventEmitter {
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (!bin) {
return reject("No binary provided")
}
const process = child_process.exec( const process = child_process.exec(
`${bin} ${args}`, `${bin} ${args}`,
{ {

View File

@ -108,9 +108,9 @@ export default class MultiqualityHLSJob extends FFMPEGLib {
fs.mkdirSync(outputPath, { recursive: true }) fs.mkdirSync(outputPath, { recursive: true })
} }
const inputProbe = await Utils.probe(this.params.input)
try { try {
const inputProbe = await Utils.probe(this.params.input)
const result = await this.ffmpeg({ const result = await this.ffmpeg({
args: cmdStr, args: cmdStr,
cwd: outputPath, cwd: outputPath,

View File

@ -105,9 +105,9 @@ export default class SegmentedAudioMPDJob extends FFMPEGLib {
fs.mkdirSync(outputPath, { recursive: true }) fs.mkdirSync(outputPath, { recursive: true })
} }
const inputProbe = await Utils.probe(this.params.input)
try { try {
const inputProbe = await Utils.probe(this.params.input)
const ffmpegResult = await this.ffmpeg({ const ffmpegResult = await this.ffmpeg({
args: segmentationCmd, args: segmentationCmd,
onProcess: (process) => { onProcess: (process) => {

View File

@ -0,0 +1,15 @@
import js from "@eslint/js"
import globals from "globals"
import { defineConfig } from "eslint/config"
export default defineConfig([
{
files: ["**/*.{js,mjs,cjs}"],
plugins: { js },
extends: ["js/recommended"],
},
{
files: ["**/*.{js,mjs,cjs}"],
languageOptions: { globals: globals.browser },
},
])

View File

@ -1,6 +1,6 @@
{ {
"name": "@comty/server", "name": "@comty/server",
"version": "1.40.1@alpha", "version": "1.42.1@alpha",
"license": "ComtyLicense", "license": "ComtyLicense",
"private": true, "private": true,
"workspaces": [ "workspaces": [
@ -40,7 +40,10 @@
"tree-kill": "^1.2.2" "tree-kill": "^1.2.2"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.26.0",
"chai": "^5.1.0", "chai": "^5.1.0",
"eslint": "^9.26.0",
"globals": "^16.1.0",
"mocha": "^10.3.0" "mocha": "^10.3.0"
}, },
"resolutions": { "resolutions": {

View File

@ -1,4 +1,3 @@
import path from "node:path"
import fs from "node:fs" import fs from "node:fs"
import Upload from "@shared-classes/Upload" import Upload from "@shared-classes/Upload"

View File

@ -6,7 +6,7 @@ export default {
return await PostClass.replies({ return await PostClass.replies({
post_id: req.params.post_id, post_id: req.params.post_id,
for_user_id: req.auth?.session.user_id, for_user_id: req.auth?.session.user_id,
trim: req.query.trim, page: req.query.page,
limit: req.query.limit, limit: req.query.limit,
}) })
}, },