fix: add routes

This commit is contained in:
DIYgod
2024-03-09 03:24:53 +08:00
parent 45f9ea21fb
commit 76e7e8296b
1436 changed files with 7684 additions and 0 deletions

View File

@@ -31,6 +31,36 @@ export const route: Route = {
name: 'Transformation - JSON',
maintainers: ['ttttmr'],
handler,
description: `Specify options (in the format of query string) in parameter \`routeParams\` parameter to extract data from JSON.
| Key | Meaning | Accepted Values | Default |
| ------------- | ---------------------------------------- | --------------- | ------------------------------------------ |
| \`title\` | The title of the RSS | \`string\` | Extracted from home page of current domain |
| \`item\` | The JSON Path as \`item\` element | \`string\` | Entire JSON response |
| \`itemTitle\` | The JSON Path as \`title\` in \`item\` | \`string\` | None |
| \`itemLink\` | The JSON Path as \`link\` in \`item\` | \`string\` | None |
| \`itemDesc\` | The JSON Path as \`description\` in \`item\` | \`string\` | None |
| \`itemPubDate\` | The JSON Path as \`pubDate\` in \`item\` | \`string\` | None |
:::tip
JSON Path only supports format like \`a.b.c\`. if you need to access arrays, like \`a[0].b\`, you can write it as \`a.0.b\`.
:::
Parameters parsing in the above example:
| Parameter | Value |
| ------------- | ------------------------------------------------------------------------ |
| \`url\` | \`https://api.github.com/repos/ginuerzh/gost/releases\` |
| \`routeParams\` | \`title=Gost releases&itemTitle=tag_name&itemLink=html_url&itemDesc=body\` |
Parsing of \`routeParams\` parameter:
| Parameter | Value |
| ----------- | --------------- |
| \`title\` | \`Gost releases\` |
| \`itemTitle\` | \`tag_name\` |
| \`itemLink\` | \`html_url\` |
| \`itemDesc\` | \`body\` |`,
};
async function handler(ctx) {