summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INSTALL-OLD.md6
-rw-r--r--README.md9
-rwxr-xr-xclient/hooks/build4
-rw-r--r--client/nginx.conf.docker2
-rw-r--r--server/requirements.txt4
-rw-r--r--server/szurubooru/func/posts.py8
-rw-r--r--server/szurubooru/func/snapshots.py2
-rw-r--r--server/szurubooru/model/post.py12
-rw-r--r--server/szurubooru/search/configs/post_search_config.py2
9 files changed, 33 insertions, 16 deletions
diff --git a/INSTALL-OLD.md b/INSTALL-OLD.md
index f67796b..1cb2429 100644
--- a/INSTALL-OLD.md
+++ b/INSTALL-OLD.md
@@ -8,6 +8,12 @@ distributions are different, the steps stay roughly the same.
### Installing hard dependencies
+Szurubooru requires the following dependencies:
+- Python (3.5 or later)
+- Postgres
+- FFmpeg
+- node.js
+
```console
user@host:~$ sudo pacman -S postgresql
user@host:~$ sudo pacman -S python
diff --git a/README.md b/README.md
index 8679e93..42a31e5 100644
--- a/README.md
+++ b/README.md
@@ -25,16 +25,13 @@ scrubbing](http://sjp.pwn.pl/sjp/;2527372). It is pronounced as *shoorubooru*.
- Browser configurable endless paging
- Browser configurable backdrop grid for transparent images
-## Requirements
-
-- Python 3.5
-- Postgres
-- FFmpeg
-- node.js
+## Installation
It is recommended that you use Docker for deployment.
[See installation instructions.](https://github.com/rr-/szurubooru/blob/master/INSTALL.md)
+Users who wish to avoid using Docker may find the [old installation instructions](https://github.com/rr-/szurubooru/blob/master/INSTALL-OLD.md) helpful.
+
## Screenshots
Post list:
diff --git a/client/hooks/build b/client/hooks/build
new file mode 100755
index 0000000..8434e52
--- /dev/null
+++ b/client/hooks/build
@@ -0,0 +1,4 @@
+#!/bin/bash
+BUILD_INFO=docker-$(echo $SOURCE_COMMIT | cut -c1-7)-auto
+echo "Using BUILD_INFO=$BUILD_INFO"
+docker build --build-arg BUILD_INFO=$BUILD_INFO -f $DOCKERFILE_PATH -t $IMAGE_NAME .
diff --git a/client/nginx.conf.docker b/client/nginx.conf.docker
index 43a2d9f..6d8c9c1 100644
--- a/client/nginx.conf.docker
+++ b/client/nginx.conf.docker
@@ -18,7 +18,7 @@ http {
server_tokens off;
sendfile on;
keepalive_timeout 65;
- client_max_body_size 100M;
+ client_max_body_size 0;
upstream backend {
server __BACKEND__:6666;
diff --git a/server/requirements.txt b/server/requirements.txt
index b228e7b..a142493 100644
--- a/server/requirements.txt
+++ b/server/requirements.txt
@@ -3,8 +3,8 @@ pyyaml>=3.11
psycopg2-binary>=2.6.1
SQLAlchemy>=1.0.12
coloredlogs==5.0
-elasticsearch>=5.0.0
-elasticsearch-dsl>=5.0.0
+elasticsearch>=5.0.0,<7.0.0
+elasticsearch-dsl>=5.0.0,<7.0.0
numpy>=1.8.2
pillow>=4.3.0
pynacl==1.2.1
diff --git a/server/szurubooru/func/posts.py b/server/szurubooru/func/posts.py
index edd911e..b6816b0 100644
--- a/server/szurubooru/func/posts.py
+++ b/server/szurubooru/func/posts.py
@@ -224,7 +224,7 @@ class PostSerializer(serialization.BaseSerializer):
return get_post_thumbnail_url(self.post)
def serialize_flags(self) -> Any:
- return [x for x in self.post.flags.split(',') if x]
+ return self.post.flags
def serialize_tags(self) -> Any:
return [
@@ -376,7 +376,7 @@ def create_post(
post.safety = model.Post.SAFETY_SAFE
post.user = user
post.creation_time = datetime.utcnow()
- post.flags = ''
+ post.flags = []
post.type = ''
post.checksum = ''
@@ -497,7 +497,7 @@ def test_sound(post: model.Post, content: bytes) -> None:
assert content
if mime.is_video(mime.get_mime_type(content)):
if images.Image(content).check_for_sound():
- flags = [x for x in post.flags.split(',') if x]
+ flags = post.flags
if model.Post.FLAG_SOUND not in flags:
flags.append(model.Post.FLAG_SOUND)
update_post_flags(post, flags)
@@ -657,7 +657,7 @@ def update_post_flags(post: model.Post, flags: List[str]) -> None:
raise InvalidPostFlagError(
'Flag must be one of %r.' % list(FLAG_MAP.values()))
target_flags.append(flag)
- post.flags = ','.join(target_flags)
+ post.flags = target_flags
def feature_post(post: model.Post, user: Optional[model.User]) -> None:
diff --git a/server/szurubooru/func/snapshots.py b/server/szurubooru/func/snapshots.py
index b6a13e0..240c3bc 100644
--- a/server/szurubooru/func/snapshots.py
+++ b/server/szurubooru/func/snapshots.py
@@ -29,7 +29,7 @@ def get_post_snapshot(post: model.Post) -> Dict[str, Any]:
'source': post.source,
'safety': post.safety,
'checksum': post.checksum,
- 'flags': sorted(post.flags.split(',')),
+ 'flags': post.flags,
'featured': post.is_featured,
'tags': sorted([tag.first_name for tag in post.tags]),
'relations': sorted([rel.post_id for rel in post.relations]),
diff --git a/server/szurubooru/model/post.py b/server/szurubooru/model/post.py
index 91eac4d..987f720 100644
--- a/server/szurubooru/model/post.py
+++ b/server/szurubooru/model/post.py
@@ -1,6 +1,8 @@
+from typing import List
import sqlalchemy as sa
from szurubooru.model.base import Base
from szurubooru.model.comment import Comment
+from sqlalchemy.ext.hybrid import hybrid_property
class PostFeature(Base):
@@ -169,7 +171,7 @@ class Post(Base):
last_edit_time = sa.Column('last_edit_time', sa.DateTime)
safety = sa.Column('safety', sa.Unicode(32), nullable=False)
source = sa.Column('source', sa.Unicode(200))
- flags = sa.Column('flags', sa.Unicode(200), default='')
+ flags_string = sa.Column('flags', sa.Unicode(200), default='')
# content description
type = sa.Column('type', sa.Unicode(32), nullable=False)
@@ -223,6 +225,14 @@ class Post(Base):
.first())
return featured_post and featured_post.post_id == self.post_id
+ @hybrid_property
+ def flags(self) -> List[str]:
+ return sorted([x for x in self.flags_string.split(',') if x])
+
+ @flags.setter
+ def flags(self, data: List[str]) -> None:
+ self.flags_string = ','.join([x for x in data if x])
+
score = sa.orm.column_property(
sa.sql.expression.select(
[sa.sql.expression.func.coalesce(
diff --git a/server/szurubooru/search/configs/post_search_config.py b/server/szurubooru/search/configs/post_search_config.py
index e8318f4..7bb540e 100644
--- a/server/szurubooru/search/configs/post_search_config.py
+++ b/server/szurubooru/search/configs/post_search_config.py
@@ -382,7 +382,7 @@ class PostSearchConfig(BaseSearchConfig):
(
['flag'],
search_util.create_str_filter(
- model.Post.flags, _flag_transformer)
+ model.Post.flags_string, _flag_transformer)
),
]))
return filters