-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(mastodon): rm mastodon api and renderer locally
- Loading branch information
Showing
17 changed files
with
403 additions
and
177 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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Fetch mastodon status | ||
|
||
on: | ||
# schedule: | ||
# - cron: "0 17 * * *" | ||
# watch: | ||
# types: [started] | ||
|
||
workflow_dispatch: | ||
repository_dispatch: | ||
types: [mastodon-update] | ||
|
||
jobs: | ||
mastodon: | ||
name: Fetch mastodon status | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
# 下载最新的 Mastodon | ||
- name: Download Mastodon Status | ||
run: | | ||
cd data/mastodon/ | ||
rm mastodon.json | ||
url="https://e5n.cc/api/v1/accounts/111136231674527355/statuses?limit=10&exclude_replies=true&exclude_reblogs=true" | ||
output="mastodon.json" | ||
curl -s "$url" >"$output" | ||
# 把修改后的数据提交到 GitHub 仓库 | ||
- name: Git Add and Commit | ||
uses: EndBug/add-and-commit@v9 | ||
with: | ||
message: 'chore(data): fetch mastodon status' | ||
add: | | ||
'./data/mastodon' | ||
# 调用另外的 GitHub Actions 构建 Hugo | ||
- name: Build Hugo and Deploy | ||
uses: peter-evans/repository-dispatch@v2 | ||
with: | ||
event-type: build-hugo |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,74 @@ | ||
{{- define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end -}} | ||
|
||
{{- define "content" -}} | ||
{{- $params := .Scratch.Get "params" -}} | ||
{{- $toc := $params.toc -}} | ||
{{- if eq $toc true -}} | ||
{{- $toc = .Site.Params.page.toc | default dict -}} | ||
{{- else if eq $toc false -}} | ||
{{- $toc = dict "enable" false -}} | ||
{{- end -}} | ||
|
||
<link rel="stylesheet" href="/assets/toot/mastodon-timeline.min.css?v=3.9.1-3.10.4"> | ||
<link rel="stylesheet" href="/assets/toot/mastodon-timeline-custom.min.css?v=2023.10.16"> | ||
|
||
<article class="page single special"> | ||
<h1 class="single-title animate__animated animate__pulse animate__faster">{{ .Title }}</h1> | ||
<div id="content" class="content"> | ||
<div class="greyQuote"> | ||
<blockquote> | ||
<div class="hitokoto"> | ||
<span id="hitokoto"></span> - <cite><span id="author"></span></cite> | ||
</div> | ||
</blockquote> | ||
</div> | ||
<div class="dummy-container"> | ||
<div class="mt-timeline"> | ||
<div id="mt-body" class="mt-body" role="feed"> | ||
<div class="loading-spinner"></div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</article> | ||
|
||
<script> | ||
// Hitokoto API | ||
if (window.location.href.includes("/en/")) { | ||
fetch("https://api.github.com/zen") | ||
.then(response => response.text()) | ||
.then(data => { | ||
const zen = document.querySelector('#hitokoto'); | ||
zen.innerText = data; | ||
const author = document.querySelector('#author'); | ||
author.innerText = "GitHub Zen"; | ||
}) | ||
.catch(console.error); | ||
} else { | ||
// fetch("https://api.eallion.com/hitokoto?c=k&charset=utf-8&encode=json") | ||
fetch("https://api.eallion.com/poisonous.json") | ||
.then(response => response.json()) | ||
.then(data => { | ||
const hitokoto = document.querySelector('#hitokoto'); | ||
// hitokoto.innerText = data.hitokoto; | ||
hitokoto.innerText = data.content; | ||
const author = document.querySelector('#author'); | ||
author.innerText = '佚名'; | ||
}) | ||
.catch(console.error); | ||
} | ||
</script> | ||
|
||
<script type="text/javascript" src="/assets/toot/moment.min.js?v=2.29.4"></script> | ||
|
||
{{ if eq .Site.LanguageCode "en" }} | ||
<script type="text/javascript" src="/assets/toot/moment.twitter.en.min.js"></script> | ||
{{ else }} | ||
<script type="text/javascript" src="/assets/toot/moment.twitter.min.js"></script> | ||
{{ end }} | ||
|
||
<script type="text/javascript" src="/assets/toot/mastodon-timeline.min.js?v=3.9.1-3.10.4"></script> | ||
|
||
<!-- <script type="module" src="/assets/toot/reactions.min.js?v=1.0.11"></script> --> | ||
|
||
{{- end -}} |
Oops, something went wrong.