nibula 1.0.2 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Mirror of src/backend/_core/modules/RateLimiter.php
5
+ *
6
+ * Same algorithm and same on-disk format: one JSON file per IP under ../../cache,
7
+ * holding an array of request timestamps. Old timestamps outside the window are
8
+ * pruned, the current one appended, and if the count exceeds the limit a 429 is
9
+ * returned (with a Retry-After header) through the request-bound Response helper.
10
+ */
11
+
12
+ const fs = require('fs');
13
+ const path = require('path');
14
+ const crypto = require('crypto');
15
+
16
+ class RateLimiter {
17
+ /**
18
+ * @param {string} ip
19
+ * @param {number} maxRequests
20
+ * @param {number} windowSeconds
21
+ * @param {object} Response request-bound helper from createResponse(res)
22
+ * @param {object} res raw http response (to set Retry-After)
23
+ */
24
+ static check(ip, maxRequests = 60, windowSeconds = 60, Response, res) {
25
+ const cacheDir = path.join(__dirname, '..', '..', 'cache');
26
+
27
+ if (!fs.existsSync(cacheDir)) {
28
+ fs.mkdirSync(cacheDir, { recursive: true, mode: 0o755 });
29
+ }
30
+
31
+ const hash = crypto.createHash('md5').update(ip).digest('hex');
32
+ const cacheFile = path.join(cacheDir, 'rl_' + hash + '.json');
33
+ const now = Math.floor(Date.now() / 1000);
34
+ let data = [];
35
+
36
+ if (fs.existsSync(cacheFile)) {
37
+ try {
38
+ data = JSON.parse(fs.readFileSync(cacheFile, 'utf8')) || [];
39
+ } catch (e) {
40
+ data = [];
41
+ }
42
+ }
43
+
44
+ data = data.filter((ts) => ts > (now - windowSeconds));
45
+ data.push(now);
46
+
47
+ // LOCK_EX equivalent: an exclusive write. Node's writeFileSync is atomic
48
+ // enough for this single-process model.
49
+ fs.writeFileSync(cacheFile, JSON.stringify(data));
50
+
51
+ if (data.length > maxRequests) {
52
+ res.setHeader('Retry-After', String(windowSeconds));
53
+ Response.error('Too Many Requests', 429);
54
+ }
55
+ }
56
+ }
57
+
58
+ module.exports = RateLimiter;
@@ -0,0 +1,59 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Mirror of src/backend/_core/modules/Response.php
5
+ *
6
+ * In PHP the Response helper writes JSON and calls exit() to stop execution.
7
+ * Node has no per-request exit, so each method writes to the response and then
8
+ * throws the HALT sentinel. The front controller catches HALT and stops the
9
+ * dispatch, reproducing the same "the endpoint stops here" behaviour.
10
+ *
11
+ * A fresh, response-bound helper is created per request via createResponse(res)
12
+ * so overlapping async requests never clash (PHP was process-per-request).
13
+ */
14
+
15
+ // Sentinel thrown to unwind execution after a response has been sent (≈ PHP exit).
16
+ const HALT = Symbol('RESPONSE_HALT');
17
+
18
+ function jsonEncode(obj) {
19
+ // JSON.stringify already leaves unicode unescaped and does not escape slashes,
20
+ // matching PHP's JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES.
21
+ return JSON.stringify(obj);
22
+ }
23
+
24
+ function createResponse(res) {
25
+ return {
26
+ success(data = null, code = 200) {
27
+ res.statusCode = code;
28
+ res.setHeader('Content-Type', 'application/json; charset=UTF-8');
29
+ res.end(jsonEncode({
30
+ status: 'success',
31
+ data: data,
32
+ }));
33
+ throw HALT;
34
+ },
35
+
36
+ error(message, code = 400, details = null) {
37
+ res.statusCode = code;
38
+ res.setHeader('Content-Type', 'application/json; charset=UTF-8');
39
+ const body = {
40
+ status: 'error',
41
+ message: message,
42
+ code: code,
43
+ };
44
+ if (details !== null) {
45
+ body.details = details;
46
+ }
47
+ res.end(jsonEncode(body));
48
+ throw HALT;
49
+ },
50
+
51
+ noContent() {
52
+ res.statusCode = 204;
53
+ res.end();
54
+ throw HALT;
55
+ },
56
+ };
57
+ }
58
+
59
+ module.exports = { createResponse, HALT };
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Mirror of src/backend/api/protected/example-protected.php
5
+ *
6
+ * Protected endpoint: the API key check (X-Api-Key header) runs automatically in
7
+ * the front controller before this file is loaded, so here we just handle logic.
8
+ */
9
+
10
+ module.exports = ({ method, requestParams, Response }) => {
11
+ if (method !== 'GET') {
12
+ Response.error('Method not allowed', 405);
13
+ }
14
+
15
+ //
16
+ // Your endpoint logic here. You can access route parameters in requestParams
17
+ //
18
+
19
+ Response.success({
20
+ message: 'Protected endpoint is working',
21
+ params: requestParams,
22
+ });
23
+ };
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Mirror of src/backend/api/public/example-public.php
5
+ *
6
+ * Public endpoint: no API key required. Receives the request context and calls
7
+ * the request-bound Response helper, exactly like the PHP file used the global
8
+ * Response class and $method / $requestParams.
9
+ */
10
+
11
+ module.exports = ({ method, requestParams, Response }) => {
12
+ if (method !== 'GET') {
13
+ Response.error('Method not allowed', 405);
14
+ }
15
+
16
+ //
17
+ // Your endpoint logic here. You can access route parameters in requestParams
18
+ //
19
+
20
+ Response.success({
21
+ message: 'Public endpoint is working',
22
+ params: requestParams,
23
+ });
24
+ };
@@ -0,0 +1,30 @@
1
+ # Example systemd unit to keep the Node backend running on your server.
2
+ #
3
+ # 1. Copy your built site to the server (the `out` folder).
4
+ # 2. Adjust WorkingDirectory below to point at out/backend on your server.
5
+ # 3. Copy this file to /etc/systemd/system/backend-node.service (drop the .example).
6
+ # 4. Enable and start it:
7
+ # sudo systemctl daemon-reload
8
+ # sudo systemctl enable --now backend-node
9
+ # sudo systemctl status backend-node
10
+ #
11
+ # Check the Node path with `which node` and update ExecStart if it isn't /usr/bin/node
12
+ # (nvm installs live elsewhere, e.g. /home/<user>/.nvm/versions/node/<v>/bin/node).
13
+
14
+ [Unit]
15
+ Description=Nibula Node backend
16
+ After=network.target
17
+
18
+ [Service]
19
+ Type=simple
20
+ WorkingDirectory=/var/www/your-site/out/backend
21
+ ExecStart=/usr/bin/node _core/index.js
22
+ Environment=PORT=3000
23
+ Environment=HOST=127.0.0.1
24
+ Environment=APP_ENV=production
25
+ Restart=on-failure
26
+ RestartSec=2
27
+ User=www-data
28
+
29
+ [Install]
30
+ WantedBy=multi-user.target
@@ -0,0 +1,46 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Mirror of src/backend/database/Database.php
5
+ *
6
+ * PDO singleton → a single shared mysql2 connection pool. Config is read from
7
+ * ../config.js (same relative location as the PHP version's ../config.php).
8
+ * Options map the PDO attributes as closely as mysql2 allows:
9
+ * - ERRMODE_EXCEPTION → mysql2 rejects/throws on error by default
10
+ * - FETCH_ASSOC → rowsAsArray:false (objects keyed by column) is default
11
+ * - EMULATE_PREPARES false → native prepared statements via pool.execute()
12
+ *
13
+ * Requires the "mysql2" package (npm install mysql2). getInstance() returns the
14
+ * promise-based pool; use pool.execute(sql, params) for prepared statements.
15
+ */
16
+
17
+ const path = require('path');
18
+
19
+ let instance = null;
20
+
21
+ class Database {
22
+ static getInstance() {
23
+ if (instance === null) {
24
+ // Lazy require so the backend boots even without a DB configured.
25
+ // eslint-disable-next-line global-require
26
+ const mysql = require('mysql2/promise');
27
+
28
+ // eslint-disable-next-line global-require
29
+ const config = require(path.join(__dirname, '..', 'config.js'));
30
+
31
+ instance = mysql.createPool({
32
+ host: config.DB_HOST,
33
+ database: config.DB_NAME,
34
+ user: config.DB_USER,
35
+ password: config.DB_PASS,
36
+ charset: 'utf8mb4',
37
+ waitForConnections: true,
38
+ connectionLimit: 10,
39
+ namedPlaceholders: false,
40
+ });
41
+ }
42
+ return instance;
43
+ }
44
+ }
45
+
46
+ module.exports = Database;
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Mirror of src/backend/example.config.php
5
+ *
6
+ * Versioned, secret-free template. On setup, copy this file to config.js and
7
+ * fill in real values. config.js is git-ignored and stays local.
8
+ */
9
+
10
+ module.exports = {
11
+ // Default key for protected endpoints that don't have a specific key in CUSTOM_ENDPOINT_KEYS
12
+ GENERAL_API_KEY: 'DEFAULT_KEY',
13
+
14
+ // If you want to restrict access to protected endpoints to specific clients, define custom keys per endpoint.
15
+ // For subfolder endpoints, use the relative path ('subfolder/endpoint')
16
+ CUSTOM_ENDPOINT_KEYS: {
17
+ 'subfolder/example-protected': 'custom-key',
18
+ },
19
+
20
+ GENERAL_ALLOWED_ORIGINS: [
21
+ '*',
22
+ // 'https://example.com',
23
+ ],
24
+
25
+ CUSTOM_ENDPOINT_ORIGINS: {
26
+ 'subfolder/example-protected': ['https://app.example.com'],
27
+ },
28
+
29
+ // Database configuration
30
+ DB_HOST: '127.0.0.1',
31
+ DB_NAME: 'example_db',
32
+ DB_USER: 'root',
33
+ DB_PASS: '',
34
+
35
+ // Environment: 'production' hides error details; anything else = debug.
36
+ APP_ENV: 'production',
37
+ };
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "backend-node",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "description": "Node.js backend for a Nibula site. Coexists with the PHP backend; pick one at scaffold time. Front controller: _core/index.js.",
6
+ "main": "_core/index.js",
7
+ "type": "commonjs",
8
+ "scripts": {
9
+ "start": "node _core/index.js",
10
+ "dev": "APP_ENV=development node _core/index.js"
11
+ },
12
+ "engines": {
13
+ "node": ">=18"
14
+ },
15
+ "dependencies": {
16
+ "mysql2": "^3.11.0"
17
+ }
18
+ }
@@ -6,11 +6,46 @@ ErrorDocument 403 /404.html
6
6
  RewriteEngine On
