def index(self, *args, **kwargs): self.getBaseUrl(redirect_unencrypted=True) firstrun = 0 == self.userdb.getUserCount() show_page = self.mainpage #generated main.html from devel.html if 'devel' in kwargs: #reload pages everytime in devel mode show_page = readRes('res/devel.html') self.loginpage = readRes('res/login.html') self.firstrunpage = readRes('res/firstrun.html') if 'login' in kwargs: username = kwargs.get('username', '') password = kwargs.get('password', '') login_action = kwargs.get('login', '') if login_action == 'login': self.session_auth(username, password) if cherrypy.session['username']: username = cherrypy.session['username'] log.i(_('user {name} just logged in.').format(name=username)) elif login_action == 'create admin user': if firstrun: if username.strip() and password.strip(): self.userdb.addUser(username, password, True) self.session_auth(username, password) return show_page else: return "No, you can't." if firstrun: return self.firstrunpage else: if self.isAuthorized(): return show_page else: return self.loginpage
def index(self, *args, **kwargs): self.getBaseUrl(redirect_unencrypted=True) firstrun = 0 == self.userdb.getUserCount() show_page = self.mainpage #generated main.html from devel.html if 'devel' in kwargs: #reload pages everytime in devel mode show_page = readRes('res/devel.html') self.loginpage = readRes('res/login.html') self.firstrunpage = readRes('res/firstrun.html') if 'login' in kwargs: username = kwargs.get('username', '') password = kwargs.get('password', '') login_action = kwargs.get('login', '') if login_action == 'login': self.session_auth(username, password) if cherrypy.session['username']: username = cherrypy.session['username'] log.i(_('user {name} just logged in.').format(name=username)) elif login_action == 'create admin user': if firstrun: if username.strip() and password.strip(): self.userdb.addUser(username, password, True) self.session_auth(username, password) return show_page else: return "No, you can't." if firstrun: return self.firstrunpage else: if self.isAuthorized(): return show_page else: return self.loginpage
def index(self, *args, **kwargs): self.getBaseUrl(redirect_unencrypted=True) firstrun = 0 == self.userdb.getUserCount() show_page = self.mainpage # generated main.html from devel.html if "devel" in kwargs: # reload pages everytime in devel mode show_page = readRes("res/devel.html") self.loginpage = readRes("res/login.html") self.firstrunpage = readRes("res/firstrun.html") if "login" in kwargs: username = kwargs.get("username", "") password = kwargs.get("password", "") login_action = kwargs.get("login", "") if login_action == "login": self.session_auth(username, password) if cherrypy.session["username"]: username = cherrypy.session["username"] log.i(_("user {name} just logged in.").format(name=username)) elif login_action == "create admin user": if firstrun: if username.strip() and password.strip(): self.userdb.addUser(username, password, True) self.session_auth(username, password) return show_page else: return "No, you can't." if firstrun: return self.firstrunpage else: if self.isAuthorized(): return show_page else: return self.loginpage
def __init__(self, config): self.config = config template_main = 'res/dist/main.html' template_login = '******' template_firstrun = 'res/firstrun.html' self.mainpage = readRes(template_main) self.loginpage = readRes(template_login) self.firstrunpage = readRes(template_firstrun) self.handlers = { 'search': self.api_search, 'rememberplaylist': self.api_rememberplaylist, 'saveplaylist': self.api_saveplaylist, 'loadplaylist': self.api_loadplaylist, 'generaterandomplaylist': self.api_generaterandomplaylist, 'deleteplaylist': self.api_deleteplaylist, 'getmotd': self.api_getmotd, 'restoreplaylist': self.api_restoreplaylist, 'getplayables': self.api_getplayables, 'getuserlist': self.api_getuserlist, 'adduser': self.api_adduser, 'userdelete': self.api_userdelete, 'userchangepassword': self.api_userchangepassword, 'showplaylists': self.api_showplaylists, 'logout': self.api_logout, 'downloadpls': self.api_downloadpls, 'downloadm3u': self.api_downloadm3u, 'getsonginfo': self.api_getsonginfo, 'getencoders': self.api_getencoders, 'getdecoders': self.api_getdecoders, 'transcodingenabled': self.api_transcodingenabled, 'updatedb': self.api_updatedb, 'getconfiguration': self.api_getconfiguration, 'compactlistdir': self.api_compactlistdir, 'listdir': self.api_listdir, 'fetchalbumart': self.api_fetchalbumart, 'fetchalbumarturls': self.api_fetchalbumarturls, 'albumart_set': self.api_albumart_set, 'heartbeat': self.api_heartbeat, 'getuseroptions': self.api_getuseroptions, 'setuseroption': self.api_setuseroption, 'changeplaylist': self.api_changeplaylist, 'downloadcheck': self.api_downloadcheck, 'setuseroptionfor': self.api_setuseroptionfor, }
def __init__(self, config): self.config = config template_main = 'res/dist/main.html' template_login = '******' template_firstrun = 'res/firstrun.html' self.mainpage = readRes(template_main) self.loginpage = readRes(template_login) self.firstrunpage = readRes(template_firstrun) self.handlers = { 'search': self.api_search, 'rememberplaylist': self.api_rememberplaylist, 'saveplaylist': self.api_saveplaylist, 'loadplaylist': self.api_loadplaylist, 'generaterandomplaylist': self.api_generaterandomplaylist, 'deleteplaylist': self.api_deleteplaylist, 'getmotd': self.api_getmotd, 'restoreplaylist': self.api_restoreplaylist, 'getplayables': self.api_getplayables, 'getuserlist': self.api_getuserlist, 'adduser': self.api_adduser, 'userdelete': self.api_userdelete, 'userchangepassword': self.api_userchangepassword, 'showplaylists': self.api_showplaylists, 'logout': self.api_logout, 'downloadpls': self.api_downloadpls, 'downloadm3u': self.api_downloadm3u, 'getsonginfo': self.api_getsonginfo, 'getencoders': self.api_getencoders, 'getdecoders': self.api_getdecoders, 'transcodingenabled': self.api_transcodingenabled, 'updatedb': self.api_updatedb, 'getconfiguration': self.api_getconfiguration, 'compactlistdir': self.api_compactlistdir, 'listdir': self.api_listdir, 'fetchalbumart': self.api_fetchalbumart, 'fetchalbumarturls': self.api_fetchalbumarturls, 'albumart_set': self.api_albumart_set, 'heartbeat': self.api_heartbeat, 'getuseroptions': self.api_getuseroptions, 'setuseroption': self.api_setuseroption, 'changeplaylist': self.api_changeplaylist, 'downloadcheck': self.api_downloadcheck, 'setuseroptionfor': self.api_setuseroptionfor, }
def __init__(self, config): self.config = config template_main = "res/dist/main.html" template_login = "******" template_firstrun = "res/firstrun.html" self.mainpage = readRes(template_main) self.loginpage = readRes(template_login) self.firstrunpage = readRes(template_firstrun) self.handlers = { "search": self.api_search, "rememberplaylist": self.api_rememberplaylist, "saveplaylist": self.api_saveplaylist, "loadplaylist": self.api_loadplaylist, "generaterandomplaylist": self.api_generaterandomplaylist, "deleteplaylist": self.api_deleteplaylist, "getmotd": self.api_getmotd, "restoreplaylist": self.api_restoreplaylist, "getplayables": self.api_getplayables, "getuserlist": self.api_getuserlist, "adduser": self.api_adduser, "userdelete": self.api_userdelete, "userchangepassword": self.api_userchangepassword, "showplaylists": self.api_showplaylists, "logout": self.api_logout, "downloadpls": self.api_downloadpls, "downloadm3u": self.api_downloadm3u, "getsonginfo": self.api_getsonginfo, "getencoders": self.api_getencoders, "getdecoders": self.api_getdecoders, "transcodingenabled": self.api_transcodingenabled, "updatedb": self.api_updatedb, "getconfiguration": self.api_getconfiguration, "compactlistdir": self.api_compactlistdir, "listdir": self.api_listdir, "fetchalbumart": self.api_fetchalbumart, "fetchalbumarturls": self.api_fetchalbumarturls, "albumart_set": self.api_albumart_set, "heartbeat": self.api_heartbeat, "getuseroptions": self.api_getuseroptions, "setuseroption": self.api_setuseroption, "changeplaylist": self.api_changeplaylist, "downloadcheck": self.api_downloadcheck, "setuseroptionfor": self.api_setuseroptionfor, }
def index(self): return pathprovider.readRes('res/setup.html')
def index(self): return pathprovider.readRes('res/setup.html')