Merge branch 'master' into staging
This commit is contained in:
commit
7be52053bd
7 changed files with 72 additions and 30 deletions
|
@ -46,7 +46,7 @@ build_docker:
|
||||||
build_wheel:
|
build_wheel:
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- python3.6 setup.py egg_info bdist_wheel
|
- python3.7 setup.py egg_info bdist_wheel
|
||||||
- cd dist
|
- cd dist
|
||||||
- sha256sum *.whl > SHA256SUMS
|
- sha256sum *.whl > SHA256SUMS
|
||||||
artifacts:
|
artifacts:
|
||||||
|
@ -71,16 +71,16 @@ build_debian:
|
||||||
- gzip -9n package/debian/matemat/usr/share/doc/matemat/changelog
|
- gzip -9n package/debian/matemat/usr/share/doc/matemat/changelog
|
||||||
- cp -r static/ package/debian/matemat/usr/lib/matemat/static/
|
- cp -r static/ package/debian/matemat/usr/lib/matemat/static/
|
||||||
- cp -r templates/ package/debian/matemat/usr/lib/matemat/templates/
|
- cp -r templates/ package/debian/matemat/usr/lib/matemat/templates/
|
||||||
- python3.6 setup.py egg_info install --root=package/debian/matemat/ --prefix=/usr --optimize=1
|
- python3.7 setup.py egg_info install --root=package/debian/matemat/ --prefix=/usr --optimize=1
|
||||||
- cd package/debian
|
- cd package/debian
|
||||||
- mkdir -p matemat/usr/lib/python3/dist-packages/
|
- mkdir -p matemat/usr/lib/python3/dist-packages/
|
||||||
- rsync -a matemat/usr/lib/python3.6/site-packages/ matemat/usr/lib/python3/dist-packages/
|
- rsync -a matemat/usr/lib/python3.7/site-packages/ matemat/usr/lib/python3/dist-packages/
|
||||||
- rm -rf matemat/usr/lib/python3.6/
|
- rm -rf matemat/usr/lib/python3.7/
|
||||||
- find matemat/usr/lib/python3/dist-packages -name __pycache__ -exec rm -r {} \; 2>/dev/null || true
|
- find matemat/usr/lib/python3/dist-packages -name __pycache__ -exec rm -r {} \; 2>/dev/null || true
|
||||||
- find matemat/usr/lib/python3/dist-packages -name '*.pyc' -exec rm {} \;
|
- find matemat/usr/lib/python3/dist-packages -name '*.pyc' -exec rm {} \;
|
||||||
- mv matemat/usr/bin/matemat matemat/usr/lib/matemat/matemat
|
- mv matemat/usr/bin/matemat matemat/usr/lib/matemat/matemat
|
||||||
- rm -rf matemat/usr/bin
|
- rm -rf matemat/usr/bin
|
||||||
- sed -re 's$#!/usr/local/bin/python3.6$#!/usr/bin/python3$' -i matemat/usr/lib/matemat/matemat
|
- sed -re 's$#!/usr/local/bin/python3.7$#!/usr/bin/python3$' -i matemat/usr/lib/matemat/matemat
|
||||||
- find matemat -type f -exec chmod 0644 {} \;
|
- find matemat -type f -exec chmod 0644 {} \;
|
||||||
- find matemat -type d -exec chmod 755 {} \;
|
- find matemat -type d -exec chmod 755 {} \;
|
||||||
- chmod +x matemat/usr/lib/matemat/matemat matemat/DEBIAN/postinst matemat/DEBIAN/prerm matemat/DEBIAN/postrm
|
- chmod +x matemat/usr/lib/matemat/matemat matemat/DEBIAN/postinst matemat/DEBIAN/prerm matemat/DEBIAN/postrm
|
||||||
|
@ -99,7 +99,7 @@ build_archlinux:
|
||||||
stage: build
|
stage: build
|
||||||
image: archlinux/base:latest # Use an archlinux image instead of the customized debian image.
|
image: archlinux/base:latest # Use an archlinux image instead of the customized debian image.
|
||||||
script:
|
script:
|
||||||
- pacman -Sy --noconfirm python python-setuptools python-pip python-wheel python-jinja python-pillow python-magic base-devel
|
- pacman -Sy --noconfirm python python-setuptools python-pip python-wheel python-bottle python-jinja python-pillow python-magic base-devel
|
||||||
- export MATEMAT_VERSION=$(python -c 'import matemat; print(matemat.__version__)')
|
- export MATEMAT_VERSION=$(python -c 'import matemat; print(matemat.__version__)')
|
||||||
- cp -r static/ package/archlinux/matemat/usr/lib/matemat/static/
|
- cp -r static/ package/archlinux/matemat/usr/lib/matemat/static/
|
||||||
- cp -r templates/ package/archlinux/matemat/usr/lib/matemat/templates/
|
- cp -r templates/ package/archlinux/matemat/usr/lib/matemat/templates/
|
||||||
|
|
39
CHANGELOG.md
39
CHANGELOG.md
|
@ -1,5 +1,44 @@
|
||||||
# Matemat Changelog
|
# Matemat Changelog
|
||||||
|
|
||||||
|
<!-- BEGIN RELEASE v0.2.3 -->
|
||||||
|
## Version 0.2.3
|
||||||
|
|
||||||
|
Bugfix fix release
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
<!-- BEGIN CHANGES 0.2.3 -->
|
||||||
|
- Fix: Session timeout lead to 500 error
|
||||||
|
<!-- END CHANGES 0.2.3 -->
|
||||||
|
|
||||||
|
<!-- END RELEASE v0.2.3 -->
|
||||||
|
|
||||||
|
<!-- BEGIN RELEASE v0.2.2 -->
|
||||||
|
## Version 0.2.2
|
||||||
|
|
||||||
|
Security fix release
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
<!-- BEGIN CHANGES 0.2.2 -->
|
||||||
|
- Fix: Sessions were shared between clients
|
||||||
|
<!-- END CHANGES 0.2.2 -->
|
||||||
|
|
||||||
|
<!-- END RELEASE v0.2.2 -->
|
||||||
|
|
||||||
|
<!-- BEGIN RELEASE v0.2.1 -->
|
||||||
|
## Version 0.2.1
|
||||||
|
|
||||||
|
Hotfix release
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
<!-- BEGIN CHANGES 0.2.1 -->
|
||||||
|
- Fix: Properly load config
|
||||||
|
<!-- END CHANGES 0.2.1 -->
|
||||||
|
|
||||||
|
<!-- END RELEASE v0.2.1 -->
|
||||||
|
|
||||||
<!-- BEGIN RELEASE v0.2 -->
|
<!-- BEGIN RELEASE v0.2 -->
|
||||||
## Version 0.2
|
## Version 0.2
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
|
|
||||||
__version__ = '0.2'
|
__version__ = '0.2.3'
|
||||||
|
|
|
@ -7,7 +7,7 @@ import bottle
|
||||||
from matemat.db import MatematDatabase
|
from matemat.db import MatematDatabase
|
||||||
from matemat.webserver import cron
|
from matemat.webserver import cron
|
||||||
from matemat.webserver.logger import Logger
|
from matemat.webserver.logger import Logger
|
||||||
from matemat.webserver.config import get_config, parse_config_file
|
from matemat.webserver.config import get_config, get_app_config, parse_config_file
|
||||||
from matemat.webserver.template import init as template_init
|
from matemat.webserver.template import init as template_init
|
||||||
|
|
||||||
# Those imports are actually needed, as they implicitly register pagelets.
|
# Those imports are actually needed, as they implicitly register pagelets.
|
||||||
|
@ -18,41 +18,41 @@ from matemat.webserver.pagelets import *
|
||||||
def _init(config: Dict[str, Any]):
|
def _init(config: Dict[str, Any]):
|
||||||
logger = Logger.instance()
|
logger = Logger.instance()
|
||||||
# Set default values for missing config items
|
# Set default values for missing config items
|
||||||
if 'InstanceName' not in config:
|
if 'InstanceName' not in config['pagelet_variables']:
|
||||||
config['InstanceName'] = 'Matemat'
|
config['pagelet_variables']['InstanceName'] = 'Matemat'
|
||||||
logger.warning('Property \'InstanceName\' not set, using \'Matemat\'')
|
logger.warning('Property \'InstanceName\' not set, using \'Matemat\'')
|
||||||
if 'UploadDir' not in config:
|
if 'UploadDir' not in config['pagelet_variables']:
|
||||||
config['UploadDir'] = './static/upload/'
|
config['pagelet_variables']['UploadDir'] = './static/upload/'
|
||||||
logger.warning('Property \'UploadDir\' not set, using \'./static/upload/\'')
|
logger.warning('Property \'UploadDir\' not set, using \'./static/upload/\'')
|
||||||
if 'DatabaseFile' not in config:
|
if 'DatabaseFile' not in config['pagelet_variables']:
|
||||||
config['DatabaseFile'] = './matemat.db'
|
config['pagelet_variables']['DatabaseFile'] = './matemat.db'
|
||||||
logger.warning('Property \'DatabaseFile\' not set, using \'./matemat.db\'')
|
logger.warning('Property \'DatabaseFile\' not set, using \'./matemat.db\'')
|
||||||
if 'SmtpSendReceipts' not in config:
|
if 'SmtpSendReceipts' not in config['pagelet_variables']:
|
||||||
config['SmtpSendReceipts'] = '0'
|
config['pagelet_variables']['SmtpSendReceipts'] = '0'
|
||||||
logger.warning('Property \'SmtpSendReceipts\' not set, using \'0\'')
|
logger.warning('Property \'SmtpSendReceipts\' not set, using \'0\'')
|
||||||
if config['SmtpSendReceipts'] == '1':
|
if config['pagelet_variables']['SmtpSendReceipts'] == '1':
|
||||||
if 'SmtpFrom' not in config:
|
if 'SmtpFrom' not in config['pagelet_variables']:
|
||||||
logger.fatal('\'SmtpSendReceipts\' set to \'1\', but \'SmtpFrom\' missing.')
|
logger.fatal('\'SmtpSendReceipts\' set to \'1\', but \'SmtpFrom\' missing.')
|
||||||
raise KeyError()
|
raise KeyError()
|
||||||
if 'SmtpSubj' not in config:
|
if 'SmtpSubj' not in config['pagelet_variables']:
|
||||||
logger.fatal('\'SmtpSendReceipts\' set to \'1\', but \'SmtpSubj\' missing.')
|
logger.fatal('\'SmtpSendReceipts\' set to \'1\', but \'SmtpSubj\' missing.')
|
||||||
raise KeyError()
|
raise KeyError()
|
||||||
if 'SmtpHost' not in config:
|
if 'SmtpHost' not in config['pagelet_variables']:
|
||||||
logger.fatal('\'SmtpSendReceipts\' set to \'1\', but \'SmtpHost\' missing.')
|
logger.fatal('\'SmtpSendReceipts\' set to \'1\', but \'SmtpHost\' missing.')
|
||||||
raise KeyError()
|
raise KeyError()
|
||||||
if 'SmtpPort' not in config:
|
if 'SmtpPort' not in config['pagelet_variables']:
|
||||||
logger.fatal('\'SmtpSendReceipts\' set to \'1\', but \'SmtpPort\' missing.')
|
logger.fatal('\'SmtpSendReceipts\' set to \'1\', but \'SmtpPort\' missing.')
|
||||||
raise KeyError()
|
raise KeyError()
|
||||||
if 'SmtpUser' not in config:
|
if 'SmtpUser' not in config['pagelet_variables']:
|
||||||
logger.fatal('\'SmtpSendReceipts\' set to \'1\', but \'SmtpUser\' missing.')
|
logger.fatal('\'SmtpSendReceipts\' set to \'1\', but \'SmtpUser\' missing.')
|
||||||
raise KeyError()
|
raise KeyError()
|
||||||
if 'SmtpPass' not in config:
|
if 'SmtpPass' not in config['pagelet_variables']:
|
||||||
logger.fatal('\'SmtpSendReceipts\' set to \'1\', but \'SmtpPass\' missing.')
|
logger.fatal('\'SmtpSendReceipts\' set to \'1\', but \'SmtpPass\' missing.')
|
||||||
raise KeyError()
|
raise KeyError()
|
||||||
if 'SmtpEnforceTLS' not in config:
|
if 'SmtpEnforceTLS' not in config['pagelet_variables']:
|
||||||
config['SmtpEnforceTLS'] = '1'
|
config['SmtpEnforceTLS'] = '1'
|
||||||
logger.warning('Property \'SmtpEnforceTLS\' not set, using \'1\'')
|
logger.warning('Property \'SmtpEnforceTLS\' not set, using \'1\'')
|
||||||
with MatematDatabase(config['DatabaseFile']):
|
with MatematDatabase(config['pagelet_variables']['DatabaseFile']):
|
||||||
# Connect to the database to create it and perform any schema migrations
|
# Connect to the database to create it and perform any schema migrations
|
||||||
pass
|
pass
|
||||||
# Initialize Jinaj2 template system
|
# Initialize Jinaj2 template system
|
||||||
|
|
|
@ -23,15 +23,18 @@ def start() -> str:
|
||||||
# Reference date for session timeout
|
# Reference date for session timeout
|
||||||
now = datetime.utcnow()
|
now = datetime.utcnow()
|
||||||
# Read the client's session ID, if any
|
# Read the client's session ID, if any
|
||||||
session_id = str(request.get_cookie(_COOKIE_NAME, secret=__key))
|
session_id = request.get_cookie(_COOKIE_NAME, secret=__key)
|
||||||
# If there is no active session, create a new session ID
|
# If there is no active session, create a new session ID
|
||||||
if session_id is None:
|
if session_id is None:
|
||||||
session_id = str(uuid4())
|
session_id = str(uuid4())
|
||||||
|
else:
|
||||||
|
session_id = str(session_id)
|
||||||
|
|
||||||
# Check for session timeout
|
# Check for session timeout
|
||||||
if session_id in __session_vars and __session_vars[session_id][0] < now:
|
if session_id in __session_vars and __session_vars[session_id][0] < now:
|
||||||
end(session_id)
|
end(session_id)
|
||||||
raise TimeoutError('Session timed out.')
|
# Create new session ID after terminating the previous session
|
||||||
|
session_id = str(uuid4())
|
||||||
# Update or initialize the session timeout
|
# Update or initialize the session timeout
|
||||||
if session_id not in __session_vars:
|
if session_id not in __session_vars:
|
||||||
__session_vars[session_id] = (now + timedelta(seconds=_SESSION_TIMEOUT)), dict()
|
__session_vars[session_id] = (now + timedelta(seconds=_SESSION_TIMEOUT)), dict()
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# Maintainer: s3lph <account-gitlab-ideynizv@kernelpanic.lol>
|
# Maintainer: s3lph <account-gitlab-ideynizv@kernelpanic.lol>
|
||||||
|
|
||||||
pkgname=matemat
|
pkgname=matemat
|
||||||
pkgver=0.1
|
pkgver=0.2.3
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
arch=('any')
|
arch=('any')
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ licence=('MIT')
|
||||||
|
|
||||||
depends=(
|
depends=(
|
||||||
'python'
|
'python'
|
||||||
'ptyhon-bottle'
|
'python-bottle'
|
||||||
'python-jinja'
|
'python-jinja'
|
||||||
'python-pillow'
|
'python-pillow'
|
||||||
'python-magic'
|
'python-magic'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Package: matemat
|
Package: matemat
|
||||||
Version: 0.1
|
Version: 0.2.3
|
||||||
Maintainer: s3lph <account-gitlab-ideynizv@kernelpanic.lol>
|
Maintainer: s3lph <account-gitlab-ideynizv@kernelpanic.lol>
|
||||||
Section: web
|
Section: web
|
||||||
Priority: optional
|
Priority: optional
|
||||||
|
|
Loading…
Reference in a new issue