Skip to content

Commit

Permalink
为保证 PBH 稳定性,暂时禁用下载器 WebUI,除非显式启用
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghost-chu committed Jun 27, 2024
1 parent ee834a4 commit c617597
Showing 1 changed file with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,22 @@ public void onPBHServerStarted(PBHServerStartedEvent event) {
javafx.scene.control.SingleSelectionModel<Tab> selectionModel = controller.getTabPane().getSelectionModel();
selectionModel.select(webuiTab);
log.info(Lang.WEBVIEW_ENABLED);
for (Downloader downloader : Main.getServer().getDownloaders()) {
if (!downloader.isSupportWebview()) {
continue;
if (System.getProperty("pbh.enableDownloadWebView") != null) {
for (Downloader downloader : Main.getServer().getDownloaders()) {
if (!downloader.isSupportWebview()) {
continue;
}
DownloaderBasicAuth basicAuth = downloader.getDownloaderBasicAuth();
Map<String, String> headers = new HashMap<>();
if (basicAuth != null) {
String cred = Base64.getEncoder().encodeToString((basicAuth.username() + ":" + basicAuth.password()).getBytes(StandardCharsets.UTF_8));
headers.put("Authorization", "Basic " + cred);
}
JavaFxWebViewWrapper.installWebViewTab(controller.getTabPane(),
downloader.getName(),
downloader.getWebUIEndpoint(),
headers, downloader.getWebViewJavaScript());
}
DownloaderBasicAuth basicAuth = downloader.getDownloaderBasicAuth();
Map<String, String> headers = new HashMap<>();
if (basicAuth != null) {
String cred = Base64.getEncoder().encodeToString((basicAuth.username() + ":" + basicAuth.password()).getBytes(StandardCharsets.UTF_8));
headers.put("Authorization", "Basic " + cred);
}
JavaFxWebViewWrapper.installWebViewTab(controller.getTabPane(),
downloader.getName(),
downloader.getWebUIEndpoint(),
headers, downloader.getWebViewJavaScript());
}
} else {
log.info(Lang.WEBVIEW_DISABLED_WEBKIT_NOT_INCLUDED);
Expand Down

0 comments on commit c617597

Please sign in to comment.