colonynote 1.0.0-beta.5 → 1.0.0-beta.7

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.
package/bin/colonynote.js CHANGED
@@ -110,6 +110,24 @@ async function main() {
110
110
  return new Response(content, { headers: { 'Content-Type': contentType } })
111
111
  })
112
112
 
113
+ app.get('/logo.png', async (c) => {
114
+ const fullPath = join(publicDir, 'logo.png')
115
+ if (!existsSync(fullPath)) {
116
+ return c.notFound()
117
+ }
118
+ const content = readFileSync(fullPath)
119
+ return new Response(content, { headers: { 'Content-Type': 'image/png' } })
120
+ })
121
+
122
+ app.get('/favicon.ico', async (c) => {
123
+ const fullPath = join(publicDir, 'favicon.ico')
124
+ if (!existsSync(fullPath)) {
125
+ return c.notFound()
126
+ }
127
+ const content = readFileSync(fullPath)
128
+ return new Response(content, { headers: { 'Content-Type': 'image/x-icon' } })
129
+ })
130
+
113
131
  app.get('*', async (c) => {
114
132
  const indexPath = join(publicDir, 'index.html')
115
133
  if (existsSync(indexPath)) {
@@ -3,7 +3,6 @@
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <link rel="icon" type="image/x-icon" href="/favicon.ico" />
6
- <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
7
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
8
7
  <title>ColonyNote</title>
9
8
  <script>
@@ -7,6 +7,9 @@ import { setupWatcher } from './watcher.js';
7
7
  import { WebSocketServer, WebSocket } from 'ws';
8
8
  import fs from 'fs';
9
9
  import path from 'path';
10
+ import { fileURLToPath } from 'url';
11
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
12
+ const clientDir = path.join(__dirname, '..', 'client');
10
13
  async function main() {
11
14
  const config = await loadConfig();
12
15
  const app = new Hono();
@@ -15,7 +18,7 @@ async function main() {
15
18
  app.route('/api/files', fileRouter);
16
19
  app.get('/assets/*', async (c) => {
17
20
  const filePath = c.req.path.replace('/assets', '');
18
- const fullPath = path.join(new URL('../client/assets', import.meta.url).pathname, filePath);
21
+ const fullPath = path.join(clientDir, 'assets', filePath);
19
22
  try {
20
23
  const content = fs.readFileSync(fullPath);
21
24
  const ext = path.extname(filePath);
@@ -26,8 +29,28 @@ async function main() {
26
29
  return c.notFound();
27
30
  }
28
31
  });
32
+ app.get('/logo.png', async (c) => {
33
+ const fullPath = path.join(clientDir, 'logo.png');
34
+ try {
35
+ const content = fs.readFileSync(fullPath);
36
+ return new Response(content, { headers: { 'Content-Type': 'image/png' } });
37
+ }
38
+ catch {
39
+ return c.notFound();
40
+ }
41
+ });
42
+ app.get('/favicon.ico', async (c) => {
43
+ const fullPath = path.join(clientDir, 'favicon.ico');
44
+ try {
45
+ const content = fs.readFileSync(fullPath);
46
+ return new Response(content, { headers: { 'Content-Type': 'image/x-icon' } });
47
+ }
48
+ catch {
49
+ return c.notFound();
50
+ }
51
+ });
29
52
  app.get('*', async (c) => {
30
- const indexPath = path.join(new URL('../client', import.meta.url).pathname, 'index.html');
53
+ const indexPath = path.join(clientDir, 'index.html');
31
54
  try {
32
55
  const content = fs.readFileSync(indexPath, 'utf-8');
33
56
  return new Response(content, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "colonynote",
3
- "version": "1.0.0-beta.5",
3
+ "version": "1.0.0-beta.7",
4
4
  "engines": {
5
5
  "node": ">=18"
6
6
  },