Skip to content

Commit

Permalink
Merge branch 'release/1.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Henjuro committed May 29, 2018
2 parents e80adfe + f260626 commit 96875e2
Show file tree
Hide file tree
Showing 138 changed files with 4,153 additions and 2,503 deletions.
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
#Changelog
* 1.3.0
* Fixes
* Ban for character banned users did not work when esi was not responding
* Fix a typo in Open Mail endpoint preventing it from working
* this did not affect anything since the waitlist did not use the feature of this codepath
* The Edit Account Dialog now properly selects all roles an Account has, if the account has a `New` tag
* Fix an exception that was not properly handled which prevented unknown modules to be loaded from ESI
* Features
* The whole token management got reworked and the waitlist can now have more then 1 token per character
This means that e.g. you don't need to reauth evertime you change from sending a mail to taking fleet and the other way round.
* Added config option: `app -> user_agent` to allow setting a custom user agent to use for ESI interaction
* Reworked login management and introduced new config option: `security -> require_auth_for_chars` (Normal Visitors to the site are not an Account)
* If this is **enabled** Waitlist Account user
* can only set a character after poviding authentication for it
* can login to the waitlist with any of the authenticated alts
* If this is **disabled** Waitlist Account user
* can only login with the Eve Character that matches their Account usnername
* can set any Character as the character to use for the Waitlist
* Added option for accounts with a group that has the new permission 'change_character_links' to remove and add character links for accounts
* Improvements
* Before assinging some one as Fleet Comp to a fleet on take over it is now check that this character has Fleet Boss on the fleet instead of just checking if he is a member of the fleet.
* Added an AccountNote if a Account's username is changed
* Notes now contain a jsonPayload that can hold more information e.g. the body of a mail sent etc. for old notes this info is lost
* the migration script converts old notes to the new format and extracts as much data as possible
* Account list download is now as json and offeres multiple options of which data should be included
* 1.2.3
* Fixes
* Waitlist Group can not be cleared
Expand Down
3 changes: 0 additions & 3 deletions create_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

from waitlist import db
from waitlist.permissions.manager import StaticRoles
from waitlist.utility.swagger.patch import monkey_patch_pyswagger_requests_client

monkey_patch_pyswagger_requests_client()
from waitlist.storage.database import Account, Character, Role, APICacheCharacterInfo
from waitlist.utility.utils import get_random_token
import waitlist.utility.outgate as outgate
Expand Down
24 changes: 13 additions & 11 deletions ffsc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from multiprocessing import Process, JoinableQueue
from typing import List, Union

from waitlist.storage.database import Shipfit, InvType, FitModule
from waitlist import db, manager

Expand Down Expand Up @@ -30,25 +32,25 @@ def convert(offset, limit):
if moduleDefStr == '':
continue
try:
moduleDefArr = moduleDefStr.split(';')
if len(moduleDefArr) != 2:
module_def_arr: List[Union[str, int], Union[str, int]] = moduleDefStr.split(';')
if len(module_def_arr) != 2:
print("Skipping Module Fit ID=", fit.id, " Module Def Str:", moduleDefStr)
continue

# lets check here if that module exists
moduleDefArr[0] = int(moduleDefArr[0])
moduleDefArr[1] = int(moduleDefArr[1])
if moduleDefArr[1] > 2147483647 or moduleDefArr[1] < 0:
moduleDefArr[1] = 2147483647
module_def_arr[0] = int(module_def_arr[0])
module_def_arr[1] = int(module_def_arr[1])
if module_def_arr[1] > 2147483647 or module_def_arr[1] < 0:
module_def_arr[1] = 2147483647

module = db.session.query(InvType).get(moduleDefArr[0])
module = db.session.query(InvType).get(module_def_arr[0])
if module is None:
print("No Module with ID=", str(moduleDefArr[0]))
print("No Module with ID=", str(module_def_arr[0]))
continue

dbModule = FitModule(moduleID=moduleDefArr[0], amount=moduleDefArr[1])
fit.moduleslist.append(dbModule)
filtered_modules_string += str(moduleDefArr[0])+';'+str(moduleDefArr[1])+':'
db_module = FitModule(moduleID=module_def_arr[0], amount=module_def_arr[1])
fit.moduleslist.append(db_module)
filtered_modules_string += str(module_def_arr[0])+';'+str(module_def_arr[1])+':'
except ValueError as e:
print("Fit ID=", str(fit.id), " Module Def Str:", moduleDefStr)
raise e
Expand Down
2 changes: 2 additions & 0 deletions gevent_patch_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from gevent import monkey
monkey.patch_all()
69 changes: 37 additions & 32 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
from gevent import monkey
monkey.patch_all()
from waitlist.utility.swagger.patch import monkey_patch_pyswagger_requests_client
monkey_patch_pyswagger_requests_client()

import gevent_patch_helper
import logging
from werkzeug.contrib.fixers import ProxyFix
from logging.handlers import TimedRotatingFileHandler
from waitlist.blueprints.feedback import feedback
from gevent.pywsgi import WSGIServer
from waitlist import app
from waitlist.blueprints.fittings import bp_waitlist
from waitlist.blueprints.fc_sso import bp as fc_sso_bp
from waitlist.blueprints.fleet import bp as fleet_bp
Expand All @@ -32,18 +27,27 @@
from waitlist.blueprints.settings.ccvote_results import bp as bp_ccvote_settings
from waitlist.blueprints.fleetview import bp as bp_fleetview

