def main(): """Main page.""" banned = check_banned() if banned: return render_template( 'error.min.html', message='You are banned from using this tool! Reason: ' + banned, loggedin=False) try: auth = dologin() session['language'] = querylanguage(auth) except: # SECURITY: If we cannot login, the session is invalid. app.session_interface.abandon_session(app, session) return render_template('main.min.html', loggedin=False) return render_template('main.min.html', loggedin=True)
def run_task_internal(filename, params): """Internal run task function to accept whatever params given.""" banned = check_banned() assert not banned, 'You are banned from using this tool! Reason: ' + banned res = worker.main.delay(*params) taskid = res.id expire = 14 * 24 * 3600 # 2 weeks redisconnection.lpush('alltasks', taskid) redisconnection.expire('alltasks', expire) redisconnection.lpush('tasks:' + session['username'], taskid) redisconnection.expire('tasks:' + session['username'], expire) redisconnection.set('titles:' + taskid, filename) redisconnection.expire('titles:' + taskid, expire) redisconnection.set('params:' + taskid, pickle.dumps(params)) redisconnection.expire('params:' + taskid, expire) return taskid
def run_task_internal(filename, params): """Internal run task function to accept whatever params given.""" banned = check_banned() assert not banned, 'You are banned from using this tool! Reason: ' + banned res = worker.main.delay(*params) taskid = res.id expire = 14 * 24 * 3600 # 2 weeks redisconnection.lpush('alltasks', taskid) redisconnection.expire('alltasks', expire) redisconnection.lpush('tasks:' + session['username'], taskid) redisconnection.expire('tasks:' + session['username'], expire) redisconnection.set('titles:' + taskid, filename) redisconnection.expire('titles:' + taskid, expire) redisconnection.set('params:' + taskid, json.dumps(params)) redisconnection.expire('params:' + taskid, expire) redis_publish('add', {'taskid': taskid, 'user': session['username']}) redis_publish('update', {'taskid': taskid, 'data': _status(taskid)}) return taskid
def main(): """Main page.""" banned = check_banned() if banned: return render_template( 'error.min.html', message='You are banned from using this tool! Reason: ' + banned, loggedin=False ) try: auth = dologin() session['language'] = querylanguage(auth) except: return render_template( 'main.min.html', loggedin=False ) return render_template( 'main.min.html', loggedin=True )