Extract Vue frontend into separate container and add stp_wasm crate
Deploy with Docker Compose / deploy (push) Successful in 4m58s

Move Vue app from nginx/vue/ to top-level vue/ with its own Dockerfile,
update docker-compose configs and nginx proxy to serve from the new
container, and add initial Rust WASM crate (stp_wasm). Also fix .gitignore
to exclude Rust target/ directories.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
This commit is contained in:
2026-03-25 16:40:45 +00:00
co-authored by Claude Opus 4.6
parent 2b84730126
commit d3d3269d49
182 changed files with 215 additions and 34 deletions
+103
View File
@@ -0,0 +1,103 @@
import { defineStore } from "pinia";
import { ref, computed } from "vue";
import axios from "axios";
function getWebSocketURL() {
const protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
return `${protocol}//${window.location.host}/api/ws`;
}
export const useMessagesStore = defineStore("messages", () => {
const socket = ref(null);
const messages = ref([]);
const isConnected = ref(false);
const lastError = ref(null);
let intentionalClose = false;
let reconnectDelay = 1000;
let reconnectTimer = null;
const messagesCount = computed(() => messages.value.length);
function connect() {
if (socket.value && isConnected.value) return;
intentionalClose = false;
socket.value = new WebSocket(getWebSocketURL());
socket.value.onopen = () => {
isConnected.value = true;
lastError.value = null;
reconnectDelay = 1000;
messages.value = [];
};
socket.value.onmessage = (event) => {
try {
const data = JSON.parse(event.data);
messages.value.push(data);
} catch {
messages.value.push({ text: event.data });
}
};
socket.value.onerror = (error) => {
lastError.value = error;
};
socket.value.onclose = () => {
isConnected.value = false;
socket.value = null;
if (!intentionalClose) {
reconnectTimer = setTimeout(() => {
connect();
}, reconnectDelay);
reconnectDelay = Math.min(reconnectDelay * 2, 30000);
}
};
}
function disconnect() {
intentionalClose = true;
clearTimeout(reconnectTimer);
if (!socket.value) return;
socket.value.close();
socket.value = null;
isConnected.value = false;
}
function sendMessage(text) {
if (!socket.value || !isConnected.value) return;
socket.value.send(JSON.stringify({ text }));
}
function clearMessages() {
messages.value = [];
}
async function uploadAndSendFile(file) {
try {
const formData = new FormData();
formData.append("file", file);
const res = await axios.post("/api/messages/upload", formData);
const { url } = res.data;
if (!socket.value || !isConnected.value) return;
socket.value.send(JSON.stringify({ text: "", fileUrl: url }));
} catch (err) {
lastError.value = err;
}
}
return {
messages,
isConnected,
lastError,
messagesCount,
connect,
disconnect,
sendMessage,
clearMessages,
uploadAndSendFile,
};
});