Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump pillow from 3.2.0 to 9.3.0 #63

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM ubuntu:18.04

ENV TZ "Asia/Shanghai"
ENV LANG "C.UTF-8"

RUN sed -i 's/archive.ubuntu.com/mirrors.163.com/g' /etc/apt/sources.list && \
sed -i 's/security.ubuntu.com/mirrors.163.com/g' /etc/apt/sources.list && \
echo $TZ > /etc/timezone && \
apt update && DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \
python3-pip python3-setuptools python3-wheel python3.6 tzdata && \
ln -s /usr/bin/python3.6 /usr/bin/python && ln -s /usr/bin/pip3 /usr/bin/pip

RUN mkdir -p /web/logs
WORKDIR /web

ADD requirements.txt /web/requirements.txt
RUN pip3 install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

ADD runserver.py /web/runserver.py
ADD forums /web/forums
ADD templates /web/templates
ADD static /web/static
ADD translations /web/translations

CMD ["gunicorn","-b","0.0.0.0:8000","runserver:app"]
15 changes: 11 additions & 4 deletions config.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Author: jianglin
# Email: mail@honmaple.com
# Created: 2016-05-20 12:31:46 (CST)
# Last Update: Wednesday 2019-05-08 16:28:02 (CST)
# Last Update: Monday 2022-12-12 16:40:46 (CST)
# By: jianglin
# Description:
# **************************************************************************
Expand Down Expand Up @@ -46,11 +46,18 @@ CACHE_REDIS_PASSWORD = 'your password'
CACHE_REDIS_DB = 2

# Redis setting
REDIS = {'db': 1, 'password': 'your password', 'decode_responses': True}
REDIS = {
'host': 'redis',
'db': 1,
'password': 'your password',
'decode_responses': True
}

# some middleware
MIDDLEWARE = ['forums.common.middleware.GlobalMiddleware',
'forums.common.middleware.OnlineMiddleware']
MIDDLEWARE = [
'forums.common.middleware.GlobalMiddleware',
'forums.common.middleware.OnlineMiddleware'
]

# Mail such as qq
MAIL_SERVER = 'smtp.qq.com'
Expand Down
26 changes: 26 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: "2.2"
services:
redis:
image: redis:alpine
ports:
- 6379:6379
postgres:
image: postgres:10
restart: always
ports:
- 5433:5432
environment:
- POSTGRES_PASSWORD=test
forums:
build:
context: .
ports:
- 8000:8000
links:
- redis
- postgres
depends_on:
- redis
- postgres
volumes:
- ./config.py:/web/config.py
6 changes: 3 additions & 3 deletions forums/api/topic/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# -*- coding: utf-8 -*-
# **************************************************************************
# Copyright © 2016 jianglin
# File Name: models.py
# File Name: db.py
# Author: jianglin
# Email: xiyang0807@gmail.com
# Email: mail@honmaple.com
# Created: 2016-12-15 20:52:07 (CST)
# Last Update: Monday 2019-05-06 23:37:22 (CST)
# Last Update: Monday 2022-12-12 15:22:48 (CST)
# By:
# Description:
# **************************************************************************
Expand Down
16 changes: 8 additions & 8 deletions forums/extension/maple.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
# Copyright © 2018 jianglin
# File Name: maple.py
# Author: jianglin
# Email: xiyang0807@gmail.com
# Email: mail@honmaple.com
# Created: 2018-02-11 14:56:08 (CST)
# Last Update: 星期日 2018-02-11 15:26:53 (CST)
# Last Update: Monday 2022-12-12 16:38:21 (CST)
# By:
# Description:
# ********************************************************************************
Expand All @@ -17,17 +17,17 @@
from flask_maple.json import CustomJSONEncoder
from flask_maple.middleware import Middleware
from flask_maple.log import Logging
from PIL import ImageFont

bootstrap = Bootstrap(
css=('styles/monokai.css', 'styles/mine.css'),
js=('styles/upload.js', 'styles/forums.js', 'styles/following.js',
'styles/topic.js'),
use_auth=True)
bootstrap = Bootstrap(css=('styles/monokai.css', 'styles/mine.css'),
js=('styles/upload.js', 'styles/forums.js',
'styles/following.js', 'styles/topic.js'),
use_auth=True)


def init_app(app):
bootstrap.init_app(app)
Captcha(app)
Captcha(app, font=ImageFont.load_default())
Error(app)
App(app, json=CustomJSONEncoder)
Middleware(app)
Expand Down
13 changes: 6 additions & 7 deletions forums/jinja.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
# Copyright © 2016 jianglin
# File Name: jinja.py
# Author: jianglin
# Email: xiyang0807@gmail.com
# Email: mail@honmaple.com
# Created: 2016-11-07 21:00:32 (CST)
# Last Update: Wednesday 2019-05-08 16:26:18 (CST)
# Last Update: Monday 2022-12-12 16:11:32 (CST)
# By:
# Description:
# **************************************************************************
Expand All @@ -16,7 +16,7 @@
from bleach import clean
from flask import Markup, g
from flask_babel import format_datetime
from misaka import HtmlRenderer, Markdown
from markdown import markdown as m


def safe_clean(text):
Expand All @@ -27,11 +27,10 @@ def safe_clean(text):


def markdown(text, clean=True):
renderer = HtmlRenderer()
md = Markdown(renderer, extensions=('fenced-code', ))
html = m(text, extensions=['markdown.extensions.fenced_code'])
if clean:
return Markup(safe_clean(md(text)))
return Markup(md(text))
return Markup(safe_clean(html))
return Markup(html)


def timesince(dt, default="just now"):
Expand Down
10 changes: 8 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@ Flask-Principal==0.4.0
Flask-SQLAlchemy==2.2
Flask-WTF==0.14.2
speaklater==1.3
Pillow==3.2.0
misaka==2.0.0
Pillow==9.3.0
Pygments==2.1
pytz==2018.3
redis==2.10.6
psycopg2-binary==2.7.5
Whoosh==2.7.4
gunicorn==19.9.0
jinja2==3.0.3
itsdangerous==2.0.1
Werkzeug==0.16.1
wtforms==2.3.1
SQLAlchemy==1.3.5
Markdown==3.3.7
email-validator==1.3.0
2 changes: 1 addition & 1 deletion runserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Author: jianglin
# Email: mail@honmaple.com
# Created: 2016-10-25 22:01:29 (CST)
# Last Update: Monday 2019-05-06 23:36:53 (CST)
# Last Update: Monday 2022-12-12 15:29:04 (CST)
# By:
# Description:
# **************************************************************************
Expand Down