Added API Key functionality

This commit is contained in:
David Maisonave
2024-08-17 02:58:01 -04:00
parent 6b9b901a96
commit 053cefc3bb
6 changed files with 16 additions and 5 deletions

View File

@@ -122,8 +122,11 @@ class StashPluginHelper(StashInterface):
self.FRAGMENT_SERVER = {'Scheme': 'http', 'Host': '0.0.0.0', 'Port': '9999', 'SessionCookie': {'Name': 'session', 'Value': '', 'Path': '', 'Domain': '', 'Expires': '0001-01-01T00:00:00Z', 'RawExpires': '', 'MaxAge': 0, 'Secure': False, 'HttpOnly': False, 'SameSite': 0, 'Raw': '', 'Unparsed': None}, 'Dir': os.path.dirname(pathlib.Path(self.MAIN_SCRIPT_NAME).resolve().parent), 'PluginDir': pathlib.Path(self.MAIN_SCRIPT_NAME).resolve().parent} self.FRAGMENT_SERVER = {'Scheme': 'http', 'Host': '0.0.0.0', 'Port': '9999', 'SessionCookie': {'Name': 'session', 'Value': '', 'Path': '', 'Domain': '', 'Expires': '0001-01-01T00:00:00Z', 'RawExpires': '', 'MaxAge': 0, 'Secure': False, 'HttpOnly': False, 'SameSite': 0, 'Raw': '', 'Unparsed': None}, 'Dir': os.path.dirname(pathlib.Path(self.MAIN_SCRIPT_NAME).resolve().parent), 'PluginDir': pathlib.Path(self.MAIN_SCRIPT_NAME).resolve().parent}
if debugTracing: self.DEBUG_TRACING = debugTracing if debugTracing: self.DEBUG_TRACING = debugTracing
apiKey = ""
if config: if config:
self.pluginConfig = config self.pluginConfig = config
if 'apiKey' in self.pluginConfig and self.pluginConfig['apiKey'] != "":
self.FRAGMENT_SERVER['ApiKey'] = self.pluginConfig['apiKey']
if DebugTraceFieldName in self.pluginConfig: if DebugTraceFieldName in self.pluginConfig:
self.DEBUG_TRACING = self.pluginConfig[DebugTraceFieldName] self.DEBUG_TRACING = self.pluginConfig[DebugTraceFieldName]
if DryRunFieldName in self.pluginConfig: if DryRunFieldName in self.pluginConfig:

View File

@@ -122,8 +122,11 @@ class StashPluginHelper(StashInterface):
self.FRAGMENT_SERVER = {'Scheme': 'http', 'Host': '0.0.0.0', 'Port': '9999', 'SessionCookie': {'Name': 'session', 'Value': '', 'Path': '', 'Domain': '', 'Expires': '0001-01-01T00:00:00Z', 'RawExpires': '', 'MaxAge': 0, 'Secure': False, 'HttpOnly': False, 'SameSite': 0, 'Raw': '', 'Unparsed': None}, 'Dir': os.path.dirname(pathlib.Path(self.MAIN_SCRIPT_NAME).resolve().parent), 'PluginDir': pathlib.Path(self.MAIN_SCRIPT_NAME).resolve().parent} self.FRAGMENT_SERVER = {'Scheme': 'http', 'Host': '0.0.0.0', 'Port': '9999', 'SessionCookie': {'Name': 'session', 'Value': '', 'Path': '', 'Domain': '', 'Expires': '0001-01-01T00:00:00Z', 'RawExpires': '', 'MaxAge': 0, 'Secure': False, 'HttpOnly': False, 'SameSite': 0, 'Raw': '', 'Unparsed': None}, 'Dir': os.path.dirname(pathlib.Path(self.MAIN_SCRIPT_NAME).resolve().parent), 'PluginDir': pathlib.Path(self.MAIN_SCRIPT_NAME).resolve().parent}
if debugTracing: self.DEBUG_TRACING = debugTracing if debugTracing: self.DEBUG_TRACING = debugTracing
apiKey = ""
if config: if config:
self.pluginConfig = config self.pluginConfig = config
if 'apiKey' in self.pluginConfig and self.pluginConfig['apiKey'] != "":
self.FRAGMENT_SERVER['ApiKey'] = self.pluginConfig['apiKey']
if DebugTraceFieldName in self.pluginConfig: if DebugTraceFieldName in self.pluginConfig:
self.DEBUG_TRACING = self.pluginConfig[DebugTraceFieldName] self.DEBUG_TRACING = self.pluginConfig[DebugTraceFieldName]
if DryRunFieldName in self.pluginConfig: if DryRunFieldName in self.pluginConfig:

View File

