1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Refactoring

This commit is contained in:
krateng 2021-12-23 05:17:19 +01:00
parent 1e70a523b2
commit 36c8f2654e
2 changed files with 27 additions and 24 deletions

View File

@ -13,14 +13,16 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v2
- name: Install dependencies
run: pip install wheel setuptools
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install Doreah (imported on build)
run: pip install doreah
- name: Install dependencies
run: pip install build doreah
- name: Build package
run: python setup.py sdist bdist_wheel
run: python -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

View File

@ -1,9 +1,21 @@
#!/usr/bin/env python
# technical
import sys
import signal
import os
from threading import Thread
import setproctitle
import pkg_resources
from css_html_js_minify import html_minify, css_minify
from wand.image import Image as WandImage
# server stuff
from bottle import Bottle, static_file, request, response, FormsDict, redirect, BaseRequest, abort
import waitress
# doreah toolkit
from doreah.logging import log
from doreah.timing import Clock
from doreah import auth
# rest of the project
from . import database
@ -12,19 +24,8 @@ from .malojauri import uri_to_internal, remove_identical
from .globalconf import malojaconfig, data_dir
from .jinjaenv.context import jinja_environment
from .apis import init_apis
# doreah toolkit
from doreah.logging import log
from doreah.timing import Clock
from doreah import auth
# technical
from threading import Thread
import sys
import signal
import os
import setproctitle
import pkg_resources
from css_html_js_minify import html_minify, css_minify
from wand.image import Image as WandImage
######
@ -50,18 +51,18 @@ setproctitle.setproctitle("Maloja")
def generate_css():
css = ""
cssstr = ""
for file in os.listdir(os.path.join(STATICFOLDER,"css")):
with open(os.path.join(STATICFOLDER,"css",file),"r") as filed:
css += filed.read()
cssstr += filed.read()
for file in os.listdir(data_dir['css']()):
if file.endswith(".css"):
with open(os.path.join(data_dir['css'](file)),"r") as filed:
css += filed.read()
cssstr += filed.read()
css = css_minify(css)
return css
cssstr = css_minify(cssstr)
return cssstr
css = generate_css()