Skip to content

Commit

Permalink
Update xtemplate
Browse files Browse the repository at this point in the history
  • Loading branch information
infogulch committed Apr 12, 2024
1 parent 541d2c6 commit 8229622
Show file tree
Hide file tree
Showing 12 changed files with 1,557 additions and 381 deletions.
60 changes: 60 additions & 0 deletions Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
http_port 8080
https_port 8443
debug

order authenticate before respond
order authorize before basicauth
order xrss last

security {
oauth identity provider github {env.GITHUB_CLIENT_ID} {env.GITHUB_CLIENT_SECRET}

authentication portal myportal {
crypto default token lifetime 3600
crypto key sign-verify {env.JWT_SHARED_KEY}
cookie domain apps.localhost
enable identity provider github
ui {
links {
"My Identity" "/whoami" icon "las la-user"
}
}

transform user {
match realm github
action add role authp/user
ui link "XRss" https://xrss.apps.localhost:8443/ icon "las la-star"
}

transform user {
match realm github
match sub github.com/infogulch
action add role authp/admin
}
}

authorization policy mypolicy {
set auth url https://auth.apps.localhost:8443/oauth2/github
crypto key verify {env.JWT_SHARED_KEY}
allow roles authp/admin authp/user
validate bearer header
inject headers with claims
}
}
}

(tls_config) {
tls {$HOME}/.local/caddy/server.crt {$HOME}/.local/caddy/server.key
}

auth.apps.localhost {
import tls_config
authenticate with myportal
}

xrss.apps.localhost {
import tls_config
authorize with mypolicy
xrss
}
40 changes: 14 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,28 @@
# About
# xrss

This is a web-based rss reader built on top of
[caddy-xtemplate](https://github.com/infogulch/caddy-xtemplate), a php-like
hypertext preprocessor with Go html/template syntax, integrated into Caddy a
world-class web server.

Notable Features

* UI built with tailwindcss.js
* Adaptive UI suitable for small screens
* Add feeds
* Show items from all feeds or just selected feed (sometimes)
* Uses [gofeed](github.com/mmcdole/gofeed) feed reader library

Future

* Maybe eventually update feeds
* Read status, filter by read status
* Sort options
* Scrape item links; display full article content inline
* Multiple users
xrss is a web-based rss reader built with
[xtemplate](https://github.com/infogulch/xtemplate).

![screenshot](screenshot.png)

## Developing

```shell
# build:
GOFLAGS='-tags="sqlite_json"' CGO_ENABLED=1 go build -o xrss
GOFLAGS='-tags="sqlite_json"' CGO_ENABLED=1 xcaddy build --with github.com/infogulch/xrss=. --with github.com/infogulch/xtemplate=../xtemplate --with github.com/greenpau/caddy-security

# run:
./xrss --context-path context --db-driver sqlite3 --db-connstr 'file:rss.sqlite?_journal=WAL&_synchronous=NORMAL&_foreign_keys=true&_vacuum=full'

tailwindcss -i static/main.css -o static/site.css --content './templates/**/*' -w
(. .env; ./caddy run)
```

### Nats schema

feed.<feed_id>.total_items: {count:int}
user.<user_id>.sub.<feed_id>.total_items: {count:int}
user.<user_id>.sub.<feed_id>.seen_items: {count:int}
user.<user_id>.sub.<feed_id>.item.<item_id>.seen: {at:date}

feed.<feed_id>.item.<item_id> ?

## Resources

https://hurl.dev/docs/hurl-file.html
Expand Down
229 changes: 0 additions & 229 deletions context/schema.sql

This file was deleted.

Loading

0 comments on commit 8229622

Please sign in to comment.