@@ -1,4 +1,4 @@
# FileMonitor: Ver 0.8.3 (By David Maisonave) # FileMonitor: Ver 0.8.4 (By David Maisonave)
FileMonitor is a [Stash](https://github.com/stashapp/stash) plugin with the following two main features: FileMonitor is a [Stash](https://github.com/stashapp/stash) plugin with the following two main features:
- Updates Stash when any file changes occurs in the Stash library. - Updates Stash when any file changes occurs in the Stash library.
- **Task Scheduler**: Runs scheduled task based on the scheduler configuration in **filemonitor_config.py**. - **Task Scheduler**: Runs scheduled task based on the scheduler configuration in **filemonitor_config.py**.

View File

@@ -122,8 +122,11 @@ class StashPluginHelper(StashInterface):
self.FRAGMENT_SERVER = {'Scheme': 'http', 'Host': '0.0.0.0', 'Port': '9999', 'SessionCookie': {'Name': 'session', 'Value': '', 'Path': '', 'Domain': '', 'Expires': '0001-01-01T00:00:00Z', 'RawExpires': '', 'MaxAge': 0, 'Secure': False, 'HttpOnly': False, 'SameSite': 0, 'Raw': '', 'Unparsed': None}, 'Dir': os.path.dirname(pathlib.Path(self.MAIN_SCRIPT_NAME).resolve().parent), 'PluginDir': pathlib.Path(self.MAIN_SCRIPT_NAME).resolve().parent} self.FRAGMENT_SERVER = {'Scheme': 'http', 'Host': '0.0.0.0', 'Port': '9999', 'SessionCookie': {'Name': 'session', 'Value': '', 'Path': '', 'Domain': '', 'Expires': '0001-01-01T00:00:00Z', 'RawExpires': '', 'MaxAge': 0, 'Secure': False, 'HttpOnly': False, 'SameSite': 0, 'Raw': '', 'Unparsed': None}, 'Dir': os.path.dirname(pathlib.Path(self.MAIN_SCRIPT_NAME).resolve().parent), 'PluginDir': pathlib.Path(self.MAIN_SCRIPT_NAME).resolve().parent}
if debugTracing: self.DEBUG_TRACING = debugTracing if debugTracing: self.DEBUG_TRACING = debugTracing
apiKey = ""
if config: if config:
self.pluginConfig = config self.pluginConfig = config
if 'apiKey' in self.pluginConfig and self.pluginConfig['apiKey'] != "":
self.FRAGMENT_SERVER['ApiKey'] = self.pluginConfig['apiKey']
if DebugTraceFieldName in self.pluginConfig: if DebugTraceFieldName in self.pluginConfig:
self.DEBUG_TRACING = self.pluginConfig[DebugTraceFieldName] self.DEBUG_TRACING = self.pluginConfig[DebugTraceFieldName]
if DryRunFieldName in self.pluginConfig: if DryRunFieldName in self.pluginConfig:

View File

@@ -1,6 +1,6 @@
name: FileMonitor name: FileMonitor
description: Monitors the Stash library folders, and updates Stash if any changes occurs in the Stash library paths. description: Monitors the Stash library folders, and updates Stash if any changes occurs in the Stash library paths.
version: 0.8.3 version: 0.8.4
url: https://github.com/David-Maisonave/Axter-Stash/tree/main/plugins/FileMonitor url: https://github.com/David-Maisonave/Axter-Stash/tree/main/plugins/FileMonitor
settings: settings:
recursiveDisabled: recursiveDisabled:

View File

@@ -100,6 +100,8 @@ config = {
# {"task" : "execute", "command" : "<plugin_path>test_hello_world.bat", "args" : "--name David", "weekday" : "friday", "time" : "12:03"}, # Does NOT show up in the Task Queue. Check FileMonitor log file, and look for -> Task 'execute' result=??? # {"task" : "execute", "command" : "<plugin_path>test_hello_world.bat", "args" : "--name David", "weekday" : "friday", "time" : "12:03"}, # Does NOT show up in the Task Queue. Check FileMonitor log file, and look for -> Task 'execute' result=???
], ],
# ApiKey only needed when Stash credentials are set.
"apiKey" : "", # Example: "eyJabccideJIUfg1NigRInD345I6dfpXVCfd.eyJ1abcDEfGheHRlHJiJklMonPQ32FsVewtsfSIsImlhdCI6MTcyMzg2NzkwOH0.5bkHU6sfs3532dsryu1ki3iFBwnd_4AHs325yHljsPw"
# Timeout in seconds. This is how often FileMonitor will check the scheduler and (in-plugin mode) check if another job (Task) is in the queue. # Timeout in seconds. This is how often FileMonitor will check the scheduler and (in-plugin mode) check if another job (Task) is in the queue.
"timeOut": 60, "timeOut": 60,
# Enable to run metadata clean task after file deletion. # Enable to run metadata clean task after file deletion.