0
0

Added Libreddit + created copy folder
Some checks failed
wolfree / build (push) Failing after 3m26s
simplytranslate / build (push) Failing after 6s
searxng / build-searxng-base (push) Successful in 5s
searxng / build-searxng (push) Successful in 1m3s
rat-aint-tieba / build (push) Failing after 11s
proxigram / build (push) Failing after 6s
priviblur / build (push) Failing after 4s
nitter / build (push) Failing after 4s
libreddit / build (push) Failing after 1h53m32s
imgin / build (push) Failing after 5s
binternet / build (push) Failing after 5s

This commit is contained in:
Opnxng 2023-12-16 16:52:42 +08:00
parent 5cf366e519
commit 53bea4c8aa
5 changed files with 155 additions and 2 deletions

View File

@ -0,0 +1,73 @@
name: libreddit
run-name: libreddit
env:
REPO_NAME: libreddit
REMOTE_REPO: https://github.com/libreddit/libreddit.git
BUILD_PLATFORM: linux/amd64
on:
schedule:
- cron: "0 0 * * *" # at midnight
push:
paths:
- ".gitea/workflows/libreddit.yaml"
jobs:
build:
runs-on: runner
container:
image: docker:cli
steps:
- name: Install packages
run: apk --no-cache add curl git jq
- name: Check latest upstream commit
run: |
STORED_COMMIT=$(curl -H "Authorization: Bearer ${{ secrets.NT }}" -s "https://nt.opnxng.com/${REPO_NAME}/raw?poll=1" | tail -n 1)
LATEST_COMMIT=$(git ls-remote ${REMOTE_REPO} | awk '{print $1}' | head -1)
echo "STORED_COMMIT=${STORED_COMMIT}" >> "$GITHUB_ENV"
echo "LATEST_COMMIT=${LATEST_COMMIT}" >> "$GITHUB_ENV"
echo "Stored Commit: ${STORED_COMMIT}"
echo "Latest Commit: ${LATEST_COMMIT}"
- name: Build and push Docker image
run: |
if [ "$STORED_COMMIT" != "$LATEST_COMMIT" ]; then
echo "Found a new commit, building new image"
# Install Docker Buildx
BUILDX_VERSION=$(wget -q -O- https://api.github.com/repos/docker/buildx/releases/latest | jq -r '.name')
wget -O /usr/bin/docker-buildx https://github.com/docker/buildx/releases/download/$BUILDX_VERSION/buildx-$BUILDX_VERSION.linux-arm64
chmod +x /usr/bin/docker-buildx
# Create and use Docker Buildx builder
docker-buildx create --use --name buildx
# Login to Package Registry
echo "${{ secrets.TOKEN }}" | docker login git.opnxng.com -u ${{ gitea.repository_owner }} --password-stdin
# Build and push Docker image
mkdir temp
cd temp
git clone ${REMOTE_REPO} .
curl -JL https://git.opnxng.com/opnxng/docker-images/raw/branch/main/copy/libreddit.base.html -o templates/base.html
docker-buildx build \
--platform ${BUILD_PLATFORM} \
-t git.opnxng.com/${{ gitea.repository_owner }}/${REPO_NAME}:latest \
-f ./Dockerfile \
--push . && \
curl -H prio:low -d "Built and pushed ${REPO_NAME}" https://ntfy.opnxng.com/build || \
{ curl -H tags:warning -H prio:high -d "Built and pushed ${REPO_NAME} failed!" https://ntfy.opnxng.com/build ; exit 1; }
# Remove Docker Buildx builder
docker-buildx rm buildx
else
echo "No new commit, skipped build"
fi
- name: Update stored commit
run: |
if [ "$STORED_COMMIT" != "$LATEST_COMMIT" ]; then
curl -H "Authorization: Bearer ${{ secrets.NT }}" -d $(git ls-remote ${REMOTE_REPO} | awk '{print $1}' | head -1) "https://nt.opnxng.com/${REPO_NAME}"
STORED_COMMIT=$(curl -H "Authorization: Bearer ${{ secrets.NT }}" -s "https://nt.opnxng.com/${REPO_NAME}/raw?poll=1" | tail -n 1)
echo "STORED_COMMIT=${STORED_COMMIT}" >> "$GITHUB_ENV"
else
curl -H "Authorization: Bearer ${{ secrets.NT }}" -d $(git ls-remote ${REMOTE_REPO} | awk '{print $1}' | head -1) "https://nt.opnxng.com/${REPO_NAME}"
STORED_COMMIT=$(curl -H "Authorization: Bearer ${{ secrets.NT }}" -s "https://nt.opnxng.com/${REPO_NAME}/raw?poll=1" | tail -n 1)
echo "STORED_COMMIT=${STORED_COMMIT}" >> "$GITHUB_ENV"
exit 1
fi

View File

@ -45,7 +45,7 @@ jobs:
mkdir temp mkdir temp
cd temp cd temp
git clone ${REMOTE_REPO} . git clone ${REMOTE_REPO} .
curl -JL https://git.opnxng.com/opnxng/docker-images/raw/branch/main/env/proxigram.env -o .env curl -JL https://git.opnxng.com/opnxng/docker-images/raw/branch/main/copy/proxigram.env -o .env
docker-buildx build \ docker-buildx build \
--platform ${BUILD_PLATFORM} \ --platform ${BUILD_PLATFORM} \
-t git.opnxng.com/${{ gitea.repository_owner }}/${REPO_NAME}:latest \ -t git.opnxng.com/${{ gitea.repository_owner }}/${REPO_NAME}:latest \

View File

@ -24,6 +24,7 @@ Source | Image
[ThePenguinDev/proxigram](https://codeberg.org/ThePenguinDev/proxigram) | opnxng/proxigram [ThePenguinDev/proxigram](https://codeberg.org/ThePenguinDev/proxigram) | opnxng/proxigram
[Bing Chilling/Rat Aint Tieba](https://0xacab.org/johnxina/rat) | opnxng/rat-aint-tieba [Bing Chilling/Rat Aint Tieba](https://0xacab.org/johnxina/rat) | opnxng/rat-aint-tieba
[syeopite/priviblur](https://github.com/syeopite/priviblur) | opnxng/priviblur [syeopite/priviblur](https://github.com/syeopite/priviblur) | opnxng/priviblur
[libreddit/libreddit](https://github.com/libreddit/libreddit) | opnxng/libreddit ([custom html](copy/libreddit.base.html))
[zyachel/quetre](https://github.com/zyachel/quetre) | [pussthecatorg/quetre](https://quay.io/repository/pussthecatorg/quetre?tab=tags&tag=latest) [zyachel/quetre](https://github.com/zyachel/quetre) | [pussthecatorg/quetre](https://quay.io/repository/pussthecatorg/quetre?tab=tags&tag=latest)
[zyachel/libremdb](https://github.com/zyachel/libremdb) | [pussthecatorg/libremdb](https://quay.io/repository/pussthecatorg/libremdb?tab=tags&tag=latest) [zyachel/libremdb](https://github.com/zyachel/libremdb) | [pussthecatorg/libremdb](https://quay.io/repository/pussthecatorg/libremdb?tab=tags&tag=latest)
[cadence/breezewiki](https://gitdab.com/cadence/breezewiki) | [pussthecatorg/breezewiki](https://quay.io/repository/pussthecatorg/breezewiki?tab=tags&tag=latest) [cadence/breezewiki](https://gitdab.com/cadence/breezewiki) | [pussthecatorg/breezewiki](https://quay.io/repository/pussthecatorg/breezewiki?tab=tags&tag=latest)
@ -38,7 +39,6 @@ Source | Image
[cinnyapp/cinny](https://github.com/cinnyapp/cinny) | cinnyapp/cinny [cinnyapp/cinny](https://github.com/cinnyapp/cinny) | cinnyapp/cinny
[Frooodle/Stirling-PDF](https://github.com/Frooodle/Stirling-PDF) | frooodle/s-pdf [Frooodle/Stirling-PDF](https://github.com/Frooodle/Stirling-PDF) | frooodle/s-pdf
[teddit/teddit](https://codeberg.org/teddit/teddit) | teddit/teddit [teddit/teddit](https://codeberg.org/teddit/teddit) | teddit/teddit
[libreddit/libreddit](https://github.com/libreddit/libreddit) | libreddit/libreddit
[caomingjun/warp-docker](https://github.com/cmj2002/warp-docker) | caomingjun/warp [caomingjun/warp-docker](https://github.com/cmj2002/warp-docker) | caomingjun/warp
[aeharding/voyager](https://github.com/aeharding/voyager) | aeharding/voyager [aeharding/voyager](https://github.com/aeharding/voyager) | aeharding/voyager
[rystaf/mlmym](https://github.com/rystaf/mlmym) | rystaf/mlmym [rystaf/mlmym](https://github.com/rystaf/mlmym) | rystaf/mlmym

80
copy/libreddit.base.html Normal file
View File

@ -0,0 +1,80 @@
{% import "utils.html" as utils %}
<!DOCTYPE html>
<html lang="en">
<head>
{% block head %}
<title>{% block title %}Libreddit{% endblock %}</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="description" content="View on Libreddit, an alternative private front-end to Reddit.">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- General PWA -->
<meta name="theme-color" content="#1F1F1F">
<!-- iOS Application -->
<meta name="apple-mobile-web-app-title" content="Libreddit">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<!-- Android -->
<meta name="mobile-web-app-capable" content="yes">
<!-- iOS Logo -->
<link href="/touch-icon-iphone.png" rel="apple-touch-icon">
<!-- PWA Manifest -->
<link rel="manifest" type="application/json" href="/manifest.json">
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
<link rel="stylesheet" type="text/css" href="/style.css?v={{ env!("CARGO_PKG_VERSION") }}">
{% endblock %}
</head>
<body class="
{% if prefs.layout != "" %}{{ prefs.layout }}{% endif %}
{% if prefs.wide == "on" %} wide{% endif %}
{% if prefs.theme != "system" %} {{ prefs.theme }}{% endif %}">
<!-- NAVIGATION BAR -->
<nav>
<div id="logo">
<a id="libreddit" href="/"><span id="lib">lib</span><span id="reddit">reddit.</span></a>
{% block subscriptions %}{% endblock %}
</div>
{% block search %}{% endblock %}
<div id="links">
<a id="reddit_link" {% if prefs.disable_visit_reddit_confirmation != "on" %}href="#popup"{% else %}href="https://www.reddit.com{{ url }}" rel="nofollow"{% endif %}>
<span>reddit</span>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M22 2L12 22"/>
<path d="M2 6.70587C3.33333 8.07884 3.33333 11.5971 3.33333 11.5971M3.33333 19.647V11.5971M3.33333 11.5971C3.33333 11.5971 5.125 7.47817 8 7.47817C10.875 7.47817 12 8.85114 12 8.85114"/>
</svg>
</a>
{% if prefs.disable_visit_reddit_confirmation != "on" %}
{% call utils::visit_reddit_confirmation(url) %}
{% endif %}
<a id="settings_link" href="/settings">
<span>settings</span>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<title>settings</title>
<circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/>
</svg>
</a>
</div>
</nav>
<!-- MAIN CONTENT -->
{% block body %}
<main>
{% block content %}
{% endblock %}
</main>
{% endblock %}
<!-- FOOTER -->
{% block footer %}
<footer>
<p id="version">v{{ env!("CARGO_PKG_VERSION") }}</p>
<div class="footer-button">
<a href="/info" title="View instance information">ⓘ View instance info</a>
</div>
<div class="footer-button">
<a href="https://github.com/libreddit/libreddit/issues/871#issuecomment-1856544584" target="_blank" style="color:#fbad41" title="Cloudflare">&#9888; Cloudflare</a>
</div>
</footer>
{% endblock %}
</body>
</html>