updated various things
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Sat, 2 Mar 2024 23:25:01 +0000 (23:25 +0000)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Sat, 2 Mar 2024 23:25:01 +0000 (23:25 +0000)
onyx-pkg.kdl
src/app.onyx
www/news-articles/index-backup.json [new file with mode: 0644]
www/templates/pages/404.html
www/templates/pages/docs/env_setup.html

index aa0d51877bfc4ca3f796d7fff496db2947c06e7e..5c4edb336b66f13f97f365350c86ec3f3b5b72f4 100644 (file)
@@ -12,8 +12,8 @@ config {
 }
 
 dependencies {
-    http-server "0.2.30" git="https://github.com/onyx-lang/pkg-http-server" 
-    otmp "0.0.33" git="https://github.com/onyx-lang/pkg-otmp" 
+    http-server "0.3.0" git="https://github.com/onyx-lang/pkg-http-server" 
+    otmp "0.0.34" git="https://github.com/onyx-lang/pkg-otmp" 
 }
 
 build {
index 3f8b580a9ad2e1fabb1ba024529e96be56863209..5fc2827fabd9053b52ce344f3ea863cfb00e8f82 100644 (file)
@@ -23,7 +23,7 @@ reg: otmp.TemplateRegistry;
             log(.Warning, "Template Renderer", tprintf("{}", s));
         }
 
-        r.headers["content-type"] = "text/html";
+        r.headers["Content-Type"] = "text/html";
         r->status(200 if s == .None else 400);
         r->end();
     }
@@ -97,8 +97,8 @@ news_articles: Cached_Resource([] Article);
     article_path := req.url_params["article"] ?? "";
     article := array.first(news_articles->get() ?? .[], [n](n.path == article_path));
     if !article {
-        res->status(404);
         res->render("pages/404", null);
+        res->status(404);
         return;
     }
 
@@ -113,8 +113,8 @@ news_articles: Cached_Resource([] Article);
         });
 
     } else {
-        res->status(404);
         res->render("pages/404", null);
+        res->status(404);
         return;
     }
 }
@@ -179,6 +179,8 @@ main :: () {
     pipes->pipe((req, res) => {
         if !res.completed {
             res->render("pages/404", null);
+            res->status(404);
+            res->end();
         }
     });
 
@@ -190,9 +192,13 @@ main :: () {
         logger := http.server.logger(style=.V2);
         pipes->pipe(&logger);
 
-        app := http.server.tcp(pipes, .{ thread_count = 4 });
+        app := http.server.tcp(pipes, .{
+            thread_count = 8,
+            max_clients = 256
+        });
 
         port := conv.parse_int(os.env("SERVER_PORT") ?? "8000");
+        logf(.Info, "Listening on {}", port);
 
         app->serve(~~port);
         println("Server stopping...");
diff --git a/www/news-articles/index-backup.json b/www/news-articles/index-backup.json
new file mode 100644 (file)
index 0000000..3a5d45a
--- /dev/null
@@ -0,0 +1,14 @@
+[
+    {
+        "name": "Onyx's Memory Model",
+        "path": "memory_model",
+        "date": "29th April 2023",
+        "description": "A explanation of the memory model employed by Onyx."
+    },
+    {
+        "name": "Onyx's Custom Runtime",
+        "path": "ovmwasm",
+        "date": "5th April 2023",
+        "description": "A brief introduction to OVM-Wasm, Onyx's custom WASM runtime for debugging and portability."
+    }
+]
index 80dd35e86a72aade1de4975939da54c315011eee..3a105d447f91ac84ab8b44d16987d8eb16c0ad1b 100644 (file)
@@ -1,17 +1,8 @@
-{{block "title"}}Onyx - Page not found{{endblock}}
+<html>
+    <body>
+        <div style="color: red">
+            <h1>404 - Page not found</h1>
+        </div>
+    </body>
+</html>
 
-{{block "content"}}
-
-<main>
-    {% partial "partials/navbar" %}
-
-    <div class="container">
-        <h1>404 - Page not found</h1>
-    </div>
-
-    {% partial "partials/footer" %}
-</main>
-
-{{endblock}}
-
-{{extends "pages/base"}}
index 09ecac0554cce9dbe79ed6764cc91cfbeafcc97e..23bd6186b8ef117d2bce9ca85b8e0114a16f3c65 100644 (file)
@@ -129,7 +129,7 @@ configs.onyx = {
         root_dir = function(filename)
             local utils = require "lspconfig.util"
             return utils.search_ancestors(filename, function(path)
-                if utils.path.is_file(utils.path.join(path, "onyx-lsp.ini")) then
+                if utils.path.is_file(utils.path.join(path, "onyx-lsp.kdl")) then
                     return path
                 end
             end)