Skip to content

Commit

Permalink
Merge pull request #1369 from DIYgod/master
Browse files Browse the repository at this point in the history
[pull] master from diygod:master
  • Loading branch information
pull[bot] authored Apr 30, 2024
2 parents 2667596 + ee4c525 commit fbce0af
Show file tree
Hide file tree
Showing 28 changed files with 1,302 additions and 394 deletions.
64 changes: 64 additions & 0 deletions lib/routes/chub/characters.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { Route } from '@/types';
import ofetch from '@/utils/ofetch';
import { parseDate } from '@/utils/parse-date';

export const route: Route = {
path: '/characters',
categories: ['new-media'],
example: '/chub/characters',
name: 'Characters',
maintainers: ['flameleaf'],
handler,
};

async function handler() {
const hostURL = 'https://www.chub.ai/characters';
const apiURL = 'https://api.chub.ai/api/characters/search';
const data = await ofetch(apiURL, {
headers: { Accept: 'application/json' },
query: {
query: '',
first: 200,
page: 1,
sort: 'last_activity_at',
asc: 'false',
include_forks: 'false',
nsfw: 'true',
nsfl: 'true',
nsfw_only: 'false',
require_images: 'false',
require_example_dialogues: 'false',
require_alternate_greetings: 'false',
require_custom_prompt: 'false',
exclude_mine: 'false',
venus: 'true',
chub: 'true',
min_tokens: 50,
require_expressions: 'false',
require_lore: 'false',
mine_first: 'false',
require_lore_embedded: 'false',
require_lore_linked: 'false',
inclusive_or: 'false',
recommended_verified: 'false',
},
});
const nodes = data.nodes;

return {
allowEmpty: true,
title: 'Chub',
link: hostURL,
item: nodes.map((item) => ({
title: item.name,
description: `${item.tagline}<br><br>${item.description}`,
pubDate: parseDate(item.createdAt),
updated: parseDate(item.lastActivityAt),
link: `${hostURL}/${item.fullPath}`,
author: String(item.fullPath.split('/', 1)),
enclosure_url: item.avatar_url,
enclosure_type: `image/webp`,
category: item.topics,
})),
};
}
6 changes: 6 additions & 0 deletions lib/routes/chub/namespace.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { Namespace } from '@/types';

export const namespace: Namespace = {
name: 'Chub',
url: 'chub.ai',
};
11 changes: 0 additions & 11 deletions lib/routes/daily/discussed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,10 @@ const graphqlQuery = {

export const route: Route = {
path: '/discussed',
categories: ['social-media'],
example: '/daily/discussed',
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['daily.dev/popular'],
target: '',
},
],
name: 'Most Discussed',
Expand Down
4 changes: 2 additions & 2 deletions lib/routes/daily/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ const graphqlQuery = {

export const route: Route = {
path: '/',
example: '/daily',
radar: [
{
source: ['daily.dev/popular'],
target: '',
},
],
name: 'Unknown',
name: 'Popular',
maintainers: ['Rjnishant530'],
handler,
url: 'daily.dev/popular',
Expand Down
1 change: 1 addition & 0 deletions lib/routes/daily/namespace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ import type { Namespace } from '@/types';
export const namespace: Namespace = {
name: 'Daily.dev',
url: 'daily.dev',
categories: ['social-media'],
};
7 changes: 7 additions & 0 deletions lib/routes/daily/templates/posts.art
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{ if image }}
<img src="{{ image }}"><br>
{{ /if }}

{{ if content }}
{{@ content }}
{{ /if }}
21 changes: 5 additions & 16 deletions lib/routes/daily/upvoted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ const query = `
...FeedPostConnection
}
}
fragment FeedPostConnection on PostConnection {
edges {
node {
...FeedPost
}
}
}
fragment FeedPost on Post {
...SharedPostInfo
}
fragment SharedPostInfo on Post {
id
title
Expand All @@ -44,7 +44,7 @@ const query = `
}
tags
}
fragment UserShortInfo on User {
id
name
Expand All @@ -53,7 +53,7 @@ const query = `
username
bio
}
`;

const graphqlQuery = {
Expand All @@ -63,21 +63,10 @@ const graphqlQuery = {

export const route: Route = {
path: '/upvoted',
categories: ['social-media'],
example: '/daily/upvoted',
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['daily.dev/popular'],
target: '',
},
],
name: 'Most upvoted',
Expand Down
Loading

0 comments on commit fbce0af

Please sign in to comment.