Remove hard-coded directory path from plugins
This commit is contained in:
parent
1eb97ea381
commit
3e97c154a0
8 changed files with 39 additions and 17 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue