T1ckbase commited on
Commit
e2c93e4
·
1 Parent(s): 067a4f4
Files changed (2) hide show
  1. generate-table.ts +2 -0
  2. main.ts +3 -2
generate-table.ts CHANGED
@@ -5,7 +5,9 @@ const baseUrl = 'https://t1ckbase-minesweeper.hf.space';
5
  const html = '<table id="toc">\n' +
6
  ' <tr>\n' +
7
  ' <td align="center">\n' +
 
8
  ` <a href="${baseUrl}/game/reset"><img src="${baseUrl}/game/status" width="48px" height="48px" /></a>\n` +
 
9
  ' </td>\n' +
10
  ' </tr>\n' +
11
  Array.from({ length: rows }, (_, r) =>
 
5
  const html = '<table id="toc">\n' +
6
  ' <tr>\n' +
7
  ' <td align="center">\n' +
8
+ ` <img src="${baseUrl}/mines/count" height="48px" />\n` +
9
  ` <a href="${baseUrl}/game/reset"><img src="${baseUrl}/game/status" width="48px" height="48px" /></a>\n` +
10
+ ` <img src="${baseUrl}/mines/count" height="48px" />\n` +
11
  ' </td>\n' +
12
  ' </tr>\n' +
13
  Array.from({ length: rows }, (_, r) =>
main.ts CHANGED
@@ -1,10 +1,9 @@
1
  import { Hono } from 'hono';
2
  // import { logger } from 'hono/logger';
 
3
  import { Minesweeper } from './minesweeper.ts';
4
  import { isGithubUserPath } from './utils.ts';
5
 
6
- // TODO: check header referer
7
-
8
  // https://t1ckbase-minesweeper.hf.space
9
 
10
  const USER = 'T1ckbase';
@@ -24,6 +23,8 @@ if (Deno.env.get('DENO_ENV') === 'development') {
24
  app.get('/board', (c) => c.text(minesweeper.getBoard().map((row) => row.map((cell) => cell.isMine ? 'b' : cell.adjacentMines).join('')).join('\n')));
25
  }
26
 
 
 
27
  app.get('/cell/:row/:col/image', (c) => {
28
  const row = Number(c.req.param('row'));
29
  const col = Number(c.req.param('col'));
 
1
  import { Hono } from 'hono';
2
  // import { logger } from 'hono/logger';
3
+ import { serveStatic } from 'hono/deno';
4
  import { Minesweeper } from './minesweeper.ts';
5
  import { isGithubUserPath } from './utils.ts';
6
 
 
 
7
  // https://t1ckbase-minesweeper.hf.space
8
 
9
  const USER = 'T1ckbase';
 
23
  app.get('/board', (c) => c.text(minesweeper.getBoard().map((row) => row.map((cell) => cell.isMine ? 'b' : cell.adjacentMines).join('')).join('\n')));
24
  }
25
 
26
+ app.use('/mines/count', serveStatic({ path: './images/counter.svg' }));
27
+
28
  app.get('/cell/:row/:col/image', (c) => {
29
  const row = Number(c.req.param('row'));
30
  const col = Number(c.req.param('col'));