Skip to main content

plugin_jm_server, a plugin for jmcomic that can be used to view comics in a web browser.

Project description

plugin-jm-server logo

plugin-jm-server

“离线版”禁漫天堂,你的纯本地 离线看本神器!

GitHub Stars Forks PyPI PyPI - Downloads Licence

该项目会在你的电脑上启动一个本地文件服务器。你可以直接在浏览器(手机或电脑)中打开它,它会把本地文件夹里的图片转换成类似“禁漫天堂”的章节观看页面。

核心优势

  • 支持各种强大的浏览器插件和脚本,例如双页阅读插件
  • 一键开启局域网共享,电脑下载,躺在床上用手机看。

架构与流程图


🌟 功能与界面展示

本项目不仅提供了简单的文件浏览,还专为漫画阅读进行了深度优化:

1. 智能资源管理(文件夹浏览页)

  • 路径导航:输入框自动补全路径,快速定位。
  • 封面预览:鼠标悬停在文件夹上,自动展示首张图片作为封面。
  • 书签收藏:将常看目录加入左侧书签,方便下次访问。

(电脑端:文件夹与看本二合一模式) (手机端:文件夹列表)

2. 沉浸式阅读体验(看本模式)

  • 懒加载极速浏览:哪怕一个章节有几百张高清大图,也能秒开且不卡顿。
  • 多端适配:无论是在宽屏显示器还是手机触摸屏上,都有最舒适的阅读排版。
  • 快捷交互:支持键盘翻页、浮动工具栏快速回到顶部等。

(电脑端:看本模式) (手机端:看本模式)

3. 局域网消息与隐私保护

  • 消息中心:电脑和手机在局域网内可互传文本消息,实时弹窗提醒(v0.2.2+ 新功能)。
  • 密码验证:支持设置访问密码,防止同处局域网的其他室友/家人偷看!

(局域网消息界面) (登录密码验证)


🚀 小白快速上手指南

如果你不懂编程,请严格按照以下两步操作即可:

第一步:环境准备

本项目基于 Python 开发,因此你的电脑必须先安装 Python。

  • 请前往 Python 官网 下载并安装最新版 Python(安装时请务必勾选 Add Python to PATH)。

第二步:一键安装与启动

打开你电脑的命令行终端(Windows 下按 Win+R 输入 cmd,Mac 下打开“终端”APP),复制并执行下面这行命令:

pip install plugin_jm_server && jms

提示:这行命令会帮你自动下载安装必要的组件,并以默认配置(分享当前所在目录、端口80)启动服务器。

启动成功后怎么用? 终端里会打印出两行地址,例如:

  • 本机访问:http://127.0.0.1:80
  • 局域网访问:http://192.168.1.100:80

你只需要在电脑的浏览器里打开第一个地址,或者在连着同一个 WiFi 的手机浏览器里打开第二个地址,就可以开始看漫画了!

提示:如果在终端没看清局域网地址也没关系,当你用电脑打开本机地址后,网页的主页顶部也会直接显示并智能识别当前的局域网地址,你可以一键复制发给手机直接访问。


⚙️ 进阶使用(针对有经验的用户)

安装后系统会注册 jms 命令,无需写代码即可通过丰富的参数进行个性化启动:

# 共享指定目录 ~/comics,并使用 8080 端口(高位端口无需管理员权限)
jms ~/comics -p 8080

# 设置登录密码为 123,并启用 HTTPS
jms ~/comics -P 123 -s

# 仅允许指定 IP 的设备访问
jms ~/comics --ip-whitelist 192.168.1.10,192.168.1.11

# 加载 jmcomic 配置开启在线下载
jms ~/comics -o op.yml

全部参数说明(可通过 jms -h 查看):

参数 说明 默认值
path 要共享的根目录(位置参数) 当前目录
-P, --password 登录密码,空表示免密
-H, --host 监听地址 0.0.0.0
-p, --port 监听端口 80
-s, --ssl 启用 HTTPS(adhoc 自签名) 关闭
-o, --option jmcomic 配置文件路径,开启在线下载
--ip-whitelist IP 白名单,逗号分隔 不限制
--current-path 初始当前路径 path
-e, --env 设置环境变量 KEY=VALUE,可重复
--debug 开启 Flask debug 模式 关闭

注:如果你在 Linux/macOS 上启动报错没有权限,是因为绑定默认的 80 端口需要管理员权限。建议加上 -p 8080 参数改用其他端口。


👨‍💻 开发者专属区域

如果你想在自己的 Python 脚本中集成或二次开发该服务,可以通过代码进行调用。

1. HTTP / HTTPS 原生调用

from plugin_jm_server import *

# 启动 HTTP 服务
server = JmServer('D:/', 'password')
server.run(host='0.0.0.0', port=80)

# 启动 HTTPS 服务 (需要安装 cryptography)
server.run(host='0.0.0.0', port=443, ssl_context='adhoc')

2. 作为 jmcomic 的插件集成

你可以在 jmcomicop.yml 配置文件中配置它:

plugins:
  after_init: 
    - plugin: jm_server
      kwargs:
        password: ''

对应的启动脚本注意事项:

from jmcomic import *

op = create_option('op.yml')
op.download_album(123)

# 注意:虽然爬虫主线程执行完毕,但 Web 服务器线程仍在运行中。
# 需要用户手动按 Ctrl+C 退出。
# Python 3.12+ 特别注意:必须插入下面这行代码,Web 服务器才能继续处理请求!
op.wait_all_plugins_finish()

💡 想法起源

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plugin_jm_server-0.2.3.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

plugin_jm_server-0.2.3-py3-none-any.whl (1.7 MB view details)

Uploaded Python 3

File details

Details for the file plugin_jm_server-0.2.3.tar.gz.

File metadata

  • Download URL: plugin_jm_server-0.2.3.tar.gz
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for plugin_jm_server-0.2.3.tar.gz
Algorithm Hash digest
SHA256 167a1f9034a9de799d4a6016a7cddb7b736d8df29af758f7c7158a32d6d04e0c
MD5 bade34fd99d8219ad11b762cfa3df6af
BLAKE2b-256 b6f34bd780ff23c4114a3dbe11ec05b5e9f37ba659a69a2f8ed2a3f7231c54de

See more details on using hashes here.

Provenance

The following attestation bundles were made for plugin_jm_server-0.2.3.tar.gz:

Publisher: release_auto.yml on hect0x7/plugin-jm-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file plugin_jm_server-0.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for plugin_jm_server-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6db5b6d7bbd6248c4857d3046816a3a7eaf0bff332e2c3c36bade697e3892257
MD5 eec015f1e2348cedf0ae3aff91bb6e51
BLAKE2b-256 98000efff06e63a52dc982dd316d29c89533b5539e7b71d57c4c2629fd4649b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for plugin_jm_server-0.2.3-py3-none-any.whl:

Publisher: release_auto.yml on hect0x7/plugin-jm-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page