Skip to content

Commit e4da809

Browse files
committed
integrate astro
1 parent 8d01f8a commit e4da809

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2803
-789
lines changed

.github/workflows/frontend.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,33 @@ jobs:
5555
cache: "npm"
5656
cache-dependency-path: frontend/package-lock.json
5757

58+
- name: Setup Ruby
59+
uses: ruby/setup-ruby@v1
60+
with:
61+
bundler-cache: true
62+
5863
- name: Install dependencies
5964
run: |
6065
cd frontend
6166
npm ci
67+
cd ..
68+
bundle install
6269
6370
- name: Check for vulnerabilities
6471
run: |
6572
cd frontend
6673
npm audit --audit-level=moderate
6774
75+
- name: Run unit tests
76+
run: |
77+
cd frontend
78+
npm run test:unit
79+
80+
- name: Run integration tests
81+
run: |
82+
cd frontend
83+
npm run test:integration
84+
6885
- name: Build and verify
6986
run: |
7087
cd frontend

.github/workflows/test_build_push.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,22 @@ jobs:
3333
cache: "npm"
3434
cache-dependency-path: frontend/package-lock.json
3535

36-
- name: Install frontend dependencies
36+
- name: Setup Ruby
37+
uses: ruby/setup-ruby@v1
38+
with:
39+
bundler-cache: true
40+
41+
- name: Install dependencies
3742
run: |
3843
cd frontend
3944
npm ci
45+
cd ..
46+
bundle install
47+
48+
- name: Run frontend tests
49+
run: |
50+
cd frontend
51+
npm run test:ci
4052
4153
- name: Build frontend
4254
run: |

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ruby 3.4.1

.yardopts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--markup markdown
2+
--charset utf-8
3+
--exclude spec/
4+
--exclude tmp/
5+
--exclude log/
6+
--exclude public/
7+
--exclude config/
8+
--exclude bin/
9+
--exclude .devcontainer/
10+
--exclude .github/

CONFIGURATION.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Configuration Guide
2+
3+
## Environment Variables
4+
5+
### Auto Source Configuration
6+
7+
| Variable | Description | Default | Example |
8+
| ----------------------------- | -------------------------------------- | ----------------- | ----------------------------------------------------- |
9+
| `AUTO_SOURCE_ENABLED` | Enable auto source feature | `false` | `true` |
10+
| `AUTO_SOURCE_USERNAME` | Basic auth username | Required | `admin` |
11+
| `AUTO_SOURCE_PASSWORD` | Basic auth password | Required | `changeme` |
12+
| `AUTO_SOURCE_ALLOWED_ORIGINS` | Allowed request origins | Required | `localhost:3000,example.com` |
13+
| `AUTO_SOURCE_ALLOWED_URLS` | **URL whitelist for public instances** | `""` (allows all) | `https://github.com/*,https://news.ycombinator.com/*` |
14+
15+
### Health Check Configuration
16+
17+
| Variable | Description | Default | Example |
18+
| ----------------------- | --------------------- | -------------- | ---------- |
19+
| `HEALTH_CHECK_USERNAME` | Health check username | Auto-generated | `health` |
20+
| `HEALTH_CHECK_PASSWORD` | Health check password | Auto-generated | `changeme` |
21+
22+
### Ruby Integration
23+
24+
| Variable | Description | Default | Example |
25+
| ----------- | -------------------------- | ------- | --------------- |
26+
| `RUBY_PATH` | Path to Ruby executable | `ruby` | `/usr/bin/ruby` |
27+
| `APP_ROOT` | Application root directory | `.` | `/app` |
28+
29+
## URL Restriction Patterns
30+
31+
The `AUTO_SOURCE_ALLOWED_URLS` variable supports:
32+
33+
- **Exact URLs**: `https://example.com/news`
34+
- **Wildcard patterns**: `https://example.com/*` (matches any path)
35+
- **Domain patterns**: `https://*.example.com` (matches subdomains)
36+
- **Multiple patterns**: Comma-separated list
37+
38+
### Examples
39+
40+
```bash
41+
# Allow only specific sites
42+
AUTO_SOURCE_ALLOWED_URLS=https://github.com/*,https://news.ycombinator.com/*,https://example.com/news
43+
44+
# Allow all subdomains of a domain
45+
AUTO_SOURCE_ALLOWED_URLS=https://*.example.com/*
46+
47+
# Allow everything (for private instances)
48+
AUTO_SOURCE_ALLOWED_URLS=
49+
50+
# Block everything (disable auto source)
51+
AUTO_SOURCE_ENABLED=false
52+
```
53+
54+
## Security Considerations
55+
56+
### Public Instances
57+
- **Always set** `AUTO_SOURCE_ALLOWED_URLS` to restrict URLs
58+
- Use strong authentication credentials
59+
- Monitor usage and set up rate limiting
60+
- Consider IP whitelisting for additional security
61+
62+
### Private Instances
63+
- Leave `AUTO_SOURCE_ALLOWED_URLS` empty to allow all URLs
64+
- Still use authentication to prevent unauthorized access
65+
- Consider network-level restrictions
66+
67+
## Deployment Examples
68+
69+
### Public Demo Instance
70+
```bash
71+
AUTO_SOURCE_ENABLED=true
72+
AUTO_SOURCE_USERNAME=demo
73+
AUTO_SOURCE_PASSWORD=secure_password
74+
AUTO_SOURCE_ALLOWED_URLS=https://github.com/*,https://news.ycombinator.com/*,https://example.com/*
75+
```
76+
77+
### Private Instance
78+
```bash
79+
AUTO_SOURCE_ENABLED=true
80+
AUTO_SOURCE_USERNAME=admin
81+
AUTO_SOURCE_PASSWORD=very_secure_password
82+
AUTO_SOURCE_ALLOWED_URLS=
83+
```
84+
85+
### Disabled Auto Source
86+
```bash
87+
AUTO_SOURCE_ENABLED=false
88+
```

Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,21 @@ dev-ruby: ## Start Ruby server only
3030
dev-frontend: ## Start Astro dev server only
3131
@cd frontend && npm run dev
3232

