Skip to content

Commit dd60831

Browse files
committed
.
Signed-off-by: Gil Desmarais <git@desmarais.de>
1 parent 4ef304b commit dd60831

File tree

7 files changed

+34
-67
lines changed

7 files changed

+34
-67
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ jobs:
7171
- name: Run frontend tests
7272
run: npm run test:ci
7373

74-
- name: Build frontend
75-
run: npm run build
76-
7774
docker-test:
7875
if: github.event_name == 'push'
7976
needs:

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,12 @@
4141
/frontend/.astro/
4242
/frontend/node_modules/
4343
/public/frontend
44+
45+
# Frontend generated files
46+
*.min.js
47+
*.min.css
48+
49+
# Frontend logs
50+
*.log
51+
4452
.yardoc

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ group :development do
2626
gem 'rack-unreloader'
2727
gem 'rake', require: false
2828
gem 'rubocop', require: false
29-
gem 'rubocop-md', require: false
3029
gem 'rubocop-performance', require: false
3130
gem 'rubocop-rake', require: false
3231
gem 'rubocop-rspec', require: false

Gemfile.lock

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,6 @@ GEM
179179
rubocop-ast (1.47.1)
180180
parser (>= 3.3.7.2)
181181
prism (~> 1.4)
182-
rubocop-md (2.0.2)
183-
lint_roller (~> 1.1)
184-
rubocop (>= 1.72.1)
185182
rubocop-performance (1.26.0)
186183
lint_roller (~> 1.1)
187184
rubocop (>= 1.75.0, < 2.0)
@@ -261,7 +258,6 @@ DEPENDENCIES
261258
roda
262259
rspec
263260
rubocop
264-
rubocop-md
265261
rubocop-performance
266262
rubocop-rake
267263
rubocop-rspec
@@ -346,7 +342,6 @@ CHECKSUMS
346342
rss (0.3.1) sha256=b46234c04551b925180f8bedfc6f6045bf2d9998417feda72f300e7980226737
347343
rubocop (1.81.1) sha256=352a9a6f314a4312f6c305f1f72bc466254d221c95445cd49e1b65d1f9411635
348344
rubocop-ast (1.47.1) sha256=592682017855408b046a8190689490763aecea175238232b1b526826349d01ae
349-
rubocop-md (2.0.2) sha256=98ca250d59dba381fe2c1ad71c60f5db7b6d8fa8a87cc274596beed75b1d85d6
350345
rubocop-performance (1.26.0) sha256=7bb0d9d9fb2ea122bf6f9a596dd7cf9dc93ab4950923d26c4ae4f328cef71ca9
351346
rubocop-rake (0.7.1) sha256=3797f2b6810c3e9df7376c26d5f44f3475eda59eb1adc38e6f62ecf027cbae4d
352347
rubocop-rspec (3.7.0) sha256=b7b214da112034db9c6d00f2d811a354847e870f7b6ed2482b29649c3d42058f

app.rb

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,21 @@ module Web
2727
##
2828
# Roda app serving RSS feeds via html2rss
2929
class App < Roda
30-
CONTENT_TYPE_RSS = 'application/xml'
30+
FALLBACK_HTML = <<~HTML
31+
<!DOCTYPE html>
32+
<html>
33+
<head>
34+
<title>html2rss-web</title>
35+
<meta name="viewport" content="width=device-width,initial-scale=1">
36+
<meta name="robots" content="noindex,nofollow">
37+
</head>
38+
<body>
39+
<h1>html2rss-web</h1>
40+
<p>Convert websites to RSS feeds</p>
41+
<p>API available at <code>/api/</code></p>
42+
</body>
43+
</html>
44+
HTML
3145

3246
def self.development? = EnvironmentValidator.development?
3347
def development? = self.class.development?
@@ -47,13 +61,18 @@ def development? = self.class.development?
4761
plugin :content_security_policy do |csp|
4862
csp.default_src :none
4963
csp.style_src :self, "'unsafe-inline'"
50-
csp.script_src :self, "'unsafe-inline'"
64+
csp.script_src :self
5165
csp.connect_src :self
5266
csp.img_src :self
53-
csp.font_src :self, 'data:'
67+
csp.font_src :self
5468
csp.form_action :self
5569
csp.base_uri :none
56-
csp.frame_ancestors development? ? ['http://localhost:*', 'https://localhost:*'] : :none
70+
if development?
71+
csp.frame_ancestors 'http://localhost:*', 'https://localhost:*',
72+
'http://127.0.0.1:*', 'https://127.0.0.1:*'
73+
else
74+
csp.frame_ancestors :none
75+
end
5776
csp.frame_src :self
5877
csp.object_src :none
5978
csp.media_src :none
@@ -85,11 +104,9 @@ def development? = self.class.development?
85104
plugin :error_handler do |error|
86105
next exception_page(error) if development?
87106

88-
# Simple error handling for production
89-
http_status = error.respond_to?(:status) ? error.status : 500
90107
error_code = error.respond_to?(:code) ? error.code : 'INTERNAL_SERVER_ERROR'
91108

92-
response.status = http_status
109+
response.status = error.respond_to?(:status) ? error.status : 500
93110

94111
if request.path.start_with?('/api/v1/')
95112
response['Content-Type'] = 'application/json'
@@ -124,25 +141,7 @@ def handle_feed_generation(router, feed_name)
124141
def render_index_page(router)
125142
index_path = 'public/frontend/index.html'
126143
router.response['Content-Type'] = 'text/html'
127-
File.exist?(index_path) ? File.read(index_path) : fallback_html
128-
end
129-
130-
def fallback_html
131-
<<~HTML
132-
<!DOCTYPE html>
133-
<html>
134-
<head>
135-
<title>html2rss-web</title>
136-
<meta name="viewport" content="width=device-width,initial-scale=1">
137-
<meta name="robots" content="noindex,nofollow">
138-
</head>
139-
<body>
140-
<h1>html2rss-web</h1>
141-
<p>Convert websites to RSS feeds</p>
142-
<p>API available at <code>/api/</code></p>
143-
</body>
144-
</html>
145-
HTML
144+
File.exist?(index_path) ? File.read(index_path) : FALLBACK_HTML
146145
end
147146
end
148147
end

app/routes/api_v1.rb

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ def call(router)
1212
mount_health(router)
1313
mount_strategies(router)
1414
mount_feeds(router)
15-
mount_docs(router)
1615
mount_root(router)
1716
end
1817
end
@@ -48,19 +47,6 @@ def mount_feeds(router)
4847
end
4948
end
5049

51-
def mount_docs(router)
52-
router.get 'docs' do
53-
docs_path = 'docs/api/v1/openapi.yaml'
54-
if File.exist?(docs_path)
55-
router.response['Content-Type'] = 'text/yaml'
56-
File.read(docs_path)
57-
else
58-
router.response.status = 404
59-
JSON.generate({ success: false, error: { message: 'Documentation not found' } })
60-
end
61-
end
62-
end
63-
6450
def mount_root(router)
6551
router.get do
6652
JSON.generate(success: true,

frontend/.prettierignore

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
# Dependencies
2-
node_modules/
3-
4-
# Build outputs
5-
dist/
6-
.astro/
7-
8-
# Generated files
9-
*.min.js
10-
*.min.css
11-
12-
# Package files
1+
# Frontend package files
132
package-lock.json
143
yarn.lock
15-
16-
# Test coverage
17-
coverage/
18-
19-
# Logs
20-
*.log

0 commit comments

Comments
 (0)