Coder Social home page Coder Social logo

sapicd / sapic Goto Github PK

View Code? Open in Web Editor NEW
431.0 6.0 57.0 24.55 MB

sapic(picbed) - 基于Flask的Web自建图床,可存储到又拍云、七牛云、阿里云OSS、腾讯云COS、GitHub、Gitee、S3等,支持自定义扩展。

Home Page: https://sapic.rtfd.vip

License: BSD 3-Clause "New" or "Revised" License

Makefile 0.25% Python 43.07% Shell 0.52% HTML 44.58% JavaScript 10.84% Dockerfile 0.11% CSS 0.63%
python flask picbed layui sapic

sapic's People

Contributors

moria avatar staugur avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

sapic's Issues

Chrome图片无法显示的时候返回200导致透明无法选中删除

图片无法显示的时候无法删除

比如我把一个xx.rar文件改成了xx.rar.jpg文件,临时存储到了图床上

然后我想删除他的时候,发现这个文件由于不能预览就看不到,就无法删除了
(所以如果这个图片无法预览给他一个默认的x图片预览?然后可以删除)

除非我进数据库里找他、删他

启动失败

感谢开发者开源这么棒的程序
我在搭建程序时遇到了一些问题,希望能解惑。
在进行到配置文件环节时,文档有写,加载config.py同级文件.cfg,我查找了该目录并没有发现,于是我按照配置手动创建,文件内容如下

sapic_redis_url=redis://:********@127.0.0.1:6379/1
sapic_host=127.0.0.1
sapic_port=9514
sapic_loglevel=ERROR
sapic_maxupload=30
SecretKey=******

创建完成后执行启动命令
sh online_gunicorn.sh start

报错提示
picbed/src/logs/sapic.pid: No such file or directory
我大概阅读了下,提示是指没有sapic.pid这个文件,于是我去该目录手动 创建了
但又提示
picbed/src/logs/sapic.pid, please check, exit.
我猜想该文件内容有着特殊的格式
希望开发者能解惑,

1.6功能

  • 钩子,在线下载、安装模块
  • 统计图表
  • 命令行(Win/Mac/Linux)
  • 兼容rediscluster
  • 用户管理

[BUG]图片名称的中文部分被忽略

当上传选项保留原名,且图片名称中带有中文时,中文部分会被忽略。
复现过程:使用master最新版本代码docker compose up -d启动项目,上传带有中文名字的图片,在“我的图片”中查看上传后的图片名称,会发现中文部分被忽略。

截图
上传前
上传后

版本

  • 操作系统: debian11
  • Python: 3.9
  • Sapic: 1.16.1

拉取官方镜像,docker-compose运行时似乎没有js文件

镜像:dockerhub上staugur/sapic:1.16.2

docker-compose文件:

version: '3'
services:
  sapic:
    image: staugur/sapic:1.16.2
    container_name: sapic
    restart: always
    ports:
      - "9514:9514"
    environment:
      - sapic_redis_url=redis://@redis:6379
      # 设置信任代理标头
      #- sapic_proxyfix=true
    volumes:
      - /ata/sapic:/picbed/static/
      - /data/sapic/picbed/:/picbed/static/upload/

启动后的日志:

[2023-08-25 08:31:06 +0000] [1] [INFO] Starting gunicorn 20.1.0

[2023-08-25 08:31:06 +0000] [1] [INFO] Listening at: http://0.0.0.0:9514 (1)

[2023-08-25 08:31:06 +0000] [1] [INFO] Using worker: gevent