33-
test: ## Run tests
33+
test: ## Run all tests (Ruby + Frontend)
3434
bundle exec rspec
35+
@cd frontend && npm run test:ci
36+
37+
test-ruby: ## Run Ruby tests only
38+
bundle exec rspec
39+
40+
test-frontend: ## Run frontend tests only
41+
@cd frontend && npm run test:ci
42+
43+
test-frontend-unit: ## Run frontend unit tests only
44+
@cd frontend && npm run test:unit
45+
46+
test-frontend-integration: ## Run frontend integration tests only
47+
@cd frontend && npm run test:integration
3548

3649
lint: ## Run linter
3750
bundle exec rubocop

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,25 @@ This web application scrapes websites to build and deliver RSS 2.0 feeds with a
1414
- **Pre-built Configs**: Comes with plenty of [included configs](https://html2rss.github.io/web-application/how-to/use-included-configs)
1515
- **Performance**: Handles request caching and sets caching-related HTTP headers
1616
- **Progressive Enhancement**: Works without JavaScript, enhanced with modern features
17+
- **Security**: URL restrictions, authentication, SSRF protection, and input validation
1718

1819
**Architecture:**
1920

2021
- **Backend**: Ruby + Roda for API and RSS generation
2122
- **Frontend**: Astro for modern, fast static site generation
2223
- **Core Engine**: [`html2rss`](https://github.com/html2rss/html2rss) Ruby gem for feed generation
2324

25+
## Configuration
26+
27+
The application can be configured using environment variables. See the [configuration guide](CONFIGURATION.md) for details.
28+
29+
### Security Features
30+
31+
- **URL Restrictions**: Public instances can restrict auto source to specific URLs
32+
- **Authentication**: Basic auth for auto source and health check endpoints
33+
- **SSRF Protection**: Built-in protection against Server-Side Request Forgery
34+
- **Input Validation**: Comprehensive validation of all inputs
35+
2436
## Documentation
2537

2638
For full documentation, please see the [html2rss-web documentation](https://html2rss.github.io/web-application/).

0 commit comments

Comments
 (0)