from waitlist.blueprints.settings import accounts, bans, fleet_motd, fleetoptions, inserts, mail, overview,\
from waitlist.blueprints.settings import accounts as settings_accounts, bans, fleet_motd, fleetoptions, inserts, mail, overview,\
staticdataimport, teamspeak, permissions
from waitlist.blueprints import trivia
from waitlist.blueprints import trivia, feedback, swagger_api
from waitlist.blueprints.api import permission
from waitlist.blueprints.api import fittings
from waitlist.blueprints import xup
from waitlist.blueprints import notification
# needs to he here so signal handler gets registered
from waitlist.signal.handler import acc_created, roles_changed, account_status_change
from waitlist.signal import handler

# load the jinja2 hooks
from waitlist.utility.jinja2 import *

# load flask hooks
from waitlist.utility.flask import *

# load base app routes
from waitlist.blueprints import *


app.register_blueprint(bp_waitlist)
app.register_blueprint(feedback, url_prefix="/feedback")
app.register_blueprint(feedback.feedback, url_prefix="/feedback")
app.register_blueprint(fc_sso_bp, url_prefix="/fc_sso")
app.register_blueprint(fleet_bp, url_prefix="/fleet")
app.register_blueprint(api_fleet_bp, url_prefix="/api/fleet")
Expand All @@ -69,7 +73,7 @@
app.register_blueprint(trivia.submission.bp, url_prefix="/trivia")

# settings blueprints
app.register_blueprint(accounts.bp, url_prefix='/settings/accounts')
app.register_blueprint(settings_accounts.bp, url_prefix='/settings/accounts')
app.register_blueprint(bans.bp, url_prefix='/settings/bans')
app.register_blueprint(fleet_motd.bp, url_prefix='/settings/motd')
app.register_blueprint(fleetoptions.bp, url_prefix='/settings/fleet')
Expand All @@ -80,57 +84,55 @@
app.register_blueprint(teamspeak.bp, url_prefix='/settings/teamspeak')
app.register_blueprint(permissions.bp, url_prefix='/settings/permissions')
app.register_blueprint(permission.bp, url_prefix='/api/permission')
app.register_blueprint(fittings.bp, url_prefix='/api/fittings')
app.register_blueprint(xup.bp, url_prefix='/xup')


# notification

app.register_blueprint(notification.bp, url_prefix="/notification")

logger = logging.getLogger(__name__)

# load the jinja2 hooks
from waitlist.utility.jinja2 import *
err_fh = None
info_fh = None
debug_fh = None

# load flask hooks
from waitlist.utility.flask import *

# load base app routes
from waitlist.blueprints import *
class LogDedicatedLevelFilter(object):
def __init__(self, level):
self.__level = level

err_fh = None
info_fh = None
access_fh = None
debug_fh = None
def filter(self, log_record):
return log_record.levelno == self.__level


#@werkzeug.serving.run_with_reloader
def runServer():
def run_server():
wsgi_logger = logging.getLogger("gevent.pywsgi.WSGIServer")
wsgi_logger.addHandler(err_fh)
wsgi_logger.addHandler(access_fh)
wsgi_logger.addHandler(info_fh)
wsgi_logger.addHandler(debug_fh)
wsgi_logger.setLevel(logging.INFO)
app.wsgi_app = ProxyFix(app.wsgi_app)
server = WSGIServer((config.server_bind, config.server_port), app, log=wsgi_logger, error_log=wsgi_logger)
server.serve_forever()


if __name__ == '__main__':
err_fh = TimedRotatingFileHandler(filename=config.error_log, when="midnight", interval=1, utc=True)
info_fh = TimedRotatingFileHandler(filename=config.info_log, when="midnight", interval=1, utc=True)
access_fh = TimedRotatingFileHandler(filename=config.access_log, when="midnight", interval=1, utc=True)
debug_fh = TimedRotatingFileHandler(filename=config.debug_log, when="midnight", interval=1, utc=True)

formatter = logging\
.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(pathname)s - %(funcName)s - %(lineno)d - %(message)s')
err_fh.setFormatter(formatter)
info_fh.setFormatter(formatter)
access_fh.setFormatter(formatter)
debug_fh.setFormatter(formatter)

info_fh.setLevel(logging.INFO)
err_fh.setLevel(logging.ERROR)
debug_fh.setLevel(logging.DEBUG)

info_fh.addFilter(LogDedicatedLevelFilter(logging.INFO))
debug_fh.addFilter(LogDedicatedLevelFilter(logging.DEBUG))

waitlistlogger = logging.getLogger("waitlist")
waitlistlogger.addHandler(err_fh)
waitlistlogger.addHandler(info_fh)
Expand All @@ -143,4 +145,7 @@ def runServer():
app.logger.setLevel(logging.INFO)

# app.run(host="0.0.0.0", port=81, debug=True)
runServer()

# connect account signal handler
handler.account.connect()
run_server()
7 changes: 1 addition & 6 deletions manager.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# inject the lib folder before everything else
import os
import sys

from waitlist import manager

base_path = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(base_path, 'lib'))
from waitlist.storage.database import *

if __name__ == '__main__':
manager.run()
9 changes: 3 additions & 6 deletions migrations/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,17 @@
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
import logging

from flask import current_app
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config

# Interpret the config file for Python logging.
# This line sets up loggers basically.

fileConfig(config.config_file_name)
logger = logging.getLogger('alembic.env')

# add your model's MetaData object here
# for 'autogenerate' support
# from myapp import mymodel
# target_metadata = mymodel.Base.metadata
from flask import current_app
config.set_main_option('sqlalchemy.url',
current_app.config.get('SQLALCHEMY_DATABASE_URI'))
target_metadata = current_app.extensions['migrate'].db.metadata
Expand Down Expand Up @@ -81,6 +77,7 @@ def process_revision_directives(context, revision, directives):
finally:
connection.close()


if context.is_offline_mode():
run_migrations_offline()
else:
Expand Down
Loading

0 comments on commit 96875e2

Please sign in to comment.