initial commit

This commit is contained in:
2025-10-29 19:26:50 +01:00
commit 105c1d3099
34 changed files with 687 additions and 0 deletions

233
.gitignore vendored Normal file
View File

@@ -0,0 +1,233 @@
# ---> Python
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
# ---> Qt
# C++ objects and libs
*.slo
*.lo
*.o
*.a
*.la
*.lai
*.so
*.so.*
*.dll
*.dylib
# Qt-es
object_script.*.Release
object_script.*.Debug
*_plugin_import.cpp
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.moc
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
*.qmlc
*.jsc
Makefile*
*build-*
*.qm
*.prl
# Qt unit tests
target_wrapper.*
# QtCreator
*.autosave
# QtCreator Qml
*.qmlproject.user
*.qmlproject.user.*
# QtCreator CMake
CMakeLists.txt.user*
# QtCreator 4.8< compilation database
compile_commands.json
# QtCreator local machine specific files for imported projects
*creator.user*
*_qmlcache.qrc
.history
depend
output/output/LOGtoJSON.exe
.pytest_cache
output
docs/
config.yaml
**/tempCodeRunnerFile.py
.history
.venv
venv
*.log

1
.python-version Normal file
View File

@@ -0,0 +1 @@
3.13

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 WorldTeacher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

0
README.md Normal file
View File

6
main.py Normal file
View File

@@ -0,0 +1,6 @@
def main():
print("Hello from komsuite-web!")
if __name__ == "__main__":
main()

1
packages/KomCache Submodule

Submodule packages/KomCache added at 4e0a19c973

1
packages/KomConfig Submodule

Submodule packages/KomConfig added at 674e9f9fd5

1
packages/KomGrabber Submodule

Submodule packages/KomGrabber added at 4d0d412d38

1
packages/KomPage Submodule

Submodule packages/KomPage added at 4ae996bfd6

View File

View File

@@ -0,0 +1,53 @@
// This is the background script for the extension
console.log('Background script running');
// Listen for messages from the content script
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
if (message.action === 'search') {
const query = message.query;
const apiUrl = `http://127.0.0.1:5001/api/search?q=${encodeURIComponent(query)}`; // Add the http:// protocol to the URL
console.log(`Searching for: ${query}`);
fetch(apiUrl)
.then(response => response.json())
.then(data => {
const results = data.results || [];
console.log('Search results:', results);
sendResponse({ results });
// Send the results to the popup
chrome.runtime.sendMessage({ action: 'displayResults', results });
})
.catch(error => {
console.error('Error fetching search results:', error);
sendResponse({ results: [] });
});
// Return true to indicate that the response will be sent asynchronously
return true;
}
});
// Periodically check the active tab's URL every 0.5 seconds
setInterval(() => {
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
if (tabs.length > 0) {
const activeTab = tabs[0];
const url = new URL(activeTab.url);
const hostname = url.hostname;
// List of supported sites
const supportedSites = [
'mangadex.org',
'anilist.co',
'kitsu.app',
'myanimelist.net'
];
if (supportedSites.includes(hostname)) {
console.log(`Sending addLens message to content script for hostname: ${hostname}`);
chrome.tabs.sendMessage(activeTab.id, { action: 'addLens', hostname });
}
}
});
}, 500);

View File

