diff --git a/.github/README.md b/.github/README.md index 1f688e2..cdf14ff 100644 --- a/.github/README.md +++ b/.github/README.md @@ -33,13 +33,17 @@ OPML Generator has 2 ways to convert TOML to OPML. git clone https://github.com/5ouma/opml-generator.git ``` -3. Run Deno Task +3. Set the environment variables if you prefer + + > [🌍 Environment Variables](#-environment-variables) + +4. Run Deno Task ```shell deno task gen ``` -4. Outputs are stored in the `outputs` directory separated by `lists` +5. Outputs are stored in the `outputs` directory separated by `lists`
@@ -50,23 +54,31 @@ OPML Generator has 2 ways to convert TOML to OPML. - includes [`feeds.toml`](./assets/example/feeds.toml) - for outputs -2. Create [a Personal Access Token] with the `Gist` permission +2. [Fork this repository](https://github.com/5ouma/opml-generator/fork) -3. [Fork this repository](https://github.com/5ouma/opml-generator/fork) +3. Add Actions secrets + from `Settings > Secrets and variables | Actions` in the sidebar -4. Add Actions secrets - from `Settings > Secrets and variables | Actions` in the sidebar: + > [🌍 Environment Variables](#-environment-variables) - - `TOML_GIST_ID`: Gist ID for [`feeds.toml`](./assets/example/feeds.toml) - - `OPML_GIST_ID`: Gist ID for outputs - - `TOKEN`: Personal Access Token - -5. Enable GitHub Actions by checking `Allow all actions and reusable workflows` +4. Enable GitHub Actions by checking `Allow all actions and reusable workflows` from `Settings > Actions | General` in the sidebar 🎉 Automatically update every 0 a.m. UTC -[a Personal Access Token]: https://github.com/settings/tokens +

+ +## 🌍 Environment Variables + +| Name | Description | GitHub Actions only | +| :-------------: | :------------------------: | :-----------------: | +| `TOML_GIST_ID` | Gist ID for [`feeds.toml`] | true | +| `OPML_GIST_ID` | Gist ID for outputs | true | +| `TOKEN` | [Personal Access Token] | true | +| `NITTER_DOMAIN` | Nitter RSS domain | false | + +[`feeds.toml`]: ./assets/example/feeds.toml +[Personal Access Token]: https://github.com/settings/tokens/new?description=OPML%20Generator&scopes=gist

diff --git a/.github/assets/example/feeds.toml b/.github/assets/example/feeds.toml index 211bee9..ece1064 100644 --- a/.github/assets/example/feeds.toml +++ b/.github/assets/example/feeds.toml @@ -17,6 +17,10 @@ title = "bluesky" type = "bluesky" id = "username" [[lists.feeds]] +title = "nitter" +type = "nitter" +id = "example tweet search" +[[lists.feeds]] title = "note" type = "note" id = "username" @@ -28,3 +32,7 @@ id = "subreddit-name" title = "sizu.me" type = "sizu.me" id = "username" +[[lists.feeds]] +title = "zenn" +type = "zenn" +id = "username" diff --git a/.github/workflows/deps-update.yml b/.github/workflows/deps-update.yml index b52f7b2..a9c1e0a 100644 --- a/.github/workflows/deps-update.yml +++ b/.github/workflows/deps-update.yml @@ -26,3 +26,4 @@ jobs: base: dev branch: deps-deno commit-prefix: "chore(deps):" + labels: diff --git a/.github/workflows/gist-update.yml b/.github/workflows/gist-update.yml index f4a138c..9592f6d 100644 --- a/.github/workflows/gist-update.yml +++ b/.github/workflows/gist-update.yml @@ -14,7 +14,7 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: 🦕 Setup Deno - uses: denoland/setup-deno@041b854f97b325bd60e53e9dc2de9cb9f9ac0cba # v1.1.4 + uses: denoland/setup-deno@f99b7edee36540f7183c45aad62fbb93d6d41d9d # v1.2.0 with: deno-version: v1.x diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b1721c2..f0896b4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,7 +24,7 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: 🦕 Setup Deno - uses: denoland/setup-deno@041b854f97b325bd60e53e9dc2de9cb9f9ac0cba # v1.1.4 + uses: denoland/setup-deno@f99b7edee36540f7183c45aad62fbb93d6d41d9d # v1.2.0 with: deno-version: v1.x diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 34b98b8..ed61237 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,7 +23,7 @@ repos: args: [--whitespaces-count, "2"] - repo: https://github.com/crate-ci/typos - rev: v1.22.7 + rev: v1.22.9 hooks: - id: typos diff --git a/deno.json b/deno.json index a0e958c..0649aea 100644 --- a/deno.json +++ b/deno.json @@ -3,8 +3,8 @@ "fmt": { "exclude": ["LICENSE", ".github/**/*.md"] }, "test": { "include": ["src/", "test/"] }, "tasks": { - "gen": "deno run --allow-read --allow-write ./src/main.ts", - "test": "deno test --allow-read --allow-write --parallel --shuffle", + "gen": "deno run --allow-env --allow-read --allow-write ./src/main.ts", + "test": "deno test --allow-env --allow-read --allow-write --parallel --shuffle", "cov": "deno task test --coverage && deno coverage --lcov > coverage.lcov" }, "imports": { @@ -15,6 +15,7 @@ "@std/cli": "jsr:@std/cli@0.224.6", "@std/path": "jsr:@std/path@0.225.2", "@std/toml": "jsr:@std/toml@0.224.1", + "@std/url": "jsr:@std/url@0.224.1", "@wok/case": "jsr:@wok/case@1.0.1" } } diff --git a/deno.lock b/deno.lock index c5035fd..350466f 100644 --- a/deno.lock +++ b/deno.lock @@ -10,7 +10,9 @@ "jsr:@std/collections@^1.0.0-rc.1": "jsr:@std/collections@1.0.0-rc.1", "jsr:@std/internal@^1.0.0": "jsr:@std/internal@1.0.0", "jsr:@std/path@0.225.2": "jsr:@std/path@0.225.2", + "jsr:@std/path@1.0.0-rc.1": "jsr:@std/path@1.0.0-rc.1", "jsr:@std/toml@0.224.1": "jsr:@std/toml@0.224.1", + "jsr:@std/url@0.224.1": "jsr:@std/url@0.224.1", "jsr:@wok/case@1.0.1": "jsr:@wok/case@1.0.1" }, "jsr": { @@ -44,12 +46,21 @@ "jsr:@std/assert@^0.226.0" ] }, + "@std/path@1.0.0-rc.1": { + "integrity": "b8c00ae2f19106a6bb7cbf1ab9be52aa70de1605daeb2dbdc4f87a7cbaf10ff6" + }, "@std/toml@0.224.1": { "integrity": "c364b9ca3b18207223c4e2a1f652ef2970ff80967f7575ddf89b6b0565a17148", "dependencies": [ "jsr:@std/collections@^1.0.0-rc.1" ] }, + "@std/url@0.224.1": { + "integrity": "19f0e1c6ff8fc2ef9522a746595c24f53be47425daa910eb8ef39cbb5e00b3df", + "dependencies": [ + "jsr:@std/path@1.0.0-rc.1" + ] + }, "@wok/case@1.0.1": { "integrity": "409e94f961f5b278992bace87a0c7d3c6a3db516d01759bdb827d9ae4d75e9aa" } @@ -63,6 +74,7 @@ "jsr:@std/cli@0.224.6", "jsr:@std/path@0.225.2", "jsr:@std/toml@0.224.1", + "jsr:@std/url@0.224.1", "jsr:@wok/case@1.0.1" ] } diff --git a/src/libs/sites.ts b/src/libs/sites.ts index b64b5cf..ddf9581 100644 --- a/src/libs/sites.ts +++ b/src/libs/sites.ts @@ -1,10 +1,19 @@ +import { join } from "@std/url"; import type { site } from "@5ouma/opml-generator/types"; const sites: site[] = [ { type: "bluesky", url: new URL("https://bsky.app/profile/{id}/rss") }, + { + type: "nitter", + url: join( + new URL(`https://${Deno.env.get("NITTER_DOMAIN") ?? "cdn.xcancel.com"}`), + "/search/rss?f=tweets&q={id}", + ), + }, { type: "note", url: new URL("https://note.com/{id}/rss") }, { type: "reddit", url: new URL("https://www.reddit.com/r/{id}/.rss") }, { type: "sizu.me", url: new URL("https://sizu.me/{id}/rss") }, + { type: "zenn", url: new URL("https://zenn.dev/{id}/feed") }, ]; export function transcodeXmlUrl( @@ -19,5 +28,7 @@ export function transcodeXmlUrl( .find((site: site) => site.type === type)?.url; if (!url) throw new Error(`site not found: "${type}" of "${title}"`); - return new URL(url.href.replace(encodeURI("{id}"), id)); + return new URL( + url.href.replace(encodeURI("{id}"), id).replaceAll("%3F", "?"), + ); }