Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe53d2b3fd | ||
|
|
b340e3f47c | ||
| 785b4fe9a4 | |||
|
6ee1c556e3
|
|||
| b9386df233 | |||
|
56d01d9e96
|
|||
|
|
d79c23cde4 | ||
| 5427501364 | |||
|
eef6ac4ee0
|
|||
|
c2fc3fd316
|
|||
|
|
265c493349 | ||
| 63adf36866 | |||
|
89ba33378f
|
@@ -2,7 +2,14 @@
|
||||
"categories": [
|
||||
{
|
||||
"title": "## 🚀 Features",
|
||||
"labels": ["add","Add", "Kind/Feature"]
|
||||
"labels": [
|
||||
"add",
|
||||
"Add",
|
||||
"Kind/Feature",
|
||||
"feat",
|
||||
"Feature",
|
||||
"Feat"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "## 🐛 Fixes",
|
||||
@@ -18,16 +25,50 @@
|
||||
"labels": ["docs","Docs", "Kind/Documentation"]
|
||||
},
|
||||
{
|
||||
"title": "## 🧹 Chore",
|
||||
"labels": ["chore","Chore", "Kind/Chore"]
|
||||
"title": "## 🛠️ Maintenance",
|
||||
"labels": [
|
||||
"maintenance",
|
||||
"Maintenance",
|
||||
"Kind/Maintenance",
|
||||
"chore",
|
||||
"Chore",
|
||||
"Kind/Chore"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "## 🛠️ Maintenance",
|
||||
"labels": ["maintenance","Maintenance", "Kind/Maintenance"]
|
||||
"title": "## ⏪ Reverts",
|
||||
"labels": [
|
||||
"revert",
|
||||
"Revert",
|
||||
"Kind/Revert",
|
||||
"Kind/Reverts",
|
||||
"reverts",
|
||||
"Reverts"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "## 🗑️ Deprecation",
|
||||
"labels": ["deprecation","Deprecation", "Kind/Deprecation"]
|
||||
},
|
||||
{
|
||||
"title": "## ⚡️ Performance Improvements",
|
||||
"labels": [
|
||||
"perf",
|
||||
"Perf",
|
||||
"Kind/Performance"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "## 🎨 Styling",
|
||||
"labels": [
|
||||
"style",
|
||||
"Style",
|
||||
"Kind/Style"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "## 🎯 Other Changes",
|
||||
"labels": []
|
||||
}
|
||||
],
|
||||
"label_extractor": [
|
||||
|
||||
180
.gitea/workflows/release_with_commit_mode.yml
Normal file
180
.gitea/workflows/release_with_commit_mode.yml
Normal file
@@ -0,0 +1,180 @@
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
|
||||
github_release:
|
||||
description: 'Create Gitea Release'
|
||||
default: true
|
||||
type: boolean
|
||||
docker_release:
|
||||
description: 'Push Docker images'
|
||||
default: true
|
||||
type: boolean
|
||||
bump:
|
||||
description: 'Bump type'
|
||||
required: true
|
||||
default: 'patch'
|
||||
type: choice
|
||||
options:
|
||||
- 'major'
|
||||
- 'minor'
|
||||
- 'patch'
|
||||
|
||||
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@master
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ secrets.REGISTRY }}
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.TOKEN }}
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
- name: Set up Python
|
||||
run: uv python install
|
||||
with:
|
||||
python-version-file: "pyproject.toml"
|
||||
|
||||
- name: Install the project
|
||||
run: uv sync --all-extras --dev
|
||||
|
||||
- name: Create requirements.txt
|
||||
run: |
|
||||
echo "Creating requirements.txt"
|
||||
uv export --format requirements.txt -o requirements.txt
|
||||
echo "requirements.txt created"
|
||||
|
||||
- name: Set Git identity
|
||||
run: |
|
||||
git config user.name "Gitea CI"
|
||||
git config user.email "ci@git.theprivateserver.de"
|
||||
- name: Get Repository URL
|
||||
id: get_repo_url
|
||||
run: echo "REPO_URL=https://github.com/${{ github.repository }}" >> $GITHUB_OUTPUT
|
||||
|
||||
|
||||
- name: Build Changelog
|
||||
id: build_changelog
|
||||
uses: https://github.com/mikepenz/release-changelog-builder-action@v5
|
||||
with:
|
||||
platform: "gitea"
|
||||
mode: "COMMIT"
|
||||
baseURL: "http://gitea:3000"
|
||||
# configuration: ".gitea/changelog-config.json"
|
||||
configurationJSON: |
|
||||
{
|
||||
"template": "#{{CHANGELOG}}",
|
||||
"categories": [
|
||||
{
|
||||
"title": "## 🚀 Features",
|
||||
"labels": ["feat"]
|
||||
},
|
||||
{
|
||||
"title": "## 🐛 Fixes",
|
||||
"labels": ["fix", "bug"]
|
||||
},
|
||||
{
|
||||
"title": "## 🧹 Maintenance",
|
||||
"labels": ["chore", "refactor", "cleanup"]
|
||||
},
|
||||
{
|
||||
"title": "## 📦 Build",
|
||||
"labels": ["build", "ci"]
|
||||
},
|
||||
{
|
||||
"title": "## 📝 Documentation",
|
||||
"labels": ["docs"]
|
||||
},
|
||||
{
|
||||
"title": "## ⚡️ Performance Improvements",
|
||||
"labels": ["perf"]
|
||||
},
|
||||
{
|
||||
"title": "## 🧪 Tests",
|
||||
"labels": ["test"]
|
||||
},
|
||||
{
|
||||
"title": "## ⏪ Reverts",
|
||||
"labels": ["revert"]
|
||||
},
|
||||
{
|
||||
"title": "## 🎨 Styling",
|
||||
"labels": ["style"]
|
||||
},
|
||||
{
|
||||
"title": "## 🎯 Other Changes",
|
||||
"labels": ["other", "misc", "enhancement"]
|
||||
}
|
||||
],
|
||||
"label_extractor": [
|
||||
{
|
||||
"pattern": "^(build|chore|ci|docs|feat|fix|bug|perf|cleanup|refactor|revert|style|test){1}(\\([\\w\\-\\.]+\\))?(!)?: ([\\w ])+([\\s\\S]*)",
|
||||
"target": "$1"
|
||||
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
"empty_template": "- no changes",
|
||||
"pr_template": "- [#{{TITLE}}](${{ steps.get_repo_url.outputs.REPO_URL }}/commit/#{{MERGE_SHA}}) by @#{{AUTHOR}}"
|
||||
}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
|
||||
|
||||
- name: Bump version
|
||||
id: bump
|
||||
run: |
|
||||
uv tool install bump-my-version
|
||||
uv tool run bump-my-version bump ${{ github.event.inputs.bump }} --allow-dirty
|
||||
# echo the version to github env, the version is shown by using uv tool run bump-my-version show current_version
|
||||
echo "VERSION<<EOF" >> $GITHUB_ENV
|
||||
echo "$(uv tool run bump-my-version show current_version)" >> $GITHUB_ENV
|
||||
echo "EOF" >> $GITHUB_ENV
|
||||
- name: Check version
|
||||
run: echo ${{ env.VERSION }}
|
||||
- name: Build and store Docker image
|
||||
if: ${{ github.event.inputs.docker_release == 'true' }}
|
||||
run: |
|
||||
REPO_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
|
||||
docker buildx build \
|
||||
--platform linux/amd64 \
|
||||
--tag ${{ secrets.REGISTRY }}/${REPO_NAME}:latest \
|
||||
--tag ${{ secrets.REGISTRY }}/${REPO_NAME}:${{ env.VERSION }} \
|
||||
--push .
|
||||
- name: Push changes
|
||||
uses: ad-m/github-push-action@master
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branch: ${{ github.ref }}
|
||||
- name: Create release
|
||||
id: create_release
|
||||
if: ${{ github.event.inputs.github_release == 'true' }}
|
||||
uses: softprops/action-gh-release@master
|
||||
with:
|
||||
tag_name: v${{ env.VERSION }}
|
||||
release_name: Release ${{ env.VERSION }}
|
||||
body: ${{steps.build_changelog.outputs.changelog}}
|
||||
draft: false
|
||||
prerelease: false
|
||||
make_latest: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.TOKEN }}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "kompage"
|
||||
version = "0.1.1"
|
||||
version = "0.1.5"
|
||||
description = "Add your description here"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.13"
|
||||
@@ -28,7 +28,7 @@ url = "https://git.theprivateserver.de/api/packages/KomSuite/pypi/simple/"
|
||||
|
||||
|
||||
[tool.bumpversion]
|
||||
current_version = "0.1.1"
|
||||
current_version = "0.1.5"
|
||||
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
|
||||
serialize = ["{major}.{minor}.{patch}"]
|
||||
search = "{current_version}"
|
||||
|
||||
32
src/app.py
32
src/app.py
@@ -301,19 +301,20 @@ async def log_request():
|
||||
log.debug(f"Received request data: {data}")
|
||||
item = data.get("item")
|
||||
if item:
|
||||
data = await fetch_requested_data([item])
|
||||
# data = await fetch_requested_data([item])
|
||||
if not data:
|
||||
return jsonify({"status": "failed", "message": "Item not found"}), 404
|
||||
data = data[0]
|
||||
title = data.get("title")
|
||||
image_url = data.get("image")
|
||||
# data = data[0]
|
||||
manga_id = item.get("id")
|
||||
title = item.get("title")
|
||||
image_url = item.get("image")
|
||||
log.debug(
|
||||
f"Logging request for item: {item}, title: {title}, image_url: {image_url}"
|
||||
f"Logging request for item: {item}, title: {title}, image_url: {image_url}, manga_id: {manga_id}"
|
||||
)
|
||||
asynccache = KomCache()
|
||||
asynccache.insert(
|
||||
f"INSERT INTO manga_requests (manga_id, title, image) VALUES ({item}, '{title}', :image)",
|
||||
args={"image": image_url},
|
||||
f"INSERT INTO manga_requests (manga_id, title, image) VALUES (:manga_id, :title, :image)",
|
||||
args={"manga_id": manga_id, "title": title, "image": image_url},
|
||||
)
|
||||
return jsonify({"status": "success"})
|
||||
return jsonify({"status": "failed"}), 400
|
||||
@@ -324,7 +325,7 @@ async def requests_page():
|
||||
cache = KomCache()
|
||||
requests = (
|
||||
cache.fetch_all(
|
||||
query="SELECT manga_id, title, image grabbed FROM manga_requests"
|
||||
query="SELECT manga_id, title, image, grabbed FROM manga_requests"
|
||||
)
|
||||
or []
|
||||
)
|
||||
@@ -332,23 +333,26 @@ async def requests_page():
|
||||
req_ids = [req[0] for req in requests]
|
||||
if req_ids:
|
||||
entries = [
|
||||
{"manga_id": req[0], "title": req[1], "image": req[2]} for req in requests
|
||||
{"manga_id": req[0], "title": req[1], "image": req[2], "grabbed": req[3]}
|
||||
for req in requests
|
||||
]
|
||||
else:
|
||||
entries = []
|
||||
|
||||
log.debug(f"Fetched {len(entries)} requests from the database")
|
||||
log.debug(f"Requests entries: {entries}")
|
||||
return await render_template("requests.html", requests=entries)
|
||||
|
||||
@app.route("/delete", methods=["POST"])
|
||||
async def delete_request():
|
||||
# Delete a request from the database. ID is sent after the /delete endpoint, so: /delete/<id>
|
||||
data = await request.get_json()
|
||||
item_id = data.get("item")
|
||||
log.debug(f"Received delete request data: {data}")
|
||||
|
||||
if item_id:
|
||||
if data:
|
||||
title = data.get("title")
|
||||
asynccache = KomCache()
|
||||
asynccache.query(
|
||||
"DELETE FROM manga_requests WHERE manga_id = :id", args={"id": item_id}
|
||||
asynccache.delete(
|
||||
"DELETE FROM manga_requests WHERE title = :title", args={"title": title}
|
||||
)
|
||||
return jsonify({"status": "success"})
|
||||
return jsonify({"status": "failed"}), 400
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
{% if results %}
|
||||
{% for result in results %}
|
||||
|
||||
<div class="card {{ result.type | lower }} {% if result.in_komga %}komga{% else %}requested{% endif %}">
|
||||
<div class="card {{ result.type | lower }} {% if result.grabbed %}komga{% else %}requested{% endif %}">
|
||||
|
||||
<div class="image-container {{ 'nsfw' if result.isAdult else '' }}">
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
{% if requests %}
|
||||
<div class="results">
|
||||
{% for request in requests %}
|
||||
<div class="card {{ request.type | lower }} {% if request.in_komga %}komga{% else %}requested{% endif %}">
|
||||
<div class="card {{ request.type | lower }} {% if request.grabbed %}komga{% else %}requested{% endif %}">
|
||||
<div class="image-container {{ 'nsfw' if request.isAdult else '' }}">
|
||||
|
||||
<img src="{{ request.image }}" alt="Cover">
|
||||
@@ -56,7 +56,7 @@
|
||||
<p>{{ request.title }}</p>
|
||||
<div class="actions">
|
||||
<button onclick="showInfo({{ request | tojson | safe }})" class="info">Info</button>
|
||||
<button onclick="deleteEntry({{ request.id }})" class="delete-button">Delete</button>
|
||||
<button onclick="deleteEntry('{{ request.title | escape }}')" class="delete-button">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
@@ -111,10 +111,11 @@
|
||||
closeModal();
|
||||
}
|
||||
}
|
||||
function deleteEntry(entryId) {
|
||||
function deleteEntry(title) {
|
||||
console.log("Deleting entry with title:", title);
|
||||
fetch(`/delete`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ item: entryId }),
|
||||
body: JSON.stringify({ title: title }), // Send title as part of a JSON object
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user