Compare commits

..

2 commits

Author SHA1 Message Date
067a3ff369 Add build all script 2024-07-17 20:12:11 +02:00
368b0b419b Decaln 2024-07-17 20:09:38 +02:00
3 changed files with 11 additions and 16 deletions

View file

@ -12,13 +12,7 @@ Includes:
## Jumpstart ## Jumpstart
1. Install dependencies: `yarn` 1. Install dependencies: `yarn`
2. Build everything 2. Build everything: `yarn build`
```
yarn workspace @msagent-chat/msagent.js build
yarn workspace @msagent-chat/protocol build
yarn workspace @msagent-chat/webapp build
yarn workspace @msagent-chat/server build
```
3. Copy `server/config.example.toml` to `server/config.toml` and fill out the relevant fields. 3. Copy `server/config.example.toml` to `server/config.toml` and fill out the relevant fields.
4. Run the server: `yarn workspace @msagent-chat/server serve` 4. Run the server: `yarn workspace @msagent-chat/server serve`
5. - Run the webapp on the development webserver: `yarn workspace @msagent-chat/webapp serve`; OR 5. - Run the webapp on the development webserver: `yarn workspace @msagent-chat/webapp serve`; OR

View file

@ -7,7 +7,8 @@
"msagent.js" "msagent.js"
], ],
"scripts": { "scripts": {
"format": "prettier --write **/*.{ts,html,scss}" "format": "prettier --write **/*.{ts,html,scss}",
"build": "yarn workspaces foreach -p -A run build"
}, },
"packageManager": "yarn@4.2.2", "packageManager": "yarn@4.2.2",
"devDependencies": { "devDependencies": {

View file

@ -65,8 +65,8 @@ logonWindow.show();
let loggingIn = false; let loggingIn = false;
elements.logonForm.addEventListener('submit', (e) => { elements.logonForm.addEventListener('submit', (e) => {
e.preventDefault(); e.preventDefault();
localStorage.setItem("MSAUser", elements.logonUsername.value); localStorage.setItem('MSAUser', elements.logonUsername.value);
localStorage.setItem("MSAgent", elements.agentSelect.value); localStorage.setItem('MSAgent', elements.agentSelect.value);
connectToRoom(); connectToRoom();
}); });
@ -97,17 +97,17 @@ async function connectToRoom() {
document.addEventListener('DOMContentLoaded', async () => { document.addEventListener('DOMContentLoaded', async () => {
await agentInit(); await agentInit();
elements.logonUsername.value = localStorage.getItem("MSAUser") || ""; elements.logonUsername.value = localStorage.getItem('MSAUser') || '';
for (const agent of await Room.getAgents()) { let agents = await Room.getAgents();
for (const agent of agents) {
let option = document.createElement('option'); let option = document.createElement('option');
option.innerText = agent.friendlyName; option.innerText = agent.friendlyName;
option.value = agent.filename; option.value = agent.filename;
elements.agentSelect.appendChild(option); elements.agentSelect.appendChild(option);
} }
elements.agentSelect.value = localStorage.getItem("MSAgent") || ""; let savedAgent = localStorage.getItem('MSAgent') || '';
if(elements.agentSelect.value === "") { if (agents.some((x) => x.filename === savedAgent)) {
// HTMLSelectElement is like this, don't complain. elements.agentSelect.value = savedAgent;
elements.agentSelect.value = "";
} }
let motd = await Room.getMotd(); let motd = await Room.getMotd();
elements.motdContainer.innerHTML = motd.html; elements.motdContainer.innerHTML = motd.html;