[2023-08-25 08:31:06 +0000] [6] [INFO] Booting worker with pid: 6`

打开网址是这样的:
1

不知道哪里有问题

能否自动将图片转为webp格式,减小图片体积

你好,jpg和png格式的图片较大,如果能转为webp格式的话,大小能降低75%以上,这对博客加载速度非常有利。
下面是一个png图片转为webp后体积变小的极端例子:
2
所以我想提交PR增加jpg/png图片自动转为webp功能,但在阅读代码时遇到了一个问题。从下面的代码来看,现有钩子无法修改图片后缀
3
请问除了upimg_stream_processor这个钩子,我还有其他办法实现这个功能吗?

图片上传覆盖的问题

同名文件后面上传的会覆盖之前上传的图片(本人才疏学浅,暂时只能想到,写个条件判断上传图片已存在文件名称加后缀拼接,再次判断是否还是名称重复,不重复再存入。)

docker-compose下如何保存用户信息?

docker-compose下如何保存用户信息?

我直接docker-compose down 然后重新build了一下,再启动(我改了一下ui的size)

然后我就发现直接用户信息全丢,还要重建用户,但是之前的记录已经没有了。
虽然图片都还在,还能引用外链,但是之前的站点设置、用户设置、token啥的全丢了。

docker-compose中能否保留一下这些数据。

我看了一下备份数据的办法,是再建一个才能平移过去,也就是同时有2个sapic,但是我这个是基于原来那个重新build,怎么办

1.5功能

  • GitHub
  • Gitee
  • 油猴脚本实现任意图片上传按钮
  • ? LinkToken使用方式多样,query、body
  • fix: 禁止普通用户登录应该包括api
  • 钩子上传 timeout

Docker compose环境下pillow加载错误

Git:254686f
错误现象:钩子管理中没有pic2webp钩子
复现过程:下载最新master代码,docker compose up -d
错误原因:alpine缺少pillow相关依赖

目前Dockerfile的修复方式存在以下问题:1.将pillow安装放在运行环境中,不利于编译容器和运行容器分开
2.部分用户不需要webp转换功能,却强制安装了pillow库

我建议将运行环境从alpine更换为python3.8-slim,这样能够在很大程度上避免alpine缺少依赖的问题。而且经过我的实验,目前Dockerfile文件编译出的sapic镜像为127M,更换后编译出来的镜像大小为176M
1,大小仅增加了50M,应该在用户可以接受的范围内。我觉得用50M镜像空间的增大,来解决alpine潜在的依赖问题,是一件很划算的事情,不知道您的意见如何?

使用python3.8-slim作为运行环境的Dockerfile内容如下:

# -- build dependencies with debian(multiarch) --
FROM python:3.8-slim AS build
LABEL [email protected]
ARG PIPMIRROR=https://pypi.tuna.tsinghua.edu.cn/simple
COPY requirements /requirements
RUN pip install --timeout 30 --index $PIPMIRROR --user --no-cache-dir --no-warn-script-location -r /requirements/all.txt

# -- app environment(multiarch) --
FROM python:3.8-slim
ENV LOCAL_PKG="/root/.local"
ENV sapic_isrun=true
COPY --from=build ${LOCAL_PKG} ${LOCAL_PKG}
    
RUN ln -sf ${LOCAL_PKG}/bin/flask ${LOCAL_PKG}/bin/gunicorn /bin/ && \
    ln -sf $(which python) /python && \
    sed -i "s#$(which python)#/python#" /bin/gunicorn
WORKDIR /picbed
COPY src /picbed
EXPOSE 9514
ENTRYPOINT ["gunicorn", "app:app", "-c", "sapicd.py"]

镜像回源功能-<用户访问您的域名图片时,图片自动上传到我们的图床>

镜像回源功能用于将您的网站下的图片自动同步到我们的图床上,您可以像使用CDN一样来使用它。您无需更改任何服务器设置,就像CDN一样,只需要将您的域名指向我们提供的CNAME记录即可。

如果您的图片位于您自己的服务器上,只需要在下方服务器地址处填写您的服务器IP地址,然后将您的域名CNAME记录修改至我们提供的CNAME记录值即可。

当用户访问您的域名时,我们会自动将该域名下的图片上传到我们的图床,您可以在上传历史看到图片上传记录。

图片上传完成后,当您再次打开您域名下的图片时,会发现地址已经变成了图床地址,不再消耗您服务器的流量或者对象存储的流量。

对于非图片请求,我们会直接反代至您的网站,不会影响您原先的内容展示。

《参考》目标功能网站:https://www.superbed.cn/admin#item=12

请问并发情况怎么样?谢谢

如题,
之前一直在寻找py有关图床的实现版本,功能上类似于可以自建FTP或上传到私有云上,或上传到多点,然后通过返回伪静态地址,301到源地址(实际是HIDOVE图床功能)。

现在找到sapic图床,因为基于flask,对并发情况不是很了解,由于以前用django搞过效率一般,所以想在二开前咨询一下。

或者若flask并发不足的话,fastapi有没有可能?

很棒的系统

Discussed in https://github.com/sapicd/sapic/discussions/13

Originally posted by aitu8 February 5, 2021
后台打开个人相册的图片加载太慢了,能否开启带水印的缩略图和可以下载的原图。。相册里展示用缩略图。。

啥时候能迁移到mysql数据库啊,想做个图片网站。。

如果用于图片网站的话,能否接入到阿里云的图片识别?识别后的数据写入数据库,用于tag和seo

docker compose启动报错:ImportError: Error loading shared library libstdc++.so.6

git clone本项目后,使用docker compose up -d启动,发现容器报错。docker logs查看报错信息如下:

[Traceback (most recent call last):
  File "/root/.local/lib/python3.7/site-packages/gunicorn/workers/ggevent.py", line 13, in <module>
    import gevent
  File "/root/.local/lib/python3.7/site-packages/gevent/__init__.py", line 86, in <module>
    from gevent._hub_local import get_hub
  File "/root/.local/lib/python3.7/site-packages/gevent/_hub_local.py", line 101, in <module>
    import_c_accel(globals(), 'gevent.__hub_local')
  File "/root/.local/lib/python3.7/site-packages/gevent/_util.py", line 148, in import_c_accel
    mod = importlib.import_module(cname)
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "src/gevent/_hub_local.py", line 1, in init gevent._gevent_c_hub_local
  File "/root/.local/lib/python3.7/site-packages/greenlet/__init__.py", line 29, in <module>
    from ._greenlet import _C_API # pylint:disable=no-name-in-module
ImportError: Error loading shared library libstdc++.so.6: No such file or directory (needed by /root/.local/lib/python3.7/site-packages/greenlet/_greenlet.cpython-37m-x86_64-linux-gnu.so)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/.local/lib/python3.7/site-packages/gunicorn/util.py", line 99, in load_class
    mod = importlib.import_module('.'.join(components))
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/root/.local/lib/python3.7/site-packages/gunicorn/workers/ggevent.py", line 15, in <module>
    raise RuntimeError("gevent worker requires gevent 1.4 or higher")
RuntimeError: gevent worker requires gevent 1.4 or higher
]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.