~repos /website

#astro#js#html#css

git clone https://pyrossh.dev/repos/website.git
Discussions: https://groups.google.com/g/rust-embed-devs

木 Personal website of pyrossh. Built with astrojs, shiki, vite.


8b7a0766 pyrossh

2 months ago
add files back
deploy.sh CHANGED
@@ -1,7 +1,5 @@
1
1
  rm -rf dist
2
- git stash
3
2
  bun run build
4
- git stash pop
5
3
  aws s3 sync --delete ./dist/ s3://pyrossh-website
6
4
  cd infra && terraform validate && terraform plan && terraform apply -auto-approve
7
5
  aws cloudfront create-invalidation --distribution-id E2KFT51L97LWA1 --paths "/*" --no-cli-pager
ec.config.mjs CHANGED
@@ -4,6 +4,30 @@ import { pluginColorChips } from 'expressive-code-color-chips';
4
4
  export default defineEcConfig({
5
5
  plugins: [pluginColorChips()],
6
6
  // themes: [],
7
+ shiki: {
8
+ langAlias: {
9
+ h: 'c',
10
+ ino: 'c',
11
+ mm: 'c',
12
+ plum: 'txt',
13
+ mi: 'txt',
14
+ scm: 'txt',
15
+ podspec: 'txt',
16
+ lock: 'txt',
17
+ xcconfig: 'txt',
18
+ plist: 'xml',
19
+ xcworkspacedata: 'xml',
20
+ xcsettings: 'xml',
21
+ storyboard: 'txt',
22
+ pbxproj: 'txt',
23
+ mjs: 'javascript',
24
+ snap: 'javascript',
25
+ gradle: 'groovy',
26
+ class: 'java',
27
+ mod: 'go',
28
+ sum: 'go',
29
+ },
30
+ },
7
31
  styleOverrides: {
8
32
  codeFontSize: '0.8rem',
9
33
  uiFontSize: '0.8rem',
src/layouts/Repo.astro CHANGED
@@ -7,6 +7,7 @@ type Props = Pick<CollectionEntry<"repos">, "data">;
7
7
  const {
8
8
  data: { title, description, tags, badges },
9
9
  } = Astro.props;
10
+ const { pathname } = Astro.url;
10
11
  ---
11
12
 
12
13
  <Layout title={title} description={description}>
@@ -43,15 +44,31 @@ const {
43
44
  <hr />
44
45
  <div class="nav">
45
46
  <div>
47
+ <a
48
+ aria-current={pathname == `/repos/${title}` ? "true" : "false"}
46
- <a href={`/repos/${title}`}>Readme</a>
49
+ href={`/repos/${title}`}
50
+ >
51
+ Readme
52
+ </a>
47
53
  </div>
48
54
  <div>|</div>
49
55
  <div>
56
+ <a
57
+ aria-current={pathname.includes("/commits") ? "true" : "false"}
50
- <a href={`/repos/${title}/commits`}>Commits</a>
58
+ href={`/repos/${title}/commits`}
59
+ >
60
+ Commits
61
+ </a>
51
62
  </div>
52
63
  <div>|</div>
53
64
  <div>
65
+ <a
66
+ aria-current={pathname.includes("/files") ? "true" : "false"}
67
+ class="nav-link"
54
- <a class="nav-link" href={`/repos/${title}/files`}>Files</a>
68
+ href={`/repos/${title}/files`}
69
+ >
70
+ Files
71
+ </a>
55
72
  </div>
56
73
  </div>
57
74
  </div>
@@ -147,6 +164,11 @@ const {
147
164
  padding-right: 0.5rem;
148
165
  color: #3395ff;
149
166
  cursor: pointer;
167
+
168
+ &[aria-current="true"] {
169
+ text-underline-offset: 4px;
170
+ text-decoration: underline;
171
+ }
150
172
  }
151
173
  }
152
174
 
src/pages/repos/[...slug]/files/[...file]/index.astro CHANGED
@@ -35,7 +35,7 @@ const ext = path.extname(file.name).replace(".", "");
35
35
 
36
36
  <RepoLayout data={repo.data}>
37
37
  {
38
- ["png", "jpg", "jpeg", "gif", "svg"].includes(ext) ? (
38
+ ["png", "jpg", "jpeg", "gif", "svg", "webp", "ico", "icns", "curve", 'atlas'].includes(ext) ? (
39
39
  <div>
40
40
  <h1>{name}</h1>
41
41
  <img
@@ -46,11 +46,15 @@ const ext = path.extname(file.name).replace(".", "");
46
46
  ) : (
47
47
  <div>
48
48
  <div class="name blob">{name}</div>
49
+ {['apk', 'dex', 'ap_', 'jar', 'fnt'].includes(ext) || file.size > 512000 ? ( // Ignore files larger than 512KB
50
+ <p>The file is too large to be displayed ({file.size} bytes).</p>
51
+ ) : (
49
- <Code
52
+ <Code
50
- code={Buffer.from(contentBuffer).toString("utf-8")}
53
+ code={Buffer.from(contentBuffer).toString("utf-8") || 'No content to display.'}
51
- lang={ext}
54
+ lang={ext || 'txt'}
52
- wrap
55
+ wrap
53
- />
56
+ />
57
+ )}
54
58
  </div>
55
59
  )
56
60
  }