This commit is contained in:
j3d1 2024-01-25 01:02:27 +01:00
parent 7e985cdfbd
commit a83fa12fef
4 changed files with 81 additions and 119 deletions

View file

@ -0,0 +1,27 @@
http {
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream websocket {
server staging.c3lf.de:443;
}
server {
listen 8082;
access_log /home/jedi/Projects/c3lf-system-3/deploy/foo.log;
location / {
proxy_pass https://websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Origin "https://staging.c3lf.de/";
proxy_set_header Host $host;
}
}
}
events {}
pid /home/jedi/Projects/c3lf-system-3/deploy/nginx.pid;

View file

@ -1,50 +0,0 @@
let state = 0;
let ports = [];
let notify_socket;
function tryConnect(){
if(self.WebSocket === undefined){
console.log("no websocket support");
return;
}
if (!notify_socket || notify_socket.readyState !== WebSocket.OPEN) {
const scheme = location.protocol === "https:" ? "wss" : "ws";
notify_socket = new WebSocket(scheme + '://' + location.host + '/ws/2/notify/');
notify_socket.onopen = (e) => {
console.log("open", JSON.stringify(e));
};
notify_socket.onclose = (e) => {
console.log("close", JSON.stringify(e));
setTimeout(() => {
tryConnect();
}, 1000);
};
notify_socket.onerror = (e) => {
console.log("error", JSON.stringify(e));
setTimeout(() => {
tryConnect();
}, 1000);
};
notify_socket.onmessage = (e) => {
let data = JSON.parse(e.data);
console.log("message", data);
//this.loadEventItems()
//this.loadTickets()
}
}
}
onconnect = function (e) {
const port = e.ports[0];
ports.push(port);
port.onmessage = function (e) {
state = state + 1;
for (let i = 0; i < ports.length; i++) {
ports[i].postMessage({d: e.data, s: state, n: ports.length});
}
}
port.start();
console.log("worker connected", JSON.stringify(e));
tryConnect();
}

View file

@ -1,5 +1,16 @@
<template> <template>
<div> <div>
<div>
<ul>
<li>
<button class="btn btn-primary" @click="addTest('test')">+</button>
</li>
<li v-for="(t, index) in test" :key="index">
{{ t }}
<button class="btn btn-link" @click="removeTest(index)">-</button>
</li>
</ul>
</div>
<!--qr-code :text="qr_url" color="#000" bg-color="#fff" error-level="H" class="qr-code"></qr-code--> <!--qr-code :text="qr_url" color="#000" bg-color="#fff" error-level="H" class="qr-code"></qr-code-->
<h3 class="text-center">Events</h3> <h3 class="text-center">Events</h3>
<!--p>{{ events }}</p--> <!--p>{{ events }}</p-->
@ -33,7 +44,7 @@
</template> </template>
<script> <script>
import {mapActions, mapState} from 'vuex'; import {mapActions, mapMutations, mapState} from 'vuex';
import Table from '@/components/Table'; import Table from '@/components/Table';
export default { export default {
@ -41,6 +52,8 @@ export default {
components: {Table}, components: {Table},
computed: { computed: {
...mapState(['events', 'loadedItems', 'loadedBoxes', 'tickets']), ...mapState(['events', 'loadedItems', 'loadedBoxes', 'tickets']),
...mapState(['events', 'loadedItems', 'loadedBoxes']),//, 'mails', 'issues', 'systemEvents']),
...mapState(['test']),
qr_url() { qr_url() {
return window.location.href; return window.location.href;
} }
@ -48,6 +61,17 @@ export default {
methods: { methods: {
...mapActions(['changeEvent', 'loadTickets']), ...mapActions(['changeEvent', 'loadTickets']),
...mapActions(['changeEvent']),//, 'loadMails', 'loadIssues', 'loadSystemEvents']),
...mapMutations(['setTest']),
addTest(test) {
const tests = [...this.test, test];
this.setTest(tests);
},
removeTest(index) {
const tests = [...this.test];
tests.splice(index, 1);
this.setTest(tests);
}
}, },
mounted() { mounted() {
this.loadTickets(); this.loadTickets();

View file

@ -7,45 +7,6 @@ module.exports = {
"Access-Control-Allow-Headers": "*", "Access-Control-Allow-Headers": "*",
"Access-Control-Allow-Methods": "*" "Access-Control-Allow-Methods": "*"
}, },
//devMiddleware: {
// //location /redirect_media/ {
// // internal;
// // alias /var/www/c3lf-sys3/userfiles/;
// //}
// //
// //location /redirect_thumbnail/ {
// // internal;
// // alias /var/www/c3lf-sys3/userfiles/thumbnails/;
// //}
// modifyResponse: function (res) {
// path = res.headers['x-accel-redirect'];
// let re_path;
// if (path && path.includes('/redirect_thumbnail/')) {
// re_path = path.replace('/redirect_thumbnail/', '../userfiles/thumbnails/');
// }else if (path && path.includes('/redirect_media/')) {
// re_path = path.replace('/redirect_media/', '../userfiles/');
// }
// const body = require(re_path);
// res.headers['content-type'] = 'image/jpeg';
// res.headers['content-length'] = body.length;
// res.body = body;
// return res;
// },
//},
/*setupMiddlewares: (middlewares, devServer) => {
devServer.app.use(basicAuth({
users: {
'c3lf': 'findetalles'
},
challenge: true
}));
return middlewares;
},*/
/*watchOptions: {
poll: true,
ignored: /node_modules/,
},*/
proxy: { proxy: {
'^/media/2': { '^/media/2': {
target: 'https://staging.c3lf.de/', target: 'https://staging.c3lf.de/',