def __init__(self): self.auth = AuthController() self.postprocessing = Postprocessing() self.api = api.API() if core.CONFIG['Server']['authrequired']: self._cp_config = { 'auth.require': [] } self.ajax = ajax.Ajax() localization.get() localization.install() # point server toward custom 404 cherrypy.config.update({ 'error_page.404': self.error_page_404 }) # Lock down settings if required if core.CONFIG['Server']['adminrequired']: self.settings._cp_config['auth.require'] = [core.auth.is_admin] if core.CONFIG['Server']['checkupdates']: scheduler.AutoUpdateCheck.update_check(install=False)
def __init__(self): LOG.debug("JellyfinClient initializing...") self.config = Config() self.http = HTTP(self) self.wsc = WSClient(self) self.auth = ConnectionManager(self) self.jellyfin = api.API(self.http) self.callback_ws = callback self.callback = callback
root.update = update.Update() # Set up root app if core.CONFIG['Server']['authrequired'] == 'true': root.conf['/']['tools.auth.on'] = True if core.CONFIG['Proxy']['behindproxy'] == 'true': core.URL_BASE = core.CONFIG['Proxy']['webroot'] # mount applications cherrypy.tree.mount(root, '{}/'.format(core.URL_BASE), root.conf ) cherrypy.tree.mount(api.API(), '{}/api'.format(core.URL_BASE), api.API.conf ) cherrypy.tree.mount(postprocessing.Postprocessing(), '{}/postprocessing'.format(core.URL_BASE), postprocessing.Postprocessing.conf ) auth = AuthController() cherrypy.tree.mount(auth, '{}/auth'.format(core.URL_BASE), auth.conf ) # if everything goes well so far, open the browser
if passed_args.address: core.SERVER_ADDRESS = passed_args.address else: core.SERVER_ADDRESS = str(core.CONFIG['Server']['serverhost']) if passed_args.port: core.SERVER_PORT = passed_args.port else: core.SERVER_PORT = core.CONFIG['Server']['serverport'] # mount and configure applications if core.CONFIG['Server']['customwebroot']: core.URL_BASE = core.CONFIG['Server']['customwebrootpath'] root = cherrypy.tree.mount(App(), u'{}/'.format(core.URL_BASE), 'core/conf_app.ini') cherrypy.tree.mount(api.API(), u'{}/api'.format(core.URL_BASE), 'core/conf_api.ini') cherrypy.tree.mount(postprocessing.Postprocessing(), u'{}/postprocessing'.format(core.URL_BASE), 'core/conf_postprocessing.ini') cherrypy.tree.mount(App.auth, u'{}/auth'.format(core.URL_BASE), 'core/conf_auth.ini') # if everything goes well so far, open the browser if passed_args.browser or core.CONFIG['Server']['launchbrowser']: webbrowser.open(u"http://{}:{}{}".format(core.SERVER_ADDRESS, core.SERVER_PORT, core.URL_BASE)) logging.info(u'Launching web browser.')