Remove hard-coded directory path from plugins

This commit is contained in:
shortcutme 2019-08-02 16:05:19 +02:00
parent 1eb97ea381
commit 3e97c154a0
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
8 changed files with 39 additions and 17 deletions

View file

@ -3,12 +3,15 @@ import random
import time
import json
import re
import os
from Config import config
from Plugin import PluginManager
from util import helper
plugin_dir = os.path.dirname(__file__)
if "sessions" not in locals().keys(): # To keep sessions between module reloads
sessions = {}
@ -21,6 +24,7 @@ def showPasswordAdvice(password):
error_msgs.append("You are using a very short UI password!")
return error_msgs
@PluginManager.registerTo("UiRequest")
class UiRequestPlugin(object):
sessions = sessions
@ -45,7 +49,7 @@ class UiRequestPlugin(object):
# Action: Login
@helper.encodeResponse
def actionLogin(self):
template = open("plugins/UiPassword/login.html").read()
template = open(plugin_dir + "/login.html").read()
self.sendHeader()
posted = self.getPosted()
if posted: # Validate http posted data
@ -108,7 +112,6 @@ class UiRequestPlugin(object):
yield "Error: Invalid session id"
@PluginManager.registerTo("ConfigPlugin")
class ConfigPlugin(object):
def createArguments(self):