# AppServer **Repository Path**: skytoup/AppServer ## Basic Information - **Project Name**: AppServer - **Description**: 在线下载、安装App的服务器 - **Primary Language**: Python - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 17 - **Forks**: 4 - **Created**: 2017-03-01 - **Last Updated**: 2024-06-27 ## Categories & Tags **Categories**: lamp **Tags**: None ## README # AppServer ![license](https://img.shields.io/badge/license-MIT-blue.svg) ## 简介 基于`Sanic`搭建的简单`App`在线下载、安装服务器。可在线下载安装包, 或者`iPhone`在线安装ipa。 **首页** ![pic](img/home.png) **上传App** ![pic](img/upload.png) **App详情页** ![pic](img/app_detail.png) **App编辑页** ![pic](img/app_edit.png) ## 功能 - [x] `RESTful`的API - [x] 上传apk、ipa文件 - [x] 下载apk、下载ipa - [x] 短链接进入下载页 - [x] App、版本管理 - [x] 搜索App - [ ] HTML更好兼容移动端 更多... ## 使用 ### 环境 - Python > 3.5 - macOS 10.12+ - centos 6+ - ubuntu 14.04+ - 还有其它更多尚未测试... ### 配置(app/config.py) 把`Config`的`host`修改为本机地址 ![配置](img/1.png) ### 运行服务器 #### 源码运行 # linux系统请注意, 需要安装libpng12(centos已测试, 其它系统还没测试), MacOSX系统不需要 `yum install libpng12` # centos 1. `git clone https://github.com/skytoup/AppServer` 2. `cd AppServer` 3. `gcc vendors/pngdefry/pngdefry.c -o pngdefry # 编译pngdfry` 4. `pip install -r requirements.txt # 安装依赖` 5. `python main.py # 运行服务器` ![运行](img/2.png) 6. `open https://your_bing_host:8000` # or 打开浏览器, 输入https://{Config的host}:8000, 回车 #### Docker运行 1. `git clone https://github.com/skytoup/AppServer` 2. `cd AppServer` 3. 修改`app/config/config.py:BaseConfig.host`为需要绑定的ip地址, 设置错误会导致iOS无法在线下载安装ipa 4. `docker build -t app_server ./` 5. `docker run -d -p 8000:8000 -v /path/to/data:/www/AppServer/data -v /path/to/log:/www/AppServer/log --name AppServer app_server` # or `docker run -d -p 8000:8000 --name AppServer app_server` 6. `open https://your_bing_host:8000` # or 打开浏览器, 输入https://{Config的host}:8000, 回车 ### 服务器的单元测试 1. `pip install -r requirements_test.txt` 2. `pytest -q tests` ### HTML前端 不是专业前端, 只是简单做了一个非常简陋的, 请勿介意😅 详情请看 👉 传送门: [AppServerHTML](https://github.com/skytoup/AppServerHTML) ### https证书 证书使用的是自签证书, 每次修改`Config`的`host`后, 会自动重新生成 ### Tip 1. 开启服务器后, 需要在地址栏输入的是**Config的host**, 不能填写127.0.0.1、localhost、0.0.0.0; 还有协议是`https`, 不是`http` 2. `iPhone`安装ipa需要在App详情的界面里面点击安装证书, 因为证书是自己生成的, 不能免证书安装(**iOS9以上系统安装完证书后, 还需要在设置那里信任一下证书**, 请参考: [苹果iOS9系统安装应用证书信任操作指导](http://jingyan.baidu.com/article/9c69d48f98e11813c8024e77.html)) 3. `centos`和`ubuntu`安装可能出现的问题 👉 [传送门](https://github.com/skytoup/AppServer/issues/1) 4. `linux`运行`aapt`需要安装`libpng12`, centos: `yum install libpng12` 更详细请看 👉 [FAQ](FAQ.md) ## API ### 基本格式 ``` { code: int, # 请参考👇的表 ok: bool, # 是否请求成功 msg: str, # 请求返回的信息 datas: dict/array, # 请求返回的数据 } ``` | code | 描述 | | --- | --- | | 0 | 成功 | | -1 | 失败 | ### 上传App安装包 POST /upload/app > Form | 参数 | 必填 | 描述 | |---|:-:|---| | pcakage | y | 上传的安装包 | | msg | n | 更新说明 | > 返回datas: object or not(上传不存在的App时, 才有返回) | 参数 | 描述 | | --- | --- | | id | App的id | | type | 安装包类型, 0: iOS, 1: Android | | name | 名称 | | icon | 图标 | | detail | 介绍 | | short_chain | 短链接 | | package_name | 包名 | | create_at | 创建时间 | ### 获取App列表 GET /apps//page/?t=