@@ -0,0 +1,84 @@
// Detect the active site and add a magnifying lens in the appropriate location
const siteHandlers = {
'mangadex.org': () => {
const headers = document.querySelectorAll('div.title p.mb-1'); // Select the text inside p.mb-1 within div.title
headers.forEach(header => addLens(header));
},
'anilist.co': () => {
const headers = document.querySelectorAll('.header-title');
headers.forEach(header => addLens(header));
},
'kitsu.app': () => {
const headers = document.querySelectorAll('section.media--title h3'); // Select the text inside h3 within section.media--title
headers.forEach(header => addLens(header));
},
'myanimelist.net': () => {
const headers = document.querySelectorAll('.title-name');
headers.forEach(header => addLens(header));
}
};
function addLens(header) {
// Check if the lens is already present
if (header.querySelector('span.lens-icon')) {
return; // Exit if the lens is already added
}
const lens = document.createElement('span');
lens.textContent = '🔍';
lens.className = 'lens-icon'; // Add a class to identify the lens
lens.style.cursor = 'pointer';
lens.style.marginLeft = '10px';
lens.title = 'Search for this title?'; // Add a tooltip to the lens
lens.addEventListener('click', () => {
const query = header.textContent.trim().replace('🔍', '').trim(); // Remove the lens icon from the query
console.log(`Searching for title: ${query}`);
chrome.runtime.sendMessage({ action: 'search', query }, (response) => {
if (response && response.results) {
displayResults(response.results);
}
});
});
header.appendChild(lens);
}
function displayResults(results) {
const resultWindow = document.createElement('div');
resultWindow.style.position = 'fixed';
resultWindow.style.top = '10px';
resultWindow.style.right = '10px';
resultWindow.style.backgroundColor = 'white';
resultWindow.style.border = '1px solid black';
resultWindow.style.padding = '10px';
resultWindow.style.zIndex = '10000';
resultWindow.style.maxHeight = '400px';
resultWindow.style.overflowY = 'auto'; // Make the result window scrollable
// Ensure results are displayed as titles
resultWindow.innerHTML = results.map(r => `<p>${r.title || 'No title available'}</p>`).join('');
// Remove any existing result window before appending a new one
const existingWindow = document.querySelector('.result-window');
if (existingWindow) {
existingWindow.remove();
}
resultWindow.className = 'result-window';
document.body.appendChild(resultWindow);
}
// Execute the handler for the current site immediately on page load
const hostname = window.location.hostname;
if (siteHandlers[hostname]) {
siteHandlers[hostname]();
}
// Listen for messages from the background script
chrome.runtime.onMessage.addListener((message) => {
if (message.action === 'addLens') {
const hostname = message.hostname;
if (siteHandlers[hostname]) {
siteHandlers[hostname]();
}
}
});

View File

View File

@@ -0,0 +1,25 @@
{
"manifest_version": 2,
"name": "KomSearcher",
"version": "1.0",
"description": "A Firefox extension used to request manga from various sites.",
"permissions": ["activeTab", "tabs"],
"background": {
"scripts": ["background.js"]
},
"browser_action": {
"default_icon": "icon.png",
"default_title": "KomSearcher"
},
"content_scripts": [
{
"matches": [
"https://mangadex.org/*",
"https://anilist.co/*",
"https://kitsu.app/*",
"https://myanimelist.net/*"
],
"js": ["content.js"]
}
]
}

View File

@@ -0,0 +1,62 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Search Results</title>
<style>
body {
font-family: Arial, sans-serif;
padding: 10px;
max-height: 400px;
overflow-y: auto; /* Make the popup scrollable */
}
.result {
margin-bottom: 10px;
}
</style>
</head>
<body>
<h1>Search Results</h1>
<div id="results"></div>
<script>
// Helper function to calculate similarity between two strings
function calculateSimilarity(searchTitle, resultTitle) {
const searchWords = searchTitle.toLowerCase().split(/\s+/);
const resultWords = resultTitle.toLowerCase().split(/\s+/);
const commonWords = searchWords.filter(word => resultWords.includes(word));
return (commonWords.length / Math.max(searchWords.length, resultWords.length)) * 100;
}
// This script will populate the results dynamically
chrome.runtime.onMessage.addListener((message) => {
if (message.action === 'displayResults' && message.results) {
const resultsDiv = document.getElementById('results');
const searchTitle = message.searchTitle || '';
// Sort results by similarity
const sortedResults = message.results.map(result => {
const similarity = calculateSimilarity(searchTitle, result.title || '');
return { ...result, similarity };
}).sort((a, b) => b.similarity - a.similarity);
// Render results
resultsDiv.innerHTML = sortedResults.map(result => {
const similarity = result.similarity.toFixed(2);
return `
<div class='result'>
<div style="position: relative;">
<span style="position: absolute; top: 0; left: 0; background: #007bff; color: white; padding: 2px 5px; border-radius: 3px; font-size: 12px;">${similarity}%</span>
</div>
<h3>${result.title || 'No title available'}</h3>
<p>Filetypes: ${result.filetypes || 'Unknown'}</p>
<p>Size: ${result.size || 'Unknown'}</p>
<span style="background: #28a745; color: white; padding: 2px 5px; border-radius: 3px; font-size: 12px;">Volumes: ${result.volumes || 0}</span>
</div>
`;
}).join('');
}
});
</script>
</body>
</html>

Submodule packages/KomSuite-NyaaPy added at d29938bcf5

1
packages/KomTagger Submodule

Submodule packages/KomTagger added at 7574239cdb

View File

View File

@@ -0,0 +1,19 @@
[project]
name = "komtaggertui"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
authors = [
{ name = "WorldTeacher", email = "coding_contact@pm.me" }
]
requires-python = ">=3.13"
dependencies = [
"komtagger",
]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.uv.sources]
komtagger = { workspace = true }

View File

@@ -0,0 +1,2 @@
def hello() -> str:
return "Hello from komtaggertui!"

View File

@@ -0,0 +1,3 @@
from textual.content import Content
from rich.console import RenderableType
from

1
packages/anilistAPI Submodule

Submodule packages/anilistAPI added at abf482a7b6

1
packages/autograbber Submodule

Submodule packages/autograbber added at c0b4a8d90f

1
packages/comicvineAPI Submodule

Submodule packages/comicvineAPI added at d85576d949

1
packages/komgAPI Submodule

Submodule packages/komgAPI added at 1877905473

View File

@@ -0,0 +1,34 @@
name: Bug Report
description: Report a bug in this project
labels:
- kind/bug
- triage
body:
- type: textarea
id: bug
attributes:
label: Describe the bug
description: |
A clear and concise description of what the bug is.
What did you expect to happen? What happened instead?
Include screenshots if applicable.
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: Steps to reproduce
description: |
A clear and concise description of how to reproduce the bug.
Include steps, code snippets, or screenshots if applicable.
validations:
required: true
- type: textarea
id: additional-info
attributes:
label: Additional information
description: |
Add any other context or screenshots about the bug here.

View File

@@ -0,0 +1,23 @@
name: Feature request
description: Suggest an idea for this project
labels:
- kind/feature
- triage
body:
- type: textarea
id: feature
attributes:
label: Describe the feature
description: |
A clear and concise description of what the feature is.
What is the problem it solves? What are you trying to accomplish?
Include screenshots if applicable.
validations:
required: true
- type: textarea
id: additional-info
attributes:
label: Additional information
description: |
Add any other context or screenshots about the feature request here.

View File

@@ -0,0 +1,88 @@
on:
workflow_dispatch:
inputs:
release_notes:
description: Release notes (use \n for newlines)
type: string
required: false
github_release:
description: 'Create Gitea Release'
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
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Set up Python
run: uv python install
- name: Set Git identity
run: |
git config user.name "Gitea CI"
git config user.email "ci@git.theprivateserver.de"
- name: Bump version
id: bump
run: |
uv tool install bump-my-version
uv tool run bump-my-version bump ${{ github.event.inputs.bump }}
# 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: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
- name: Add release notes to environment
id: add_release_notes
run: |
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
echo "${{ github.event.inputs.release_notes }}" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Build package
run: uv build
- name: Publish package
env:
USERNAME: ${{ github.repository_owner }}
run: uv publish --publish-url https://git.theprivateserver.de/api/packages/$USERNAME/pypi/ -t ${{ secrets.TOKEN }}
- name: Generate changelog
id: changelog
uses: metcalfc/changelog-generator@v4.6.2
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
- name: Get the changelog
run: |
cat << "EOF"
${{ steps.changelog.outputs.changelog }}
EOF
- name: Create release
id: create_release
if: ${{ github.event.inputs.github_release == 'true' }}
uses: softprops/action-gh-release@master
with:
tag_name: ${{ env.VERSION }}
release_name: Release ${{ env.VERSION }}
body: ${{ steps.changelog.outputs.changelog }}
draft: false
prerelease: false
make_latest: true
files: |
dist/*
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}

View File

View File

@@ -0,0 +1,14 @@
[project]
name = "mangadexapi"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
authors = [
{ name = "WorldTeacher", email = "coding_contact@pm.me" }
]
requires-python = ">=3.13"
dependencies = []
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

View File

@@ -0,0 +1,2 @@
def hello() -> str:
return "Hello from mangadexapi!"

7
pyproject.toml Normal file
View File

@@ -0,0 +1,7 @@
[project]
name = "komsuite-web"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.13"
dependencies = []