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

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!"