diff --git a/chat-app/bun.lockb b/chat-app/bun.lockb index 769bcf7..3e76185 100755 Binary files a/chat-app/bun.lockb and b/chat-app/bun.lockb differ diff --git a/chat-app/static/js/index.js b/chat-app/static/js/index.js index cd3639b..4746f16 100644 --- a/chat-app/static/js/index.js +++ b/chat-app/static/js/index.js @@ -79,6 +79,11 @@ var require_hasOwn = __commonJS((exports, module) => { // node_modules/mithril/render/hyperscript.js var require_hyperscript = __commonJS((exports, module) => { + var Vnode = require_vnode(); + var hyperscriptVnode = require_hyperscriptVnode(); + var hasOwn = require_hasOwn(); + var selectorParser = /(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g; + var selectorCache = {}; function isEmpty(object) { for (var key in object) if (hasOwn.call(object, key)) @@ -147,11 +152,6 @@ var require_hyperscript = __commonJS((exports, module) => { vnode.tag = selector; return vnode; } - var Vnode = require_vnode(); - var hyperscriptVnode = require_hyperscriptVnode(); - var hasOwn = require_hasOwn(); - var selectorParser = /(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g; - var selectorCache = {}; module.exports = hyperscript; }); @@ -187,6 +187,7 @@ var require_hyperscript2 = __commonJS((exports, module) => { // node_modules/mithril/render/domFor.js var require_domFor = __commonJS((exports, module) => { + var delayedRemoval = new WeakMap; function* domFor({ dom, domSize }, { generation } = {}) { if (dom != null) do { @@ -198,7 +199,6 @@ var require_domFor = __commonJS((exports, module) => { dom = nextSibling; } while (domSize); } - var delayedRemoval = new WeakMap; module.exports = { delayedRemoval, domFor @@ -1480,13 +1480,6 @@ var require_censor = __commonJS((exports, module) => { // node_modules/mithril/api/router.js var require_router = __commonJS((exports, module) => { - function decodeURIComponentSave(component) { - try { - return decodeURIComponent(component); - } catch (e) { - return component; - } - } var Vnode = require_vnode(); var m = require_hyperscript(); var buildPathname = require_build2(); @@ -1495,6 +1488,13 @@ var require_router = __commonJS((exports, module) => { var assign = require_assign(); var censor = require_censor(); var sentinel = {}; + function decodeURIComponentSave(component) { + try { + return decodeURIComponent(component); + } catch (e) { + return component; + } + } module.exports = function($window, mountRedraw) { var callAsync = $window == null ? null : typeof $window.setImmediate === "function" ? $window.setImmediate : $window.setTimeout; var p = Promise.resolve(); @@ -1721,18 +1721,34 @@ var import_mithril = __toESM(require_mithril(), 1); // frontend/websocket.js function createWebSocket() { - let appUrl = "localhost:3000"; + let appUrl = "undefined"; appUrl = `//${appUrl}/chat-service`; return new WebSocket(appUrl); } // frontend/index.js +var messages = []; +var socket = createWebSocket(); +socket.onmessage = function(event) { + if (event.type === "message") { + const message = JSON.parse(event.data); + messages.push(message); + import_mithril.default.redraw(); + } +}; function newMessageText(name, message) { return [ import_mithril.default("span.chatter", name + ": "), import_mithril.default("span.chatter-message", message) ]; } +var MessageBox = { + view: function() { + return import_mithril.default(".messages", { id: "message-box" }, messages.reverse().map(function(message) { + return import_mithril.default(".message", newMessageText(message.chatter, message.message)); + }), import_mithril.default("#anchor")); + } +}; function clearMessageInputBox() { const messageBox = document.getElementById("message"); messageBox.value = ""; @@ -1747,22 +1763,6 @@ function sendMessage(e) { socket.send(JSON.stringify(message)); clearMessageInputBox(); } -var messages = []; -var socket = createWebSocket(); -socket.onmessage = function(event) { - if (event.type === "message") { - const message = JSON.parse(event.data); - messages.push(message); - import_mithril.default.redraw(); - } -}; -var MessageBox = { - view: function() { - return import_mithril.default(".messages", { id: "message-box" }, messages.reverse().map(function(message) { - return import_mithril.default(".message", newMessageText(message.chatter, message.message)); - }), import_mithril.default("#anchor")); - } -}; var MessageInput = { view: function() { return import_mithril.default("div.chat-input", [ diff --git a/slides/bun.lockb b/slides/bun.lockb new file mode 100755 index 0000000..6f1b0ae Binary files /dev/null and b/slides/bun.lockb differ diff --git a/slides/deployment.html b/slides/deployment.html index 7be0787..8360903 100644 --- a/slides/deployment.html +++ b/slides/deployment.html @@ -76,18 +76,19 @@ Doing it Yourself - Do not use AWS, its too expensive - Your small project is not worth the cost - Use a small VPS from DigitalOcean or Linode - Get a public IP address and root access + A domain + A server with a public IP address + A webserver + Patience - - Blue/Green Deployment - - + + Dokku + Self-hosted platform as a service + Your very own Heroku + What Dokku Does @@ -103,12 +104,21 @@ - Create an application. - -$ dokku apps:create chat.freedoom.party ------> Creating chat.freedoom.party... ------> Creating new app virtual host file... - + Anatomy of the Server + + Linode VPS + Debian + + + + + Anatomy of the Application + + Hono Web Server Application + Mithril.js Frontend Application + Dockerized + +
Self-hosted platform as a service
Your very own Heroku
-$ dokku apps:create chat.freedoom.party ------> Creating chat.freedoom.party... ------> Creating new app virtual host file... -