-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(site): Choose site from a list for ease
Users don't need to write a full URL for enumerated sites.
- Loading branch information
Showing
7 changed files
with
50 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
feeds.toml | ||
outputs/ | ||
/coverage | ||
/coverage.lcov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { site } from "../types/mod.ts"; | ||
|
||
const sites: site[] = [ | ||
{ type: "bluesky", url: new URL("https://bsky.app/profile/{id}/rss") }, | ||
{ 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") }, | ||
]; | ||
|
||
export function transcodeXmlUrl(type: string, rssUrl?: URL, id?: string): URL { | ||
if (type === "rss") { | ||
return new URL(rssUrl as URL); | ||
} else { | ||
const url: URL = sites.find((site: site) => site.type === type)?.url as URL; | ||
return new URL(url.href.replace(encodeURI("{id}"), id as string)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from "./opml.ts"; | ||
export * from "./toml.ts"; | ||
export * from "./sites.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export type site = { | ||
type: string; | ||
url: URL; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters