~repos /website

#astro#js#html#css

git clone https://pyrossh.dev/repos/website.git

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


b51aa369 pyrossh

1 month ago
update file href
astro.config.mjs CHANGED
@@ -7,7 +7,7 @@ import expressiveCode from 'astro-expressive-code';
7
7
  // https://astro.build/config
8
8
  export default defineConfig({
9
9
  site: 'https://pyrossh.dev',
10
- trailingSlash: 'never',
10
+ trailingSlash: 'ignore',
11
11
  output: 'static',
12
12
  integrations: [icon(), sitemap(), expressiveCode()],
13
13
  experimental: {
infra/main.tf CHANGED
@@ -28,15 +28,6 @@ provider "aws" {
28
28
  }
29
29
  }
30
30
 
31
- # locals {
32
- # # Read the content of the JSON file
33
- # json_content = file("${path.module}/data.json")
34
-
35
- # # Decode the JSON string into a Terraform object
36
- # config = jsondecode(local.json_content)
37
- # }
38
-
39
-
40
31
  resource "aws_route53_zone" "main" {
41
32
  name = "pyrossh.dev"
42
33
  }
@@ -155,27 +146,6 @@ resource "aws_cloudfront_function" "html_redirector" {
155
146
  CODE
156
147
  }
157
148
 
158
- resource "aws_cloudfront_function" "zip_redirector" {
159
- name = "zip_redirector"
160
- runtime = "cloudfront-js-2.0"
161
- publish = true
162
- code = <<CODE
163
- function handler(event) {
164
- const request = event.request;
165
- const uri = request.uri;
166
-
167
- if (uri.endsWith('.zip')) {
168
- request.uri = "/" + request.uri.replace("/repos/", "").replace(".zip", "") + "/refs/heads/master/repo.zip"
169
- return request;
170
- }
171
- return {
172
- statusCode: 404,
173
- statusDescription: 'Not Found',
174
- };
175
- }
176
- CODE
177
- }
178
-
179
149
  resource "aws_cloudfront_function" "git_redirector" {
180
150
  name = "git_redirector"
181
151
  runtime = "cloudfront-js-2.0"
@@ -239,30 +209,6 @@ resource "aws_cloudfront_distribution" "s3_distribution" {
239
209
  }
240
210
  }
241
211
 
242
- ordered_cache_behavior {
243
- path_pattern = "/repos/*.zip"
244
- allowed_methods = ["GET", "HEAD"]
245
- cached_methods = ["GET", "HEAD"]
246
- target_origin_id = aws_s3_bucket.repos_bucket.bucket_regional_domain_name
247
-
248
- forwarded_values {
249
- query_string = false
250
- cookies {
251
- forward = "none"
252
- }
253
- }
254
-
255
- min_ttl = 0
256
- default_ttl = 86400
257
- max_ttl = 31536000
258
- compress = true
259
- viewer_protocol_policy = "redirect-to-https"
260
- function_association {
261
- event_type = "viewer-request"
262
- function_arn = aws_cloudfront_function.zip_redirector.arn
263
- }
264
- }
265
-
266
212
  ordered_cache_behavior {
267
213
  path_pattern = "/*"
268
214
  allowed_methods = ["GET", "HEAD"]
src/pages/repos/[...slug]/files/index.astro CHANGED
@@ -12,7 +12,7 @@ export async function getStaticPaths() {
12
12
  }
13
13
  type Props = CollectionEntry<"repos">;
14
14
  const {
15
- data: { title, description, files, tags, badges },
15
+ data: { title, files },
16
16
  } = Astro.props;
17
17
  ---
18
18
 
@@ -26,7 +26,7 @@ const {
26
26
  <span title="100644">-rw-r--r--</span>
27
27
  </div>
28
28
  <div class="name">
29
- <a href={`/repos/${title}/files/${file.name}`} rel="nofollow">
29
+ <a href={`/repos/${title}/files/${file.name}/`} rel="nofollow">
30
30
  {file.name}
31
31
  </a>
32
32
  </div>