Add files via upload
This commit is contained in:
1 parent
2aa7ea43b8
commit
17c6fd6d0f
3 files changed
+26
-5
No files matched your search
@@ -1,7 +1,6 @@
|
||||
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
|
||||
document.addEventListener(eventName, e => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -631,7 +630,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}
|
||||
};
|
||||
|
||||
window.triggerContextScan = (path) => {
|
||||
window.triggerContextScan = (targets) => {
|
||||
if (appState.scanning) return;
|
||||
switchPage('scan_window');
|
||||
if (window.pywebview) {
|
||||
@@ -649,7 +648,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
if (title) { title.setAttribute('data-i18n', 'status_scanning'); title.textContent = getMsg('status_scanning'); }
|
||||
if (text) { text.setAttribute('data-i18n', 'msg_init'); text.removeAttribute('data-dynamic-msg'); text.textContent = getMsg('msg_init'); }
|
||||
|
||||
window.pywebview.api.start_scan([path]);
|
||||
const paths = Array.isArray(targets) ? targets : [targets];
|
||||
window.pywebview.api.start_scan(paths);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -311,7 +311,7 @@ class WindowAPI:
|
||||
self.lock_net = threading.RLock()
|
||||
|
||||
self.pyas_default = {
|
||||
"version": "3.5.4",
|
||||
"version": "3.5.5",
|
||||
"api_host": "https://pyas-security.com/",
|
||||
"api_key": "fBRZxYS1UxykM-qzNOlKOEl63WILzlvgNMn6QfsG6FXCAAIktCrOPTAfY5_hEyuZ",
|
||||
"suffix": [".exe", ".dll", ".sys", ".ocx", ".scr", ".efi", ".acm", ".ax", ".cpl", ".drv", ".com", ".mui", ".pyd"],
|
||||
@@ -896,6 +896,18 @@ class WindowAPI:
|
||||
if self._window:
|
||||
self._window.evaluate_js(f"if(window.triggerContextScan) window.triggerContextScan({json.dumps(target.replace(os.sep, '/'))});")
|
||||
|
||||
def on_drop(self, e):
|
||||
def _process_drop():
|
||||
try:
|
||||
files = e.get('dataTransfer', {}).get('files', [])
|
||||
paths = [f.get('pywebviewFullPath') for f in files if f.get('pywebviewFullPath')]
|
||||
if paths and self._window:
|
||||
self._window.evaluate_js(f"if(window.triggerContextScan) window.triggerContextScan({json.dumps(paths)});")
|
||||
except Exception as ex:
|
||||
self.write_log("WARN", "on_drop", detail=str(ex), success=False)
|
||||
|
||||
threading.Thread(target=_process_drop, daemon=True).start()
|
||||
|
||||
def select_files(self):
|
||||
if self._window:
|
||||
result = self._window.create_file_dialog(webview.FileDialog.OPEN, allow_multiple=True)
|
||||
@@ -2719,4 +2731,13 @@ if __name__ == "__main__":
|
||||
js_api.set_window(window)
|
||||
js_api.show_tray()
|
||||
|
||||
def bind_dnd():
|
||||
try:
|
||||
from webview.dom import DOMEventHandler
|
||||
window.dom.document.events.drop += DOMEventHandler(js_api.on_drop, True, True)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
window.events.loaded += bind_dnd
|
||||
|
||||
webview.start()
|
||||
+1
-1
@@ -2,7 +2,7 @@ import pyinstaller_versionfile
|
||||
|
||||
pyinstaller_versionfile.create_versionfile(
|
||||
output_file="versionfile.txt",
|
||||
version='3.5.4.0',
|
||||
version='3.5.5.0',
|
||||
company_name="PYAS Security",
|
||||
file_description="PYAS Security Antivirus",
|
||||
internal_name="PYAS",
|
||||
|
||||
Reference in new issue
Block a user