Metadata-Version: 2.4
Name: litheserver
Version: 0.2.0
Summary: Light local file sharing with a calm browser workspace
Home-page: https://github.com/xyanmi/litheserver
Author: xyanmi
Author-email: xyanmi <youryanmi@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/xyanmi/litheserver
Project-URL: Bug Reports, https://github.com/xyanmi/litheserver/issues
Project-URL: Source, https://github.com/xyanmi/litheserver
Keywords: file server,http server,web interface,file sharing,local server,lightweight
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Classifier: Topic :: System :: Filesystems
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

<p align="center">
  <img src="fig/logo.png" alt="LitheServer logo" width="360">
</p>

<p align="center">
  Light local file sharing with a calm browser workspace.
</p>

<p align="center">
  <a href="#中文">中文</a> | <a href="#english">English</a>
</p>

# LitheServer

LitheServer is a lightweight local file server for the moments when you just want to share a folder, open it in a browser, and get on with your work.

It keeps the small, no-fuss feel of `python -m http.server`, but adds the things people actually reach for in practice: browser upload, inline preview, better navigation, sorting, and simple file actions.

## Screenshots

### Homepage

![LitheServer homepage](fig/homepage.png)

### Preview Panel

![LitheServer preview panel](fig/preview.png)

## 中文

如果你经常只是想把一个目录临时开出来，让手机、平板、另一台电脑，或者局域网里的同事直接在浏览器里上传、下载、查看文件，那 LitheServer 就是为这种场景做的。

它想做的不是一个很重的“全能文件管理器”，而是一个更顺手的本地文件服务器：

- 启动要简单
- 浏览器里就能完成大多数操作
- 看起来清爽，不折腾
- 不引入额外 Python 依赖

### 适合什么场景

- 临时共享当前目录
- 给手机或平板传文件
- 在浏览器里快速预览文本、图片、PDF
- 在受信任的局域网里做轻量文件工作台
- 替代 `python -m http.server` 这种过于原始的目录列表页

### 目前有什么

- 零依赖：只使用 Python 标准库
- 一个命令启动服务
- 浏览器上传文件
- 点击文件夹名直接进入目录
- 点击文件名直接在右侧预览
- 文本文件语法高亮
- 图片和 PDF 内嵌预览
- 其他文件类型显示文件信息和下载入口
- 文件下载、文件夹 ZIP 下载
- 重命名、删除、移动、新建文件夹
- 文件夹优先排序
- 隐藏文件默认折叠，可手动显示
- 桌面和移动端都能使用

### 快速开始

```bash
python -m pip install litheserver

# 直接服务当前目录
litheserver

# 指定端口和目录
litheserver -p 8080 -d /path/to/folder
```

启动后访问终端里打印出来的地址即可。

### 命令行选项

```bash
litheserver [options]

Options:
  -p, --port PORT        Port to serve on (default: 8000)
  -d, --directory DIR    Directory to serve (default: current directory)
  --host HOST            Host to bind to (default: 0.0.0.0)
  --version              Show version
  -h, --help             Show help
```

### 使用方式

1. 启动服务后，在浏览器打开 `http://localhost:8000` 或终端中打印出的局域网地址。
2. 点击文件夹名进入目录。
3. 点击文件名，在右侧预览面板查看内容。
4. 通过右侧 action 按钮下载、重命名、删除、压缩下载等。
5. 顶部支持搜索、排序、隐藏文件切换。
6. 拖拽文件到上传区，或者点击上传区选择文件。

### 预览支持

- 文本文件：语法高亮预览
- 图片文件：直接预览
- PDF：浏览器内嵌预览
- 其他文件：显示文件信息并提供下载入口

没有扩展名但本质上是文本的文件，也会尽量按文本预览。

### 安装源码版本

```bash
git clone https://github.com/xyanmi/litheserver.git
cd litheserver
python -m pip install .
```

### 注意

- LitheServer 更适合个人使用、临时共享和受信任的本地网络环境。
- 它不是面向公网暴露的重型文件服务，也没有做复杂鉴权。
- 如果你只是本机使用，可以显式指定：

```bash
litheserver --host 127.0.0.1
```

---

## English

LitheServer is for the very common case where you want to expose a folder, open it in a browser, and immediately upload, download, or inspect files without setting up a heavyweight file manager.

It stays small and dependency-free, but gives you a much better day-to-day experience than a raw directory listing.

### Good Fit For

- Quickly sharing the current folder
- Sending files to a phone or tablet
- Browsing files from another device on the same LAN
- Previewing text, images, and PDFs in the browser
- Replacing `python -m http.server` with something more practical

### Features

- Zero dependencies: Python standard library only
- One-command startup
- Browser upload
- Click folder names to enter directories
- Click file names to open the right-side preview panel
- Syntax highlighting for text files
- Inline image and PDF preview
- File info + download fallback for other file types
- File download and folder ZIP download
- Rename, delete, move, and create folders
- Folder-first sorting
- Hidden files are hidden by default, with a toggle to show them
- Works on desktop and mobile browsers

### Quick Start

```bash
python -m pip install litheserver

# Serve the current directory
litheserver

# Serve a custom folder on a custom port
litheserver -p 8080 -d /path/to/folder
```

Then open the address printed in the terminal.

### CLI

```bash
litheserver [options]

Options:
  -p, --port PORT        Port to serve on (default: 8000)
  -d, --directory DIR    Directory to serve (default: current directory)
  --host HOST            Host to bind to (default: 0.0.0.0)
  --version              Show version
  -h, --help             Show help
```

### How It Works

1. Start the server.
2. Open `http://localhost:8000` or the LAN URL printed in the terminal.
3. Click folder names to navigate.
4. Click file names to preview them in the side panel.
5. Use the action buttons for download, rename, delete, ZIP download, and other file operations.
6. Use search, sorting, and the hidden-file toggle from the top toolbar.

### Preview Support

- Text files: syntax-highlighted preview
- Images: inline preview
- PDFs: embedded browser preview
- Other file types: file information plus a download action

Extensionless files that look like text are also previewed as text when possible.

### Install From Source

```bash
git clone https://github.com/xyanmi/litheserver.git
cd litheserver
python -m pip install .
```

### Notes

- LitheServer is intended for personal use, quick sharing, and trusted local networks.
- It is not meant to be a hardened public-facing file server.
- If you only want local machine access, bind explicitly to localhost:

```bash
litheserver --host 127.0.0.1
```