7
7
  RewriteBase /
8
8
 
9
+ # Block sensitive files (web.config, dotfiles)
9
10
  RewriteRule ^(web\.config|\..*)$ /404.html [L,NC]
11
+ </IfModule>
10
12
 
13
+ # === /api routing — covers BOTH backends ====================================
14
+ #
15
+ # Apache (unlike nginx) cannot health-check an upstream, so it cannot auto-fall
16
+ # back from Node to PHP. The behaviour is:
17
+ #
18
+ # - mod_proxy available -> /api is proxied to the Node backend (127.0.0.1:3000)
19
+ # - mod_proxy NOT present -> /api is rewritten to the PHP front controller
20
+ #
21
+ # Typical shared hosting (Aruba, cPanel) has no mod_proxy, so it uses PHP
22
+ # automatically. On a VPS running Node, mod_proxy sends /api to Node.
23
+ #
24
+ # If you are on a server that HAS mod_proxy but you want to use PHP, comment out
25
+ # the mod_proxy block below.
26
+
27
+ # --- Node backend (if mod_proxy is available) ---
28
+ <IfModule mod_proxy.c>
29
+ ProxyPreserveHost On
30
+ ProxyPass /api/ http://127.0.0.1:3000/api/ retry=0
31
+ ProxyPassReverse /api/ http://127.0.0.1:3000/api/
32
+
33
+ <IfModule mod_headers.c>
34
+ RequestHeader set X-Forwarded-For "%{REMOTE_ADDR}s"
35
+ RequestHeader set X-Forwarded-Proto "https"
36
+ </IfModule>
37
+ </IfModule>
38
+
39
+ # --- PHP backend (fallback when mod_proxy is absent) ---
40
+ <IfModule mod_rewrite.c>
41
+ RewriteEngine On
42
+ RewriteBase /
11
43
  RewriteRule ^api/(.*)$ backend/_core/index.php [QSA,L]
