Compare commits

..

3 Commits

Author SHA1 Message Date
d87ed92313 refactor: list page 2025-11-07 00:06:42 +08:00
e23a8d7b5b style: update 2025-11-06 15:31:49 +08:00
d35b529623 add eudic 2025-11-04 15:17:41 +08:00
7 changed files with 26 additions and 178 deletions

View File

@ -43,12 +43,12 @@
| [ToDesk](https://www.todesk.com/linux.html) | todesk | ✅ | |
| [微信](https://linux.weixin.qq.com/) | wechat | ✅ | ✅ |
| [kali-undercover](https://www.kali.org/docs/introduction/kali-undercover/) | kali-undercover | ✅ | ✅ |
| [欧路词典](https://www.eudic.net/v4/en/app/download) | eudic | ✅ | |
### Github Releses
> 因服务器资源有限,本仓库可能无法收录部分大文件。
> 有收录需求也可投稿至星火商店的 [Github Releases 更新配置仓库](https://gitee.com/spark-building-service/github),其和本部分内容是同源的。
> 也可投稿至星火商店的 [Github Releases 更新配置仓库](https://gitee.com/spark-building-service/github),其和本部分内容是同源的。
| 软件名 | 包名 | amd64 | arm64 |
| ----- | ---- | ----- | ----- |

View File

@ -10,7 +10,7 @@ from threading import Lock
DEB_BASE_DIR = "deb"
PACKAGES_DIR = "packages"
DB_DIR = "data"
USER_AGENT = "Debian APT-HTTP/1.3 (2.6.1)" # from Debian 12
USER_AGENT = "Debian APT-HTTP/1.3 (3.0.3)" # from Debian 13
version_lock = Lock()
@ -58,7 +58,7 @@ def check_download(name, version, url, arch):
file_path = os.path.join(DEB_BASE_DIR, arch, f"{name}_{version}_{arch}.deb")
local_version = None
db_path = os.path.join("data", f"{DEB_BASE_DIR}.db")
db_path = os.path.join(DB_DIR, f"{DEB_BASE_DIR}.db")
# get local version
with version_lock, sqlite3.connect(db_path) as conn:
res = conn.execute(
@ -74,6 +74,7 @@ def check_download(name, version, url, arch):
os.makedirs(os.path.join(DEB_BASE_DIR, arch), exist_ok=True)
if not download(url, file_path):
return
logging.info(f"Downloaded {name}:{arch} ({version})")
os.makedirs(os.path.join(PACKAGES_DIR, arch), exist_ok=True)
if not scan(name, arch, url, file_path):
return

View File

@ -1,166 +0,0 @@
#!/usr/bin/env python3
import sqlite3
import os
# 获取数据库中所有表的数据
def fetch_table_data(db: str) -> dict:
conn = sqlite3.connect(db)
conn.row_factory = sqlite3.Row # 使得查询结果可以通过列名访问
cursor = conn.cursor()
# 获取数据库中的所有表
cursor.execute("SELECT name FROM sqlite_master WHERE type='table';")
tables = cursor.fetchall()
# 获取每个表的内容
table_data = {}
for table in tables:
table_name = table["name"]
cursor.execute(f"SELECT * FROM '{table_name}'")
table_data[table_name] = cursor.fetchall()
conn.close()
return table_data
# 生成静态 HTML 页面
def generate_html(table_data, filename):
html = """<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="color-scheme" content="light dark">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>仓库内容</title>
<style>
body {
font-family: Arial, sans-serif;
}
.tabs {
overflow: hidden;
background-color: #f1f1f1;
}
.tabs button {
background-color: #ddd;
border: none;
display: inline-block;
padding: 10px 20px;
cursor: pointer;
transition: background-color 0.3s ease;
}
.tabs button:hover {
background-color: #ccc;
}
.tabs button.active {
background-color: #3498db;
color: white;
}
.tab-content {
display: none;
padding: 20px;
border-top: 2px solid #ddd;
}
.tab-content.active {
display: block;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
table, th, td {
border: 1px solid #ddd;
}
th, td {
padding: 8px;
text-align: left;
}
/* 增加水平滚动条的样式 */
.table-wrapper {
overflow-x: auto; /* 启用水平滚动 */
-webkit-overflow-scrolling: touch; /* 提升在触控设备上的滚动体验 */
}
</style>
</head>
<body>
<div class="tabs">"""
# 创建标签栏
for table_name in table_data.keys():
html += f'<button class="tab-button" id="tab-{table_name}" onclick="showTab(\'{table_name}\')">{table_name}</button>'
html += "</div>\n "
# 渲染每个表格的内容
for table_name, rows in table_data.items():
html += f'<div class="tab-content" id="content-{table_name}">'
html += f"<h2>{table_name}</h2>"
# 表格外层包裹 div启用水平滚动
html += '<div class="table-wrapper">'
html += "<table>"
# 表头
if rows:
html += "<tr>"
for column in rows[0].keys():
html += f"<th>{column}</th>"
html += "</tr>"
# 表格数据
for row in rows:
html += "<tr>"
for column in row.keys():
html += f"<td>{row[column]}</td>"
html += "</tr>"
html += "</table>"
html += "</div>" # 结束 .table-wrapper
html += "</div>"
# 添加 JavaScript 以实现标签切换功能
html += """
<script>
function showTab(tableName) {
// 隐藏所有 tab 内容
var contents = document.querySelectorAll('.tab-content');
contents.forEach(function(content) {
content.classList.remove('active');
});
// 移除所有按钮的 active
var buttons = document.querySelectorAll('.tab-button');
buttons.forEach(function(button) {
button.classList.remove('active');
});
// 显示当前选中的 tab 内容
document.getElementById('content-' + tableName).classList.add('active');
// 给当前按钮添加 active
document.getElementById('tab-' + tableName).classList.add('active');
}
// 默认显示第一个表
document.addEventListener('DOMContentLoaded', function() {
var firstTable = document.querySelector('.tab-button');
if (firstTable) {
firstTable.click();
}
});
</script>
</body>
</html>
"""
dir = os.path.dirname(filename)
if not os.path.exists(dir):
os.makedirs(dir)
# 保存为静态 HTML 文件
with open(filename, "w", encoding="utf-8") as f:
f.write(html)
if __name__ == "__main__":
db = "data/deb.db"
filename="deb/list/index.html"
table_data = fetch_table_data(db)
generate_html(table_data, filename)

View File

@ -7,7 +7,7 @@ import re
from concurrent.futures import ThreadPoolExecutor, wait
from check_downloader import check_download
github_info_list = {}
git_repo_list = {}
CONFIG = {"data_dir": "data", "proxy": "", "thread": 5}
@ -31,11 +31,11 @@ if __name__ == "__main__":
# read all repo info 读取所有仓库配置
with open(os.path.join(CONFIG["data_dir"], "github.json"), "r") as f:
github_info_list = json.load(f)
git_repo_list = json.load(f)
tasks = []
with ThreadPoolExecutor(max_workers=CONFIG["thread"]) as executor:
for name, repo in github_info_list.items():
for name, repo in git_repo_list.items():
if "site" in repo:
repo_url = os.path.join(repo["site"], repo['repo'])
else:

7
get/eudic.sh Normal file
View File

@ -0,0 +1,7 @@
WEB_CONTENT=$(curl -s https://www.eudic.net/v4/en/app/download)
AMD64_URL=$(echo $WEB_CONTENT | grep -o 'https://[^"]*\.deb[^"]*')
# https://www.eudic.net/download/eudic.deb?v=2025-08-25
VERSION=$(echo $AMD64_URL | cut -d '=' -f 2)
./check_downloader.py eudic "$VERSION" "$AMD64_URL" amd64

View File

@ -18,7 +18,7 @@ from apt_pkg import version_compare
apt_pkg.init() # 初始化 apt_pkg
USER_AGENT = "Debian APT-HTTP/1.3 (3.0.3)" # from Debian 13
arch_List = ["all", "amd64", "arm64", "i386"]
arch_List = ["amd64", "arm64", "all", "i386"]
lock = {arch: Lock() for arch in arch_List}
packages = {arch: {} for arch in arch_List} # 存放用于生成 Packages 的内容
""" packages format:
@ -26,6 +26,7 @@ packages = {arch: {} for arch in arch_List} # 存放用于生成 Packages 的内
"arch": {
"package1": {
"version": "1.0.0",
"url": "https://example.com/package1.deb",
"package": ""
}
}
@ -99,6 +100,7 @@ def split_latest(packages_file_content: bytes):
find_name = re.compile(rb"Package:[ ]*(.+)")
find_arch = re.compile(rb"Architecture:[ ]*(.+)")
find_url = re.compile(rb"Filename:[ ]*(.+)")
find_version = re.compile(rb"Version:[ ]*(.+)")
for package in package_list:
@ -106,6 +108,7 @@ def split_latest(packages_file_content: bytes):
try:
name = find_name.search(package).group(1).decode()
arch = find_arch.search(package).group(1).decode()
url = find_url.search(package).group(1).decode()
tmp_version = find_version.search(package).group(1).decode()
with lock[arch]:
# 使用 apt_pkg 进行版本比较
@ -113,7 +116,7 @@ def split_latest(packages_file_content: bytes):
name not in packages[arch]
or version_compare(tmp_version, packages[arch][name]["version"]) > 0
):
packages[arch][name] = {"package": package, "version": tmp_version}
packages[arch][name] = {"version": tmp_version, "url": url, "package": package}
except Exception as e:
logging.error(f"Error processing package {name}: {e}")
return
@ -170,3 +173,9 @@ if __name__ == "__main__":
f.write(i["package"])
for i in packages["all"].values():
f.write(i["package"])
# 输出 packages.json用于展示仓库内容
for arch in arch_List:
for i in packages[arch].values():
i.pop("package")
json.dump(packages, open("deb/list/packages.json", "w"), indent=4)

3
run.sh
View File

@ -4,9 +4,6 @@
./get-github-releases.py
find get -type f -name "*.sh" -exec sh {} \;
# generate the html
./gen-list-html.py
## merge the Packages file from local package
cat $(find packages -name "*.package") > deb/tmpPackages