~repos /website
git clone https://pyrossh.dev/repos/website.git
木 Personal website of pyrossh. Built with astrojs, shiki, vite.
d2f26681
—
pyrossh 1 month ago
update zips
- infra/main.tf +14 -13
- src/pages/repos/[...slug]/index.astro +4 -5
infra/main.tf
CHANGED
|
@@ -57,6 +57,14 @@ resource "aws_s3_bucket_public_access_block" "website_bucket_public_access" {
|
|
|
57
57
|
restrict_public_buckets = true
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
resource "aws_s3_bucket_public_access_block" "repos_bucket_public_access" {
|
|
61
|
+
bucket = aws_s3_bucket.repos_bucket.id
|
|
62
|
+
block_public_acls = true
|
|
63
|
+
block_public_policy = true
|
|
64
|
+
ignore_public_acls = true
|
|
65
|
+
restrict_public_buckets = true
|
|
66
|
+
}
|
|
67
|
+
|
|
60
68
|
resource "aws_cloudfront_origin_access_control" "s3_oac" {
|
|
61
69
|
name = "s3-oac"
|
|
62
70
|
origin_access_control_origin_type = "s3"
|
|
@@ -168,23 +176,16 @@ resource "aws_cloudfront_function" "zip_redirector" {
|
|
|
168
176
|
CODE
|
|
169
177
|
}
|
|
170
178
|
|
|
171
|
-
resource "aws_cloudfront_function" "
|
|
179
|
+
resource "aws_cloudfront_function" "git_redirector" {
|
|
172
|
-
name = "
|
|
180
|
+
name = "git_redirector"
|
|
173
181
|
runtime = "cloudfront-js-2.0"
|
|
174
182
|
publish = true
|
|
175
183
|
code = <<CODE
|
|
176
184
|
function handler(event) {
|
|
177
185
|
const request = event.request;
|
|
178
186
|
const uri = request.uri;
|
|
179
|
-
|
|
180
|
-
if (uri.endsWith('.bundle')) {
|
|
181
|
-
|
|
187
|
+
request.uri = "/" + request.uri.replace("/repos/", "");
|
|
182
|
-
|
|
188
|
+
return request;
|
|
183
|
-
}
|
|
184
|
-
return {
|
|
185
|
-
statusCode: 404,
|
|
186
|
-
statusDescription: 'Not Found',
|
|
187
|
-
};
|
|
188
189
|
}
|
|
189
190
|
CODE
|
|
190
191
|
}
|
|
@@ -215,7 +216,7 @@ resource "aws_cloudfront_distribution" "s3_distribution" {
|
|
|
215
216
|
}
|
|
216
217
|
|
|
217
218
|
ordered_cache_behavior {
|
|
218
|
-
path_pattern = "/repos/*.
|
|
219
|
+
path_pattern = "/repos/*.git/*"
|
|
219
220
|
allowed_methods = ["GET", "HEAD"]
|
|
220
221
|
cached_methods = ["GET", "HEAD"]
|
|
221
222
|
target_origin_id = aws_s3_bucket.repos_bucket.bucket_regional_domain_name
|
|
@@ -234,7 +235,7 @@ resource "aws_cloudfront_distribution" "s3_distribution" {
|
|
|
234
235
|
viewer_protocol_policy = "redirect-to-https"
|
|
235
236
|
function_association {
|
|
236
237
|
event_type = "viewer-request"
|
|
237
|
-
function_arn = aws_cloudfront_function.
|
|
238
|
+
function_arn = aws_cloudfront_function.git_redirector.arn
|
|
238
239
|
}
|
|
239
240
|
}
|
|
240
241
|
|
src/pages/repos/[...slug]/index.astro
CHANGED
|
@@ -28,20 +28,18 @@ const { Content } = await render(Astro.props);
|
|
|
28
28
|
<hr />
|
|
29
29
|
<div class={styles.headerExtension}>
|
|
30
30
|
<h2 class=".expand">{description}</h2>
|
|
31
|
-
<!-- <h2>git@pyrossh.dev:~repos/website.git</h2> -->
|
|
32
31
|
</div>
|
|
33
32
|
<div class={styles.info}>
|
|
34
33
|
<h3>
|
|
35
34
|
git clone
|
|
36
|
-
<a href={`https://pyrossh
|
|
35
|
+
<a href={`https://pyrossh.dev/repos/${title}.git`}>
|
|
37
|
-
|
|
36
|
+
https://pyrossh.dev/repos/{title}.git
|
|
38
37
|
</a>
|
|
39
38
|
</h3>
|
|
40
39
|
<h3>
|
|
41
40
|
wget
|
|
42
41
|
<a href={`https://pyrossh.dev/repos/${title}.zip`}>
|
|
43
42
|
https://pyrossh.dev/repos/{title}.zip
|
|
44
|
-
<!-- https://pyrossh-repos.s3.ap-south-1.amazonaws.com/rp2350/refs/heads/master/repo.zip -->
|
|
45
43
|
</a>
|
|
46
44
|
</h3>
|
|
47
45
|
</div>
|
|
@@ -66,7 +64,8 @@ const { Content } = await render(Astro.props);
|
|
|
66
64
|
font-size: 1.1rem;
|
|
67
65
|
margin-top: 1rem;
|
|
68
66
|
|
|
67
|
+
h1,
|
|
69
|
-
|
|
68
|
+
h2 {
|
|
70
69
|
font-size: 1.5rem;
|
|
71
70
|
font-weight: 700;
|
|
72
71
|
margin-top: 0.5rem;
|