44
+ </IfModule>
12
45
 
46
+ # === Static files ===========================================================
47
+ <IfModule mod_rewrite.c>
13
48
  RewriteCond %{REQUEST_FILENAME} -f [OR]
14
49
  RewriteCond %{REQUEST_FILENAME} -d
15
50
  RewriteRule ^ - [L]
16
- </IfModule>
51
+ </IfModule>
@@ -1,54 +1,54 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" role="img" aria-label="Nibula">
2
- <defs>
3
- <linearGradient id="nibulaShieldBorder" x1="0" y1="0" x2="1" y2="1">
4
- <stop offset="0" stop-color="#8b6fc4"/>
5
- <stop offset="0.5" stop-color="#c9a06a"/>
6
- <stop offset="1" stop-color="#f2c17a"/>
7
- </linearGradient>
8
- <linearGradient id="nibulaN" x1="0" y1="1" x2="1" y2="0">
9
- <stop offset="0" stop-color="#6d4fa8"/>
10
- <stop offset="0.45" stop-color="#a978b0"/>
11
- <stop offset="0.75" stop-color="#e7a55f"/>
12
- <stop offset="1" stop-color="#f7d08a"/>
13
- </linearGradient>
14
- <linearGradient id="nibulaNib" x1="0" y1="0" x2="1" y2="1">
15
- <stop offset="0" stop-color="#f7d89a"/>
16
- <stop offset="0.55" stop-color="#e0a95f"/>
17
- <stop offset="1" stop-color="#b07d3e"/>
18
- </linearGradient>
19
- <linearGradient id="nibulaField" x1="0" y1="0" x2="0.6" y2="1">
20
- <stop offset="0" stop-color="#3a2c63"/>
21
- <stop offset="1" stop-color="#2a2150"/>
22
- </linearGradient>
23
- </defs>
24
-
25
- <path fill="none" stroke="url(#nibulaShieldBorder)" stroke-width="10" stroke-linejoin="round"
26
- d="M256 40 L440 132 L440 320 L256 472 L72 320 L72 132 Z"/>
27
- <path fill="url(#nibulaField)" stroke="url(#nibulaShieldBorder)" stroke-width="6" stroke-linejoin="round"
28
- d="M256 66 L418 147 L418 310 L256 442 L94 310 L94 147 Z"/>
29
-
30
- <!-- N as one closed outline: up left post, down inner-left, diagonal to inner-bottom-right,
31
- up right post, cut corner, down outer-right, close along the bottom -->
32
- <path fill="url(#nibulaN)" stroke="#1a1533" stroke-width="7" stroke-linejoin="round"
33
- d="M148 362
34
- L148 150
35
- L206 150
36
- L312 300
37
- L312 150
38
- L370 150
39
- L370 205
40
- L340 205
41
- L340 362
42
- L282 362
43
- L206 255
44
- L206 362
45
- Z"/>
46
-
47
- <g stroke="#1a1533" stroke-width="7" stroke-linejoin="round" stroke-linecap="round">
48
- <path fill="url(#nibulaNib)" d="M326 300 L382 300 L392 326 L336 326 Z"/>
49
- <path fill="none" stroke-width="5" d="M338 313 L386 313"/>
50
- <path fill="url(#nibulaNib)" d="M336 326 L392 326 L428 414 L370 380 Z"/>
51
- <path fill="none" stroke-width="5" d="M366 342 L402 384"/>
52
- <circle cx="376" cy="360" r="6.5" fill="#1a1533" stroke="none"/>
53
- </g>
54
- </svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" role="img" aria-label="Nibula">
2
+ <defs>
3
+ <linearGradient id="nibulaShieldBorder" x1="0" y1="0" x2="1" y2="1">
4
+ <stop offset="0" stop-color="#8b6fc4"/>
5
+ <stop offset="0.5" stop-color="#c9a06a"/>
6
+ <stop offset="1" stop-color="#f2c17a"/>
7
+ </linearGradient>
8
+ <linearGradient id="nibulaN" x1="0" y1="1" x2="1" y2="0">
9
+ <stop offset="0" stop-color="#6d4fa8"/>
10
+ <stop offset="0.45" stop-color="#a978b0"/>
11
+ <stop offset="0.75" stop-color="#e7a55f"/>
12
+ <stop offset="1" stop-color="#f7d08a"/>
13
+ </linearGradient>
14
+ <linearGradient id="nibulaNib" x1="0" y1="0" x2="1" y2="1">
15
+ <stop offset="0" stop-color="#f7d89a"/>
16
+ <stop offset="0.55" stop-color="#e0a95f"/>
17
+ <stop offset="1" stop-color="#b07d3e"/>
18
+ </linearGradient>
19
+ <linearGradient id="nibulaField" x1="0" y1="0" x2="0.6" y2="1">
20
+ <stop offset="0" stop-color="#3a2c63"/>
21
+ <stop offset="1" stop-color="#2a2150"/>
22
+ </linearGradient>
23
+ </defs>
24
+
25
+ <path fill="none" stroke="url(#nibulaShieldBorder)" stroke-width="10" stroke-linejoin="round"
26
+ d="M256 40 L440 132 L440 320 L256 472 L72 320 L72 132 Z"/>
27
+ <path fill="url(#nibulaField)" stroke="url(#nibulaShieldBorder)" stroke-width="6" stroke-linejoin="round"
28
+ d="M256 66 L418 147 L418 310 L256 442 L94 310 L94 147 Z"/>
29
+
30
+ <!-- N as one closed outline: up left post, down inner-left, diagonal to inner-bottom-right,
31
+ up right post, cut corner, down outer-right, close along the bottom -->
32
+ <path fill="url(#nibulaN)" stroke="#1a1533" stroke-width="7" stroke-linejoin="round"
33
+ d="M148 362
34
+ L148 150
35
+ L206 150
36
+ L312 300
37
+ L312 150
38
+ L370 150
39
+ L370 205
40
+ L340 205
41
+ L340 362
42
+ L282 362
43
+ L206 255
44
+ L206 362
45
+ Z"/>
46
+
47
+ <g stroke="#1a1533" stroke-width="7" stroke-linejoin="round" stroke-linecap="round">
48
+ <path fill="url(#nibulaNib)" d="M326 300 L382 300 L392 326 L336 326 Z"/>
49
+ <path fill="none" stroke-width="5" d="M338 313 L386 313"/>
50
+ <path fill="url(#nibulaNib)" d="M336 326 L392 326 L428 414 L370 380 Z"/>
51
+ <path fill="none" stroke-width="5" d="M366 342 L402 384"/>
52
+ <circle cx="376" cy="360" r="6.5" fill="#1a1533" stroke="none"/>
53
+ </g>
54
+ </svg>
@@ -1,54 +1,54 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" role="img" aria-label="Nibula">
2
- <defs>
3
- <linearGradient id="nibulaShieldBorder" x1="0" y1="0" x2="1" y2="1">
4
- <stop offset="0" stop-color="#8b6fc4"/>
5
- <stop offset="0.5" stop-color="#c9a06a"/>
6
- <stop offset="1" stop-color="#f2c17a"/>
7
- </linearGradient>
8
- <linearGradient id="nibulaN" x1="0" y1="1" x2="1" y2="0">
9
- <stop offset="0" stop-color="#6d4fa8"/>
10
- <stop offset="0.45" stop-color="#a978b0"/>
11
- <stop offset="0.75" stop-color="#e7a55f"/>
12
- <stop offset="1" stop-color="#f7d08a"/>
13
- </linearGradient>
14
- <linearGradient id="nibulaNib" x1="0" y1="0" x2="1" y2="1">
15
- <stop offset="0" stop-color="#f7d89a"/>
16
- <stop offset="0.55" stop-color="#e0a95f"/>
17
- <stop offset="1" stop-color="#b07d3e"/>
18
- </linearGradient>
19
- <linearGradient id="nibulaField" x1="0" y1="0" x2="0.6" y2="1">
20
- <stop offset="0" stop-color="#3a2c63"/>
21
- <stop offset="1" stop-color="#2a2150"/>
22
- </linearGradient>
23
- </defs>
24
-
25
- <path fill="none" stroke="url(#nibulaShieldBorder)" stroke-width="10" stroke-linejoin="round"
26
- d="M256 40 L440 132 L440 320 L256 472 L72 320 L72 132 Z"/>
27
- <path fill="url(#nibulaField)" stroke="url(#nibulaShieldBorder)" stroke-width="6" stroke-linejoin="round"
28
- d="M256 66 L418 147 L418 310 L256 442 L94 310 L94 147 Z"/>
29
-
30
- <!-- N as one closed outline: up left post, down inner-left, diagonal to inner-bottom-right,
31
- up right post, cut corner, down outer-right, close along the bottom -->
32
- <path fill="url(#nibulaN)" stroke="#1a1533" stroke-width="7" stroke-linejoin="round"
33
- d="M148 362
34
- L148 150
35
- L206 150
36
- L312 300
37
- L312 150
38
- L370 150
39
- L370 205
40
- L340 205
41
- L340 362
42
- L282 362
43
- L206 255
44
- L206 362
45
- Z"/>
46
-
47
- <g stroke="#1a1533" stroke-width="7" stroke-linejoin="round" stroke-linecap="round">
48
- <path fill="url(#nibulaNib)" d="M326 300 L382 300 L392 326 L336 326 Z"/>
49
- <path fill="none" stroke-width="5" d="M338 313 L386 313"/>
50
- <path fill="url(#nibulaNib)" d="M336 326 L392 326 L428 414 L370 380 Z"/>
51
- <path fill="none" stroke-width="5" d="M366 342 L402 384"/>
52
- <circle cx="376" cy="360" r="6.5" fill="#1a1533" stroke="none"/>
53
- </g>
54
- </svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" role="img" aria-label="Nibula">
2
+ <defs>
3
+ <linearGradient id="nibulaShieldBorder" x1="0" y1="0" x2="1" y2="1">
4
+ <stop offset="0" stop-color="#8b6fc4"/>
5
+ <stop offset="0.5" stop-color="#c9a06a"/>
6
+ <stop offset="1" stop-color="#f2c17a"/>
7
+ </linearGradient>
8
+ <linearGradient id="nibulaN" x1="0" y1="1" x2="1" y2="0">
9
+ <stop offset="0" stop-color="#6d4fa8"/>
10
+ <stop offset="0.45" stop-color="#a978b0"/>
11
+ <stop offset="0.75" stop-color="#e7a55f"/>
12
+ <stop offset="1" stop-color="#f7d08a"/>
13
+ </linearGradient>
14
+ <linearGradient id="nibulaNib" x1="0" y1="0" x2="1" y2="1">
15
+ <stop offset="0" stop-color="#f7d89a"/>
16
+ <stop offset="0.55" stop-color="#e0a95f"/>
17
+ <stop offset="1" stop-color="#b07d3e"/>
18
+ </linearGradient>
19
+ <linearGradient id="nibulaField" x1="0" y1="0" x2="0.6" y2="1">
20
+ <stop offset="0" stop-color="#3a2c63"/>
21
+ <stop offset="1" stop-color="#2a2150"/>
22
+ </linearGradient>
23
+ </defs>
24
+
25
+ <path fill="none" stroke="url(#nibulaShieldBorder)" stroke-width="10" stroke-linejoin="round"
26
+ d="M256 40 L440 132 L440 320 L256 472 L72 320 L72 132 Z"/>
27
+ <path fill="url(#nibulaField)" stroke="url(#nibulaShieldBorder)" stroke-width="6" stroke-linejoin="round"
28
+ d="M256 66 L418 147 L418 310 L256 442 L94 310 L94 147 Z"/>
29
+
30
+ <!-- N as one closed outline: up left post, down inner-left, diagonal to inner-bottom-right,
31
+ up right post, cut corner, down outer-right, close along the bottom -->
32
+ <path fill="url(#nibulaN)" stroke="#1a1533" stroke-width="7" stroke-linejoin="round"
33
+ d="M148 362
34
+ L148 150
35
+ L206 150
36
+ L312 300
37
+ L312 150
38
+ L370 150
39
+ L370 205
40
+ L340 205
41
+ L340 362
42
+ L282 362
43
+ L206 255
44
+ L206 362
45
+ Z"/>
46
+
47
+ <g stroke="#1a1533" stroke-width="7" stroke-linejoin="round" stroke-linecap="round">
48
+ <path fill="url(#nibulaNib)" d="M326 300 L382 300 L392 326 L336 326 Z"/>
49
+ <path fill="none" stroke-width="5" d="M338 313 L386 313"/>
50
+ <path fill="url(#nibulaNib)" d="M336 326 L392 326 L428 414 L370 380 Z"/>
51
+ <path fill="none" stroke-width="5" d="M366 342 L402 384"/>
52
+ <circle cx="376" cy="360" r="6.5" fill="#1a1533" stroke="none"/>
53
+ </g>
54
+ </svg>