新增简易的8080面板😊
This commit is contained in:
8
store/@{FutureOSS}/plugin-storage/SIGNATURE
Normal file
8
store/@{FutureOSS}/plugin-storage/SIGNATURE
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"signature": "TA08EBmVwhP0tyOhplpioxsGD4T8fRhj2ekEvQFGEaK2L1/USEGTcGXt/tciHNMU0AWVJ1bD9MY6aBj2+ljlSNCEyNlMMOeZot1/blcQG9wPsHbVXKm8VuyK0KBHwrM39DppbKIn4dlGL6A2Eua0bp20oCnmd2VF3IuTHGnGKmoXmehffXiVIlCgqIX2+wEqlD2TqYfP6LU+XWDYMtQ/ShS3ImbcIoChOzhj3H0LZKg+jd4d4N97B2z9uUinojZ4jJxix1qe6hednBiZNEGUub6/bn8DKtdRidPjwtwObKjL8etBFlca0mHEYvHe/T33uoqi1URGnbqXiiYneSKj4J1zJRMfDxfZhZ6ubeCcSiMufIgzNbMii1lR0mq/pCcUUM0X0I4ean2xk7ygW7xrN8ra3/73gOHvVBnVElwyPIpZaiPzvVnQ14nyv2zWFFezJNdkB0MOaoy0RRzk9Jp7DjGxn9B4f3sGAZX1gTUSzu91BvdhZOfy6VhS+t8Wf3PfY2t0OYyLPg28S0bQhfZ64HnjR2LR098jut40ckbzDRif0ZFtyj0OQWzbC0dTKlSEW6p2ozuWSROX2OMxY4F/srzAfh7SJL42FR9Lm/tlCVSRUVQ2NRMA8UFdtorsp09GDQmwy7xJxn9ghRWoXmrsaDSwvrZUlVo6LMa6ocvhvSo=",
|
||||
"signer": "FutureOSS",
|
||||
"algorithm": "RSA-SHA256",
|
||||
"timestamp": 1775964952.8741558,
|
||||
"plugin_hash": "e317a24422dcd005fc3f2db0fa34848bd81a45a3eb40cda0b8d20aadf2391cd1",
|
||||
"author": "FutureOSS"
|
||||
}
|
||||
Binary file not shown.
@@ -7,6 +7,7 @@ from pathlib import Path
|
||||
from typing import Any, Optional, BinaryIO
|
||||
from datetime import datetime
|
||||
|
||||
from oss.logger.logger import Log
|
||||
from oss.plugin.types import Plugin, register_plugin_type, Response
|
||||
|
||||
|
||||
@@ -35,7 +36,7 @@ class PluginStorage:
|
||||
else:
|
||||
self._data = {}
|
||||
except (json.JSONDecodeError, IOError) as e:
|
||||
print(f"[plugin-storage] 加载数据失败 {self.plugin_name}: {e}")
|
||||
Log.error("plugin-storage", f"加载数据失败 {self.plugin_name}: {e}")
|
||||
self._data = {}
|
||||
|
||||
def _save(self):
|
||||
@@ -123,7 +124,7 @@ class PluginStorage:
|
||||
with open(file_path, mode, encoding="utf-8" if mode == "r" else None) as f:
|
||||
return f.read()
|
||||
except Exception as e:
|
||||
print(f"[plugin-storage] 读取文件失败 {self.plugin_name}/{path}: {e}")
|
||||
Log.error("plugin-storage", f"读取文件失败 {self.plugin_name}/{path}: {e}")
|
||||
return None
|
||||
|
||||
def write_file(self, path: str, content: str | bytes):
|
||||
@@ -143,7 +144,7 @@ class PluginStorage:
|
||||
with open(file_path, "w", encoding="utf-8") as f:
|
||||
f.write(content)
|
||||
except Exception as e:
|
||||
print(f"[plugin-storage] 写入文件失败 {self.plugin_name}/{path}: {e}")
|
||||
Log.error("plugin-storage", f"写入文件失败 {self.plugin_name}/{path}: {e}")
|
||||
|
||||
def delete_file(self, path: str) -> bool:
|
||||
"""删除插件目录内的文件"""
|
||||
@@ -154,7 +155,7 @@ class PluginStorage:
|
||||
return True
|
||||
return False
|
||||
except Exception as e:
|
||||
print(f"[plugin-storage] 删除文件失败 {self.plugin_name}/{path}: {e}")
|
||||
Log.error("plugin-storage", f"删除文件失败 {self.plugin_name}/{path}: {e}")
|
||||
return False
|
||||
|
||||
def list_files(self, prefix: str = "") -> list[str]:
|
||||
@@ -290,7 +291,7 @@ class PluginStoragePlugin(Plugin):
|
||||
|
||||
def start(self):
|
||||
"""启动"""
|
||||
print(f"[plugin-storage] 插件存储服务已启动 (root={self.data_root})")
|
||||
Log.info("plugin-storage", f"插件存储服务已启动 (root={self.data_root})")
|
||||
|
||||
def stop(self):
|
||||
"""停止"""
|
||||
@@ -306,7 +307,7 @@ class PluginStoragePlugin(Plugin):
|
||||
shared_dir_name = self.config.get("shared_dir", "DCIM")
|
||||
shared_dir = self.data_root / shared_dir_name
|
||||
else:
|
||||
print("[plugin-storage] config.json 不存在,使用默认配置")
|
||||
Log.warn("plugin-storage", "config.json 不存在,使用默认配置")
|
||||
self.config = {"data_root": "./data", "shared_dir": "DCIM"}
|
||||
self.data_root = Path("./data")
|
||||
shared_dir = self.data_root / "DCIM"
|
||||
|
||||
Reference in New Issue
Block a user