chore: feeds
This commit is contained in:
parent
1e106320c1
commit
d32e976329
8 changed files with 25 additions and 14090 deletions
22
.github/workflows/scheduled-post.yaml
vendored
22
.github/workflows/scheduled-post.yaml
vendored
|
@ -1,22 +0,0 @@
|
|||
name: Scheduled follow feed to Mastodon
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 */2 * * *'
|
||||
jobs:
|
||||
JSONFeed2Mastodon:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Feed to Mastodon
|
||||
uses: nhoizey/github-action-feed-to-mastodon@v2
|
||||
with:
|
||||
feedUrl: "https://coryd.dev/feeds/all.json"
|
||||
mastodonInstance: "https://social.lol"
|
||||
mastodonToken: ${{ secrets.MASTODON_TOKEN }}
|
||||
globalDelayToots: 0
|
||||
- name: Pull any changes from Git
|
||||
run: git pull
|
||||
- name: Commit and push
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
|
@ -1,6 +1,6 @@
|
|||
# coryd.dev
|
||||
|
||||
[](https://app.netlify.com/sites/cdme/deploys) [](https://github.com/cdransf/coryd.dev/actions/workflows/scheduled-build.yaml) [](https://github.com/cdransf/coryd.dev/actions/workflows/scheduled-post.yaml)
|
||||
[](https://app.netlify.com/sites/cdme/deploys) [](https://github.com/cdransf/coryd.dev/actions/workflows/scheduled-build.yaml)
|
||||
|
||||
Hi! I'm Cory. 👋🏻
|
||||
|
||||
|
|
3
cache/jsonfeed-to-mastodon-timestamp.json
vendored
3
cache/jsonfeed-to-mastodon-timestamp.json
vendored
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"timestamp": 1717704246101
|
||||
}
|
14053
cache/jsonfeed-to-mastodon.json
vendored
14053
cache/jsonfeed-to-mastodon.json
vendored
File diff suppressed because it is too large
Load diff
|
@ -76,7 +76,7 @@ export const allContent = (collection) => {
|
|||
items.forEach(item => {
|
||||
const content = {
|
||||
url: `${BASE_URL}${item['url']}`,
|
||||
title: `${icon}: ${getTitle(item)}${item?.['authors']?.['name'] ? ' via ' + item['authors']['name'] : ''}${item?.['tags'] ? ' ' + tagsToHashtags(item['tags']) : ''}`
|
||||
title: `${icon}: ${getTitle(item)}${item?.['authors']?.['name'] ? ' via ' + item['authors']['name'] : ''}${item?.['tags']?.length > 0 ? ' ' + tagsToHashtags(item['tags']) : ''}`
|
||||
}
|
||||
if (item?.['link']) content['url'] = item?.['link']
|
||||
if (item?.['slug']) content['url'] = new URL(item['slug'], BASE_URL).toString()
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
import { createRequire } from 'module'
|
||||
|
||||
const require = createRequire(import.meta.url)
|
||||
const mastodonCache = require('../../cache/jsonfeed-to-mastodon.json')
|
||||
|
||||
export default async function () {
|
||||
return mastodonCache
|
||||
}
|
|
@ -6,6 +6,20 @@ const SUPABASE_KEY = process.env.SUPABASE_KEY
|
|||
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
|
||||
const PAGE_SIZE = 1000
|
||||
|
||||
const fetchTagsForMovie = async (movieId) => {
|
||||
const { data, error } = await supabase
|
||||
.from('movies_tags')
|
||||
.select('tags(id, name)')
|
||||
.eq('movies_id', movieId)
|
||||
|
||||
if (error) {
|
||||
console.error(`Error fetching tags for movie ${movieId}:`, error)
|
||||
return []
|
||||
}
|
||||
|
||||
return data.map(mt => mt.tags.name)
|
||||
}
|
||||
|
||||
const fetchAllMovies = async () => {
|
||||
let movies = []
|
||||
let rangeStart = 0
|
||||
|
@ -14,6 +28,7 @@ const fetchAllMovies = async () => {
|
|||
const { data, error } = await supabase
|
||||
.from('movies')
|
||||
.select(`
|
||||
id,
|
||||
tmdb_id,
|
||||
slug,
|
||||
last_watched,
|
||||
|
@ -34,6 +49,10 @@ const fetchAllMovies = async () => {
|
|||
break
|
||||
}
|
||||
|
||||
for (const movie of data) {
|
||||
movie.tags = await fetchTagsForMovie(movie.id)
|
||||
}
|
||||
|
||||
movies = movies.concat(data)
|
||||
|
||||
if (data.length < PAGE_SIZE) break
|
||||
|
@ -62,8 +81,10 @@ export default async function () {
|
|||
description: item['description'],
|
||||
review: item['review'],
|
||||
id: item['tmdb_id'],
|
||||
type: 'movie'
|
||||
type: 'movie',
|
||||
tags: item['tags']
|
||||
}
|
||||
|
||||
return movie
|
||||
}).filter(movie => watched ? movie['lastWatched'] : !movie['lastWatched'])
|
||||
const favoriteMovies = movies.filter(movie => movie['favorite'])
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
"id": "{{ entry.url | btoa }}",
|
||||
"title": "{{ entry.title | replaceQuotes }}",
|
||||
"url": "{{ entry.url }}",
|
||||
"content_text": "{{ entry.title | replaceQuotes }} {{ entry.url }}",
|
||||
"content_text": "{{ entry.excerpt | replaceQuotes }}",
|
||||
"date_published": "{{ entry.date | stringToRFC822Date }}"
|
||||
}{% if not forloop.last %},{% endif %}
|
||||
{%- endfor %}
|
||||
|
|
Reference in a new issue