From 386da106f978d818387d1eacc636e0d99383f952 Mon Sep 17 00:00:00 2001
From: Zayrex <478576442@qq.com>
Date: Fri, 26 Sep 2025 22:36:36 +0800
Subject: [PATCH] =?UTF-8?q?+=E6=B7=BB=E5=8A=A0=E4=BA=86=E9=80=9A=E8=BF=87?=
=?UTF-8?q?=E5=86=85=E7=BD=AE=E6=B5=8F=E8=A7=88=E5=99=A8=E7=99=BB=E5=BD=95?=
=?UTF-8?q?=20*=E6=9B=B4=E6=96=B0JDK=E5=92=8C=E4=BE=9D=E8=B5=96=E7=89=88?=
=?UTF-8?q?=E6=9C=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/misc.xml | 3 +-
pom.xml | 36 +++-----
src/main/java/module-info.java | 2 +
.../xyz/zcraft/acgpicdownload/gui/GUI.java | 16 +++-
.../gui/controllers/FetchPaneController.java | 36 ++++----
.../gui/controllers/MainPaneController.java | 54 ++++-------
.../PixivAccountPaneController.java | 91 +++++++++++++++----
.../PixivDiscoveryPaneController.java | 6 +-
.../PixivDownloadPaneController.java | 24 ++---
.../controllers/PixivLoginPaneController.java | 26 ++++++
.../controllers/PixivMenuPaneController.java | 6 +-
.../PixivRankingPaneController.java | 76 ++++++++--------
.../PixivRelatedPaneController.java | 6 +-
.../PixivSearchPaneController.java | 8 +-
.../controllers/PixivUserPaneController.java | 6 +-
.../controllers/SettingsPaneController.java | 17 +++-
.../util/pixiv/PixivFetchUtil.java | 6 +-
.../gui/fxml/PixivAccountPane.fxml | 76 +++++++++-------
.../gui/fxml/PixivLoginPane.fxml | 10 ++
.../languages/String.properties | 6 ++
.../languages/String_en.properties | 8 ++
.../languages/String_zh_CN.properties | 8 +-
22 files changed, 328 insertions(+), 199 deletions(-)
create mode 100644 src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivLoginPaneController.java
create mode 100644 src/main/resources/xyz/zcraft/acgpicdownload/gui/fxml/PixivLoginPane.fxml
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 2a24573..1fdfaa3 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -16,9 +16,8 @@
-
-
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index b964892..fbecbf9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,8 +9,8 @@
3.3.0
- 17
- 17
+ 25
+ 25
UTF-8
@@ -84,32 +84,32 @@
org.jsoup
jsoup
- 1.15.3
+ 1.21.2
com.alibaba
fastjson
- 2.0.22
+ 2.0.59
org.openjfx
javafx-base
- 19
+ 25
org.openjfx
javafx-controls
- 19
+ 25
org.openjfx
javafx-fxml
- 19
+ 25
io.github.palexdev
materialfx
- 11.13.8
+ 11.17.0
com.madgag
@@ -119,7 +119,7 @@
org.jetbrains
annotations
- 23.1.0
+ 26.0.2
@@ -127,26 +127,16 @@
lombok
1.18.42
+
log4j
-
log4j
1.2.17
- org.jline
- jline
- 3.25.0
-
-
- net.java.dev.jna
- jna
- 5.14.0
-
-
- info.picocli
- picocli
- 4.7.6
+ org.openjfx
+ javafx-web
+ 25
\ No newline at end of file
diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java
index c2aa3c7..a88dc5b 100644
--- a/src/main/java/module-info.java
+++ b/src/main/java/module-info.java
@@ -10,6 +10,8 @@
requires org.jsoup;
requires animated.gif.lib;
requires fastjson;
+ requires javafx.web;
+ requires javafx.graphics;
opens xyz.zcraft.acgpicdownload to javafx.controls, javafx.base, javafx.graphics, javafx.fxml, com.alibaba.fastjson2;
opens xyz.zcraft.acgpicdownload.gui to javafx.base, javafx.controls, javafx.graphics, javafx.fxml;
diff --git a/src/main/java/xyz/zcraft/acgpicdownload/gui/GUI.java b/src/main/java/xyz/zcraft/acgpicdownload/gui/GUI.java
index 5659215..966ff7e 100644
--- a/src/main/java/xyz/zcraft/acgpicdownload/gui/GUI.java
+++ b/src/main/java/xyz/zcraft/acgpicdownload/gui/GUI.java
@@ -6,6 +6,9 @@
import io.github.palexdev.materialfx.enums.ScrimPriority;
import io.github.palexdev.materialfx.i18n.I18N;
import io.github.palexdev.materialfx.i18n.Language;
+import io.github.palexdev.materialfx.theming.JavaFXThemes;
+import io.github.palexdev.materialfx.theming.MaterialFXStylesheets;
+import io.github.palexdev.materialfx.theming.UserAgentBuilder;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
@@ -136,6 +139,14 @@ public void start(Stage stage) throws Exception {
logger.setLevel(Level.ALL);
logger.info("Launching GUI");
+ UserAgentBuilder.builder()
+ .themes(JavaFXThemes.MODENA)
+ .themes(MaterialFXStylesheets.forAssemble(true))
+ .setDeploy(true)
+ .setResolveAssets(true)
+ .build()
+ .setGlobal();
+
setLanguage();
gui = this;
mainStage = stage;
@@ -159,7 +170,7 @@ public void start(Stage stage) throws Exception {
mainPaneController.init();
- stage.setOnCloseRequest(windowEvent -> {
+ stage.setOnCloseRequest(_ -> {
stage.hide();
System.exit(0);
});
@@ -312,7 +323,7 @@ private void initWindow() {
.setContentText(ResourceBundleUtil.getString("gui.seriousERR") + "\n" + sw)
.setShowClose(true)
.setHeaderText(ResourceBundleUtil.getString("gui.fetch.err")).get();
- content.addActions(Map.entry(new MFXButton("OK"), event -> System.exit(1)));
+ content.addActions(Map.entry(new MFXButton("OK"), _ -> System.exit(1)));
MFXGenericDialogBuilder.build(content)
.toStageDialogBuilder()
.initOwner(stage)
@@ -333,6 +344,7 @@ private void initWindow() {
}
}
+ @SuppressWarnings("unused")
public void reloadWindow() throws IOException {
mainPaneController.reload();
setLanguage();
diff --git a/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/FetchPaneController.java b/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/FetchPaneController.java
index 8d37f5f..b2d182d 100644
--- a/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/FetchPaneController.java
+++ b/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/FetchPaneController.java
@@ -6,8 +6,8 @@
import io.github.palexdev.materialfx.controls.*;
import io.github.palexdev.materialfx.controls.cell.MFXTableRowCell;
import io.github.palexdev.materialfx.filter.StringFilter;
-import io.github.palexdev.materialfx.font.MFXFontIcon;
import io.github.palexdev.materialfx.utils.StringUtils;
+import io.github.palexdev.mfxresources.fonts.MFXFontIcon;
import javafx.animation.FadeTransition;
import javafx.application.Platform;
import javafx.collections.FXCollections;
@@ -48,8 +48,8 @@
import java.io.File;
import java.io.IOException;
import java.net.URL;
-import java.util.List;
import java.util.*;
+import java.util.List;
public class FetchPaneController extends MyPane {
private final LinkedList> arguments = new LinkedList<>();
@@ -146,7 +146,7 @@ public void initialize(URL url, ResourceBundle resourceBundle) {
initTable();
fetchBtn.disableProperty().bind(sourcesComboBox.selectedIndexProperty().isEqualTo(-1));
- data.addListener((ListChangeListener) c -> downloadBtn.setDisable(data.isEmpty()));
+ data.addListener((ListChangeListener) _ -> downloadBtn.setDisable(data.isEmpty()));
try {
ConfigManager.readConfig();
@@ -155,10 +155,10 @@ public void initialize(URL url, ResourceBundle resourceBundle) {
Main.logError(e);
}
- sourceUpdateBtn.setGraphic(new MFXFontIcon("mfx-sync"));
- backBtn.setGraphic(new MFXFontIcon("mfx-angle-down"));
- delCompletedBtn.setGraphic(new MFXFontIcon("mfx-delete"));
- selectDirBtn.setGraphic(new MFXFontIcon("mfx-folder"));
+ sourceUpdateBtn.setGraphic(new MFXFontIcon("fas-arrows-rotate"));
+ backBtn.setGraphic(new MFXFontIcon("fas-angle-down"));
+ delCompletedBtn.setGraphic(new MFXFontIcon("fas-trash"));
+ selectDirBtn.setGraphic(new MFXFontIcon("fas-folder"));
}
private void initTable() {
@@ -171,9 +171,9 @@ private void initTable() {
MFXTableColumn statusColumn = new MFXTableColumn<>(
ResourceBundleUtil.getString("gui.fetch.table.column.status"), true);
- titleColumn.setRowCellFactory(arg0 -> new MFXTableRowCell<>(arg01 -> arg01.getResult().getFileName()));
- linkColumn.setRowCellFactory(arg0 -> new MFXTableRowCell<>(arg01 -> arg01.getResult().getUrl()));
- statusColumn.setRowCellFactory(arg0 -> new MFXTableRowCell<>(DownloadResult::getStatusString));
+ titleColumn.setRowCellFactory(_ -> new MFXTableRowCell<>(arg01 -> arg01.getResult().getFileName()));
+ linkColumn.setRowCellFactory(_ -> new MFXTableRowCell<>(arg01 -> arg01.getResult().getUrl()));
+ statusColumn.setRowCellFactory(_ -> new MFXTableRowCell<>(DownloadResult::getStatusString));
titleColumn.setAlignment(Pos.CENTER);
linkColumn.setAlignment(Pos.CENTER);
@@ -198,21 +198,21 @@ private void initTable() {
dataTable.getSelectionModel().setAllowsMultipleSelection(false);
dataTable.getSelectionModel().selectionProperty()
- .addListener((observableValue, integerDownloadResultObservableMap, t1) -> {
+ .addListener((_, _, _) -> {
List selectedValues = dataTable.getSelectionModel().getSelectedValues();
if (!selectedValues.isEmpty()) {
- if (selectedValues.get(0).getStatus() == DownloadStatus.COMPLETED &&
+ if (selectedValues.getFirst().getStatus() == DownloadStatus.COMPLETED &&
ConfigManager.getConfig().getBooleanValue("fetchPLCOCopy")) {
try {
Desktop.getDesktop().open(new File(outputDirField.getText(),
- selectedValues.get(0).getResult().getFileName()));
+ selectedValues.getFirst().getResult().getFileName()));
} catch (IOException e) {
Notice.showError(ResourceBundleUtil.getString("gui.fetch.table.cantOpen"),
gui.mainPane);
}
} else {
Toolkit.getDefaultToolkit().getSystemClipboard()
- .setContents(new StringSelection(selectedValues.get(0).getResult().getUrl()), null);
+ .setContents(new StringSelection(selectedValues.getFirst().getResult().getUrl()), null);
dataTable.getSelectionModel().clearSelection();
Notice.showSuccess(ResourceBundleUtil.getString("gui.fetch.table.copy"), gui.mainPane);
}
@@ -247,7 +247,7 @@ public Source fromString(String s) {
SourceManager.readConfig();
sources.addAll(SourceManager.getSources());
} catch (JSONException | IOException e) {
- e.printStackTrace();
+ throw new RuntimeException(e);
}
}
@@ -275,7 +275,7 @@ public void updateFromGithub() {
ft.setFromValue(1);
ft.setToValue(0);
ft.play();
- ft.setOnFinished((e) -> loadingPane.setVisible(false));
+ ft.setOnFinished((_) -> loadingPane.setVisible(false));
}
}).start();
}
@@ -338,7 +338,7 @@ public void handle(Exception e) {
ft.setFromValue(1);
ft.setToValue(0);
data.addAll(r);
- ft.setOnFinished((e) -> loadingPane.setVisible(false));
+ ft.setOnFinished((_) -> loadingPane.setVisible(false));
ft.play();
});
@@ -380,7 +380,7 @@ private void updateSource() {
Main.logError(e);
}
ft.play();
- ft.setOnFinished((e) -> loadingPane.setVisible(false));
+ ft.setOnFinished((_) -> loadingPane.setVisible(false));
}).start();
ft.setFromValue(1);
diff --git a/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/MainPaneController.java b/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/MainPaneController.java
index d5d0a6d..a5a24c1 100644
--- a/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/MainPaneController.java
+++ b/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/MainPaneController.java
@@ -2,7 +2,7 @@
import io.github.palexdev.materialfx.controls.MFXButton;
import io.github.palexdev.materialfx.controls.MFXProgressBar;
-import io.github.palexdev.materialfx.font.MFXFontIcon;
+import io.github.palexdev.mfxresources.fonts.MFXFontIcon;
import javafx.animation.FadeTransition;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
@@ -18,6 +18,8 @@
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.util.Duration;
+import lombok.Getter;
+import lombok.Setter;
import xyz.zcraft.acgpicdownload.gui.GUI;
import java.io.InputStream;
@@ -26,6 +28,8 @@
public class MainPaneController implements Initializable {
public MFXButton maximizeBtn;
+ @Setter
+ @Getter
GUI gui;
double w = 800;
double h = 500 - 30;
@@ -33,8 +37,10 @@ public class MainPaneController implements Initializable {
double origMouseY;
double origStageW;
double origStageH;
+ @Getter
@javafx.fxml.FXML
private AnchorPane mainPane;
+ @Getter
@javafx.fxml.FXML
private ImageView background;
@javafx.fxml.FXML
@@ -51,21 +57,15 @@ public class MainPaneController implements Initializable {
private MFXButton closeBtn;
@javafx.fxml.FXML
private MFXButton minimizeBtn;
+ @Getter
@javafx.fxml.FXML
private HBox titlePane;
+ @Getter
private boolean transparent = false;
private double origStageX;
private double origStageY;
private Image image;
- public AnchorPane getMainPane() {
- return mainPane;
- }
-
- public ImageView getBackground() {
- return background;
- }
-
public void setBackground(InputStream stream) {
image = new Image(stream);
fitBackground();
@@ -95,26 +95,14 @@ private void fitBackground() {
blurImg.setImage(snapshot);
}
- public boolean isTransparent() {
- return transparent;
- }
-
public void setTransparent() {
transparent = true;
blurImg.setVisible(false);
background.setVisible(false);
titleLbl.setTextFill(Color.BLACK);
- closeBtn.setGraphic(new MFXFontIcon("mfx-x", Color.BLACK));
- minimizeBtn.setGraphic(new MFXFontIcon("mfx-minus", Color.BLACK));
- maximizeBtn.setGraphic(new MFXFontIcon("mfx-expand", Color.BLACK));
- }
-
- public GUI getGui() {
- return gui;
- }
-
- public void setGui(GUI gui) {
- this.gui = gui;
+ closeBtn.setGraphic(new MFXFontIcon("fas-xmark", Color.BLACK));
+ minimizeBtn.setGraphic(new MFXFontIcon("fas-minus", Color.BLACK));
+ maximizeBtn.setGraphic(new MFXFontIcon("fas-expand", Color.BLACK));
}
public void setProgress(double p) {
@@ -128,22 +116,22 @@ public void loadDone() {
ft.setFromValue(1);
ft.setDuration(Duration.millis(10));
ft.setRate(0.1);
- ft.setOnFinished((e) -> initPane.setVisible(false));
+ ft.setOnFinished((_) -> initPane.setVisible(false));
ft.play();
ft.setNode(blurImg);
- ft.setOnFinished((e) -> blurImg.setVisible(false));
+ ft.setOnFinished((_) -> blurImg.setVisible(false));
ft.play();
}
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
closeBtn.setText("");
- closeBtn.setGraphic(new MFXFontIcon("mfx-x", Color.WHITE));
+ closeBtn.setGraphic(new MFXFontIcon("fas-xmark", Color.WHITE));
minimizeBtn.setText("");
- minimizeBtn.setGraphic(new MFXFontIcon("mfx-minus", Color.WHITE));
+ minimizeBtn.setGraphic(new MFXFontIcon("fas-minus", Color.WHITE));
maximizeBtn.setText("");
- maximizeBtn.setGraphic(new MFXFontIcon("mfx-expand", Color.WHITE));
+ maximizeBtn.setGraphic(new MFXFontIcon("fas-expand", Color.WHITE));
}
public void reload() {
@@ -153,11 +141,11 @@ public void reload() {
ft.setFromValue(0);
ft.setDuration(Duration.millis(10));
ft.setRate(0.1);
- ft.setOnFinished((e) -> initPane.setVisible(false));
+ ft.setOnFinished((_) -> initPane.setVisible(false));
ft.play();
ft.setNode(blurImg);
- ft.setOnFinished((e) -> blurImg.setVisible(false));
+ ft.setOnFinished((_) -> blurImg.setVisible(false));
ft.play();
}
@@ -187,10 +175,6 @@ private void closeBtnOnAction() {
System.exit(0);
}
- public HBox getTitlePane() {
- return titlePane;
- }
-
@FXML
public void resizeStart(MouseEvent event) {
origMouseX = event.getScreenX();
diff --git a/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivAccountPaneController.java b/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivAccountPaneController.java
index 5df942b..0539c0a 100644
--- a/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivAccountPaneController.java
+++ b/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivAccountPaneController.java
@@ -3,17 +3,23 @@
import io.github.palexdev.materialfx.controls.MFXButton;
import io.github.palexdev.materialfx.controls.MFXComboBox;
import io.github.palexdev.materialfx.controls.MFXTextField;
-import io.github.palexdev.materialfx.font.MFXFontIcon;
+import io.github.palexdev.mfxresources.fonts.MFXFontIcon;
import javafx.animation.FadeTransition;
import javafx.application.Platform;
import javafx.fxml.FXML;
+import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.geometry.Rectangle2D;
+import javafx.scene.Parent;
+import javafx.scene.Scene;
import javafx.scene.SnapshotParameters;
+import javafx.scene.control.Alert;
+import javafx.scene.control.ButtonType;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.VBox;
+import javafx.stage.Stage;
import javafx.util.Duration;
import javafx.util.StringConverter;
import lombok.Getter;
@@ -22,22 +28,21 @@
import xyz.zcraft.acgpicdownload.gui.ConfigManager;
import xyz.zcraft.acgpicdownload.gui.GUI;
import xyz.zcraft.acgpicdownload.gui.Notice;
+import xyz.zcraft.acgpicdownload.gui.ResourceLoader;
import xyz.zcraft.acgpicdownload.util.ResourceBundleUtil;
import xyz.zcraft.acgpicdownload.util.pixiv.PixivAccount;
import xyz.zcraft.acgpicdownload.util.pixiv.PixivFetchUtil;
import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.ResourceBundle;
+import java.net.*;
+import java.util.*;
public class PixivAccountPaneController implements Initializable {
+ public static final Logger logger = Logger.getLogger(PixivAccountPaneController.class);
public MFXComboBox accountCombo;
public MFXTextField cookieField;
public MFXButton cookieHelpBtn;
+ public MFXButton browserLoginBtn;
@Setter
@Getter
GUI gui;
@@ -61,13 +66,13 @@ public String toString(PixivAccount object) {
@Override
public PixivAccount fromString(String string) {
- return accountCombo.getItems().filtered((o) -> o.getName().equals(string)).get(0);
+ return accountCombo.getItems().filtered((o) -> o.getName().equals(string)).getFirst();
}
});
accountCombo.getItems().clear();
accountCombo.getItems().addAll(ConfigManager.getAccounts());
- accountCombo.selectedIndexProperty().addListener(observable -> {
+ accountCombo.selectedIndexProperty().addListener(_ -> {
ConfigManager.setSelectedAccount(accountCombo.getSelectedItem());
if (gui != null) gui.pixivPaneController.reloadAccount();
});
@@ -75,7 +80,8 @@ public PixivAccount fromString(String string) {
accountCombo.selectFirst();
cookieHelpBtn.setText("");
- cookieHelpBtn.setGraphic(new MFXFontIcon("mfx-info-circle"));
+ cookieHelpBtn.setGraphic(new MFXFontIcon("fas-circle-info"));
+ browserLoginBtn.setGraphic(new MFXFontIcon("fas-globe"));
}
public void hide() {
@@ -86,7 +92,7 @@ public void hide() {
ft.setAutoReverse(false);
ft.setRate(0.05);
ft.setDuration(Duration.millis(5));
- ft.setOnFinished(actionEvent -> Platform.runLater(() -> mainPane.setVisible(false)));
+ ft.setOnFinished(_ -> Platform.runLater(() -> mainPane.setVisible(false)));
ft.play();
}
@@ -113,10 +119,8 @@ public void show() {
ft.play();
}
- public static final Logger logger = Logger.getLogger(PixivAccountPaneController.class);
-
- public void addAccount() throws IOException {
- HashMap stringStringHashMap = PixivFetchUtil.parseCookie(cookieField.getText());
+ public void addAccount(String cookieOrig) throws IOException {
+ HashMap stringStringHashMap = PixivFetchUtil.parseCookie(cookieOrig);
String cookie = "PHPSESSID" + "=" + stringStringHashMap.get("PHPSESSID");
PixivAccount account = PixivFetchUtil.getAccount(
cookie,
@@ -140,6 +144,10 @@ public void addAccount() throws IOException {
}
}
+ public void addAccount() throws IOException {
+ addAccount(cookieField.getText());
+ }
+
public void delAccount() throws IOException {
if (accountCombo.getSelectedIndex() != -1) {
ConfigManager.getAccounts().remove(accountCombo.getSelectionModel().getSelectedItem());
@@ -176,9 +184,58 @@ public void refreshAccount() throws IOException {
public void cookieHelp() throws URISyntaxException, IOException {
if (Locale.getDefault().equals(Locale.CHINA) || Locale.getDefault().equals(Locale.TAIWAN)) {
java.awt.Desktop.getDesktop()
- .browse(new URI("https://github.com/zxzxy/ACGPicDownload/wiki/%E8%8E%B7%E5%8F%96Cookie"));
+ .browse(new URI("https://github.com/ZayrexDev/ACGPicDownload/wiki/%E8%8E%B7%E5%8F%96Cookie"));
} else {
- java.awt.Desktop.getDesktop().browse(new URI("https://github.com/zxzxy/ACGPicDownload/wiki/Get-cookie"));
+ java.awt.Desktop.getDesktop().browse(new URI("https://github.com/ZayrexDev/ACGPicDownload/wiki/Get-cookie"));
+ }
+ }
+
+ public void browserLoginBtnOnAction() {
+ Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
+ alert.setTitle(ResourceBundleUtil.getString("gui.pixiv.account.add.browser.alert.title"));
+ alert.setHeaderText(ResourceBundleUtil.getString("gui.pixiv.account.add.browser.alert.header"));
+ alert.setContentText(ResourceBundleUtil.getString("gui.pixiv.account.add.browser.alert.content"));
+ alert.showAndWait();
+
+ CookieManager manager = new CookieManager();
+ CookieHandler.setDefault(manager);
+
+ if (!alert.getResult().equals(ButtonType.OK)) {
+ return;
+ }
+
+ Stage browserStage = new Stage();
+ browserStage.setTitle("Pixiv Login - ACGPicDownload");
+ browserStage.setWidth(1000);
+ browserStage.setHeight(600);
+
+ final FXMLLoader fxmlLoader = new FXMLLoader(Objects.requireNonNull(ResourceLoader.loadURL("fxml/PixivLoginPane.fxml")));
+ final Parent load;
+ try {
+ load = fxmlLoader.load();
+ final PixivLoginPaneController controller = fxmlLoader.getController();
+ final Scene scene = new Scene(load);
+ browserStage.setScene(scene);
+
+ controller.reload();
+
+ browserStage.showAndWait();
+
+ CookieStore cs = manager.getCookieStore();
+ final List httpCookies = cs.get(new URI("https://pixiv.net"));
+
+ httpCookies.stream().filter(e -> e.getName().equalsIgnoreCase("PHPSESSID")).findFirst()
+ .ifPresentOrElse(e -> {
+ try {
+ addAccount("PHPSESSID=" + e.getValue());
+ } catch (IOException ex) {
+ Notice.showError(ResourceBundleUtil.getString("gui.pixiv.account.addFailed"), gui.mainPane);
+ }
+ }, () -> Notice.showError(ResourceBundleUtil.getString("gui.pixiv.account.addFailed"), gui.mainPane));
+ } catch (IOException e) {
+ Notice.showError(ResourceBundleUtil.getString("gui.pixiv.account.addFailed"), gui.mainPane);
+ } catch (URISyntaxException e) {
+ throw new RuntimeException(e);
}
}
}
diff --git a/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivDiscoveryPaneController.java b/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivDiscoveryPaneController.java
index c17673a..5bad338 100644
--- a/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivDiscoveryPaneController.java
+++ b/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivDiscoveryPaneController.java
@@ -2,7 +2,7 @@
import io.github.palexdev.materialfx.controls.MFXComboBox;
import io.github.palexdev.materialfx.controls.MFXSlider;
-import io.github.palexdev.materialfx.font.MFXFontIcon;
+import io.github.palexdev.mfxresources.fonts.MFXFontIcon;
import javafx.application.Platform;
import javafx.fxml.FXML;
import org.apache.log4j.Logger;
@@ -33,7 +33,7 @@ public void initialize(URL url, ResourceBundle resourceBundle) {
super.initialize(url, resourceBundle);
backBtn.setText("");
- backBtn.setGraphic(new MFXFontIcon("mfx-angle-down"));
+ backBtn.setGraphic(new MFXFontIcon("fas-angle-down"));
modeCombo.getItems().addAll(
ResourceBundleUtil.getString("gui.pixiv.disc.mode.all"),
@@ -94,7 +94,7 @@ public void fetchBtnOnAction() {
ft.stop();
ft.setFromValue(1);
ft.setToValue(0);
- ft.setOnFinished((e) -> loadingPane.setVisible(false));
+ ft.setOnFinished((_) -> loadingPane.setVisible(false));
ft.play();
}
}).start();
diff --git a/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivDownloadPaneController.java b/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivDownloadPaneController.java
index 196a9a2..90e7249 100644
--- a/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivDownloadPaneController.java
+++ b/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivDownloadPaneController.java
@@ -4,7 +4,7 @@
import io.github.palexdev.materialfx.controls.*;
import io.github.palexdev.materialfx.controls.cell.MFXTableRowCell;
import io.github.palexdev.materialfx.filter.StringFilter;
-import io.github.palexdev.materialfx.font.MFXFontIcon;
+import io.github.palexdev.mfxresources.fonts.MFXFontIcon;
import javafx.application.Platform;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
@@ -154,13 +154,13 @@ private void initTable() {
MFXTableColumn typeColumn = new MFXTableColumn<>(
ResourceBundleUtil.getString("gui.pixiv.download.column.type"), true);
- titleColumn.setRowCellFactory(e -> new MFXTableRowCell<>(o -> o.getArtwork().getTitle()));
- authorColumn.setRowCellFactory(e -> new MFXTableRowCell<>(o -> o.getArtwork().getUserName()));
- fromColumn.setRowCellFactory(e -> new MFXTableRowCell<>(o -> o.getArtwork().getFromString()));
- tagColumn.setRowCellFactory(e -> new MFXTableRowCell<>(o -> o.getArtwork().getTagsString()));
- idColumn.setRowCellFactory(e -> new MFXTableRowCell<>(o -> o.getArtwork().getId()));
- statusColumn.setRowCellFactory(e -> new MFXTableRowCell<>(PixivDownload::getStatusString));
- typeColumn.setRowCellFactory(e -> new MFXTableRowCell<>(o -> o.getArtwork().getTypeString()));
+ titleColumn.setRowCellFactory(_ -> new MFXTableRowCell<>(o -> o.getArtwork().getTitle()));
+ authorColumn.setRowCellFactory(_ -> new MFXTableRowCell<>(o -> o.getArtwork().getUserName()));
+ fromColumn.setRowCellFactory(_ -> new MFXTableRowCell<>(o -> o.getArtwork().getFromString()));
+ tagColumn.setRowCellFactory(_ -> new MFXTableRowCell<>(o -> o.getArtwork().getTagsString()));
+ idColumn.setRowCellFactory(_ -> new MFXTableRowCell<>(o -> o.getArtwork().getId()));
+ statusColumn.setRowCellFactory(_ -> new MFXTableRowCell<>(PixivDownload::getStatusString));
+ typeColumn.setRowCellFactory(_ -> new MFXTableRowCell<>(o -> o.getArtwork().getTypeString()));
titleColumn.setAlignment(Pos.CENTER);
authorColumn.setAlignment(Pos.CENTER);
@@ -206,16 +206,16 @@ public void initialize(URL location, ResourceBundle resources) {
ResourceBundleUtil.getString("gui.pixiv.download.multiPageRule.gathered")
);
- multiPageCombo.selectedIndexProperty().addListener((observableValue, number, t1) -> folderNamingRuleField.setDisable(t1.intValue() != 0));
+ multiPageCombo.selectedIndexProperty().addListener((_, _, t1) -> folderNamingRuleField.setDisable(t1.intValue() != 0));
multiPageCombo.selectFirst();
backBtn.setText("");
- backBtn.setGraphic(new MFXFontIcon("mfx-angle-down"));
+ backBtn.setGraphic(new MFXFontIcon("fas-angle-down"));
selectDirBtn.setText("");
- selectDirBtn.setGraphic(new MFXFontIcon("mfx-folder"));
+ selectDirBtn.setGraphic(new MFXFontIcon("fas-folder"));
namingRuleHelpBtn.setText("");
- namingRuleHelpBtn.setGraphic(new MFXFontIcon("mfx-info-circle"));
+ namingRuleHelpBtn.setGraphic(new MFXFontIcon("fas-circle-info"));
saveConfigBtn.setText("");
saveConfigBtn.setGraphic(new ImageView(new Image(ResourceLoader.loadStream("icon/save.png"), 18, 18, true, false)));
diff --git a/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivLoginPaneController.java b/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivLoginPaneController.java
new file mode 100644
index 0000000..1901dc3
--- /dev/null
+++ b/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivLoginPaneController.java
@@ -0,0 +1,26 @@
+package xyz.zcraft.acgpicdownload.gui.controllers;
+
+import javafx.fxml.Initializable;
+import javafx.scene.web.WebView;
+import xyz.zcraft.acgpicdownload.util.pixiv.PixivFetchUtil;
+
+import java.net.URL;
+import java.util.ResourceBundle;
+
+public class PixivLoginPaneController implements Initializable {
+ public WebView webView;
+
+ @Override
+ public void initialize(URL location, ResourceBundle resources) {
+ webView.setZoom(0.8);
+ webView.getEngine().locationProperty().addListener((_, _, newValue) -> {
+ if (newValue.startsWith("https://www.pixiv.net/")) {
+ webView.getScene().getWindow().hide();
+ }
+ });
+ }
+
+ public void reload() {
+ webView.getEngine().load(PixivFetchUtil.LOGIN);
+ }
+}
diff --git a/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivMenuPaneController.java b/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivMenuPaneController.java
index ea5f778..e471f84 100644
--- a/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivMenuPaneController.java
+++ b/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivMenuPaneController.java
@@ -2,7 +2,7 @@
import io.github.palexdev.materialfx.controls.MFXSlider;
import io.github.palexdev.materialfx.controls.MFXToggleButton;
-import io.github.palexdev.materialfx.font.MFXFontIcon;
+import io.github.palexdev.mfxresources.fonts.MFXFontIcon;
import javafx.application.Platform;
import javafx.fxml.FXML;
import org.apache.log4j.Logger;
@@ -42,7 +42,7 @@ public void initialize(URL url, ResourceBundle resourceBundle) {
super.initialize(url, resourceBundle);
backBtn.setText("");
- backBtn.setGraphic(new MFXFontIcon("mfx-angle-down"));
+ backBtn.setGraphic(new MFXFontIcon("fas-angle-down"));
}
public static final Logger logger = Logger.getLogger(PixivMenuPaneController.class);
@@ -99,7 +99,7 @@ public void fetchBtnOnAction() {
ft.stop();
ft.setFromValue(1);
ft.setToValue(0);
- ft.setOnFinished((e) -> loadingPane.setVisible(false));
+ ft.setOnFinished((_) -> loadingPane.setVisible(false));
ft.play();
}
}).start();
diff --git a/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivRankingPaneController.java b/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivRankingPaneController.java
index f702074..d42b268 100644
--- a/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivRankingPaneController.java
+++ b/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivRankingPaneController.java
@@ -2,7 +2,7 @@
import io.github.palexdev.materialfx.controls.MFXComboBox;
import io.github.palexdev.materialfx.controls.MFXToggleButton;
-import io.github.palexdev.materialfx.font.MFXFontIcon;
+import io.github.palexdev.mfxresources.fonts.MFXFontIcon;
import javafx.application.Platform;
import javafx.fxml.FXML;
import org.apache.log4j.Logger;
@@ -42,7 +42,7 @@ public void initialize(URL url, ResourceBundle resourceBundle) {
super.initialize(url, resourceBundle);
backBtn.setText("");
- backBtn.setGraphic(new MFXFontIcon("mfx-angle-down"));
+ backBtn.setGraphic(new MFXFontIcon("fas-angle-down"));
majorCombo.getItems().addAll(
ResourceBundleUtil.getString("gui.pixiv.ranking.daily"),
@@ -55,7 +55,7 @@ public void initialize(URL url, ResourceBundle resourceBundle) {
ResourceBundleUtil.getString("gui.pixiv.ranking.female")
);
- majorCombo.selectedIndexProperty().addListener((observableValue, number, t1) -> {
+ majorCombo.selectedIndexProperty().addListener((_, _, t1) -> {
int i = t1.intValue();
if (i == 0 || i == 1 || i == 5 || i == 6 || i == 7) {
resToggle.setDisable(false);
@@ -127,43 +127,45 @@ public void fetchBtnOnAction() {
logger.info("Fetched " + ids.size() + " artwork ids, getting info");
int[] i = {0, 0, 0};
- ThreadPoolExecutor tpe = (ThreadPoolExecutor) Executors.newFixedThreadPool(2);
- for (; i[0] < ids.size(); i[0]++) {
- final int finalI = i[0];
- tpe.execute(() -> {
- int tries = 0;
- while (tries <= 5) {
- try {
- PixivArtwork a = PixivFetchUtil.getArtwork(
- ids.get(finalI),
- getCookie(),
- ConfigManager.getConfig().getString("proxyHost"),
- ConfigManager.getConfig().getInteger("proxyPort")
- );
- a.setFrom(From.Ranking);
- String rankingInfo = majorCombo.getSelectedItem() + (resToggle.isSelected() ? "*" : "") + "-" + minorCombo.getSelectedItem() + "#" + (finalI + 1);
- a.setRanking(rankingInfo);
- pixivArtworks.add(a);
- i[1]++;
- return;
- } catch (Exception e) {
- tries++;
+ try (ThreadPoolExecutor tpe = (ThreadPoolExecutor) Executors.newFixedThreadPool(2)) {
+ for (; i[0] < ids.size(); i[0]++) {
+ final int finalI = i[0];
+ tpe.execute(() -> {
+ int tries = 0;
+ while (tries <= 5) {
try {
- Thread.sleep(2000);
- } catch (InterruptedException ignored) {
+ PixivArtwork a = PixivFetchUtil.getArtwork(
+ ids.get(finalI),
+ getCookie(),
+ ConfigManager.getConfig().getString("proxyHost"),
+ ConfigManager.getConfig().getInteger("proxyPort")
+ );
+ a.setFrom(From.Ranking);
+ String rankingInfo = majorCombo.getSelectedItem() + (resToggle.isSelected() ? "*" : "") + "-" + minorCombo.getSelectedItem() + "#" + (finalI + 1);
+ a.setRanking(rankingInfo);
+ pixivArtworks.add(a);
+ i[1]++;
+ return;
+ } catch (Exception e) {
+ tries++;
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException ignored) {
+ }
}
}
+ i[1]++;
+ i[2]++;
+ });
+ }
+ while (tpe.getActiveCount() != 0) {
+ Platform.runLater(() -> subOperationLabel.setText(ResourceBundleUtil.getString("gui.pixiv.ranking.notice.getting") + " " + i[1] + "/" + ids.size() + " | " + ResourceBundleUtil.getString("gui.pixiv.ranking.failed") + " " + i[2]));
+ try {
+ //noinspection BusyWait
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
}
- i[1]++;
- i[2]++;
- });
- }
- while (tpe.getActiveCount() != 0) {
- Platform.runLater(() -> subOperationLabel.setText(ResourceBundleUtil.getString("gui.pixiv.ranking.notice.getting") + " " + i[1] + "/" + ids.size() + " | " + ResourceBundleUtil.getString("gui.pixiv.ranking.failed") + " " + i[2]));
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
}
}
Platform.runLater(() -> data.addAll(pixivArtworks));
@@ -181,7 +183,7 @@ public void fetchBtnOnAction() {
ft.stop();
ft.setFromValue(1);
ft.setToValue(0);
- ft.setOnFinished((e) -> loadingPane.setVisible(false));
+ ft.setOnFinished((_) -> loadingPane.setVisible(false));
ft.play();
}
}).start();
diff --git a/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivRelatedPaneController.java b/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivRelatedPaneController.java
index 36bf1dd..df313ab 100644
--- a/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivRelatedPaneController.java
+++ b/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivRelatedPaneController.java
@@ -2,7 +2,7 @@
import io.github.palexdev.materialfx.controls.MFXSlider;
import io.github.palexdev.materialfx.controls.MFXTextField;
-import io.github.palexdev.materialfx.font.MFXFontIcon;
+import io.github.palexdev.mfxresources.fonts.MFXFontIcon;
import javafx.application.Platform;
import javafx.fxml.FXML;
import org.apache.log4j.Logger;
@@ -34,7 +34,7 @@ public void initialize(URL url, ResourceBundle resourceBundle) {
super.initialize(url, resourceBundle);
backBtn.setText("");
- backBtn.setGraphic(new MFXFontIcon("mfx-angle-down"));
+ backBtn.setGraphic(new MFXFontIcon("fas-angle-down"));
}
public static final Logger logger = Logger.getLogger(PixivRelatedPaneController.class);
@@ -85,7 +85,7 @@ public void fetchBtnOnAction() {
ft.stop();
ft.setFromValue(1);
ft.setToValue(0);
- ft.setOnFinished((e) -> loadingPane.setVisible(false));
+ ft.setOnFinished((_) -> loadingPane.setVisible(false));
ft.play();
}
}).start();
diff --git a/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivSearchPaneController.java b/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivSearchPaneController.java
index 76cad1b..fda63b5 100644
--- a/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivSearchPaneController.java
+++ b/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivSearchPaneController.java
@@ -3,7 +3,7 @@
import io.github.palexdev.materialfx.controls.MFXComboBox;
import io.github.palexdev.materialfx.controls.MFXSlider;
import io.github.palexdev.materialfx.controls.MFXTextField;
-import io.github.palexdev.materialfx.font.MFXFontIcon;
+import io.github.palexdev.mfxresources.fonts.MFXFontIcon;
import javafx.application.Platform;
import javafx.fxml.FXML;
import org.apache.log4j.Logger;
@@ -52,7 +52,7 @@ public void initialize(URL url, ResourceBundle resourceBundle) {
super.initialize(url, resourceBundle);
backBtn.setText("");
- backBtn.setGraphic(new MFXFontIcon("mfx-angle-down"));
+ backBtn.setGraphic(new MFXFontIcon("fas-angle-down"));
typeCombo.getItems().addAll(
ResourceBundleUtil.getString("gui.pixiv.search.mode.top"),
@@ -66,7 +66,7 @@ public void initialize(URL url, ResourceBundle resourceBundle) {
ResourceBundleUtil.getString("gui.pixiv.disc.mode.adult")
);
- typeCombo.selectedIndexProperty().addListener((observableValue, number, t1) -> {
+ typeCombo.selectedIndexProperty().addListener((_, _, t1) -> {
int i = t1.intValue();
modeCombo.setDisable(i == 0);
pageSlider.setDisable(i == 0);
@@ -146,7 +146,7 @@ public void fetchBtnOnAction() {
ft.stop();
ft.setFromValue(1);
ft.setToValue(0);
- ft.setOnFinished((e) -> loadingPane.setVisible(false));
+ ft.setOnFinished((_) -> loadingPane.setVisible(false));
ft.play();
}
}).start();
diff --git a/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivUserPaneController.java b/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivUserPaneController.java
index 2b1d82b..e9328ba 100644
--- a/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivUserPaneController.java
+++ b/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/PixivUserPaneController.java
@@ -2,7 +2,7 @@
import io.github.palexdev.materialfx.controls.MFXSlider;
import io.github.palexdev.materialfx.controls.MFXTextField;
-import io.github.palexdev.materialfx.font.MFXFontIcon;
+import io.github.palexdev.mfxresources.fonts.MFXFontIcon;
import javafx.application.Platform;
import javafx.fxml.FXML;
import org.apache.log4j.Logger;
@@ -30,7 +30,7 @@ public void initialize(URL url, ResourceBundle resourceBundle) {
super.initialize(url, resourceBundle);
backBtn.setText("");
- backBtn.setGraphic(new MFXFontIcon("mfx-angle-down"));
+ backBtn.setGraphic(new MFXFontIcon("fas-angle-down"));
}
public static final Logger logger = Logger.getLogger(PixivUserPaneController.class);
@@ -94,7 +94,7 @@ public void fetchBtnOnAction() {
ft.stop();
ft.setFromValue(1);
ft.setToValue(0);
- ft.setOnFinished((e) -> loadingPane.setVisible(false));
+ ft.setOnFinished((_) -> loadingPane.setVisible(false));
ft.play();
}
}).start();
diff --git a/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/SettingsPaneController.java b/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/SettingsPaneController.java
index e22fe51..947562e 100644
--- a/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/SettingsPaneController.java
+++ b/src/main/java/xyz/zcraft/acgpicdownload/gui/controllers/SettingsPaneController.java
@@ -2,7 +2,7 @@
import com.alibaba.fastjson2.JSONObject;
import io.github.palexdev.materialfx.controls.*;
-import io.github.palexdev.materialfx.font.MFXFontIcon;
+import io.github.palexdev.mfxresources.fonts.MFXFontIcon;
import javafx.beans.value.ObservableValue;
import javafx.fxml.FXML;
import javafx.scene.control.ToggleGroup;
@@ -107,15 +107,21 @@ public Locale fromString(String s) {
restoreConfig();
backBtn.setText("");
- backBtn.setGraphic(new MFXFontIcon("mfx-angle-down"));
+ backBtn.setGraphic(new MFXFontIcon("fas-angle-down"));
bgChooseFolderBtn.setText("");
- bgChooseFolderBtn.setGraphic(new MFXFontIcon("mfx-folder"));
+ bgChooseFolderBtn.setGraphic(new MFXFontIcon("fas-folder"));
}
private void verifyProxy(ObservableValue extends String> observable, String oldValue, String newValue) {
proxyHost = null;
proxyPort = 0;
+
System.getProperties().put("proxySet", "false");
+ System.clearProperty("http.proxyHost");
+ System.clearProperty("http.proxyPort");
+ System.clearProperty("https.proxyHost");
+ System.clearProperty("https.proxyPort");
+
if (!newValue.isEmpty()) {
String[] str = newValue.split(":");
if (str.length == 2) {
@@ -131,6 +137,11 @@ private void verifyProxy(ObservableValue extends String> observable, String ol
System.getProperties().put("proxySet", "true");
System.getProperties().put("proxyHost", proxyHost);
System.getProperties().put("proxyPort", String.valueOf(proxyPort));
+
+ System.setProperty("http.proxyHost", proxyHost);
+ System.setProperty("http.proxyPort", String.valueOf(proxyPort));
+ System.setProperty("https.proxyHost", proxyHost);
+ System.setProperty("https.proxyPort", String.valueOf(proxyPort));
proxyField.setTextFill(MFXTextField.DEFAULT_TEXT_COLOR);
} else {
proxyField.setTextFill(Color.RED);
diff --git a/src/main/java/xyz/zcraft/acgpicdownload/util/pixiv/PixivFetchUtil.java b/src/main/java/xyz/zcraft/acgpicdownload/util/pixiv/PixivFetchUtil.java
index 912fa0e..d805510 100644
--- a/src/main/java/xyz/zcraft/acgpicdownload/util/pixiv/PixivFetchUtil.java
+++ b/src/main/java/xyz/zcraft/acgpicdownload/util/pixiv/PixivFetchUtil.java
@@ -15,6 +15,7 @@
public class PixivFetchUtil {
public static final String[] DISCOVERY_MODES = {"all", "safe", "r18"};
+ public static final String LOGIN = "https://accounts.pixiv.net/login";
private static final String TOP = "https://www.pixiv.net/ajax/top/illust?mode=all";
private static final String RELATED = "https://www.pixiv.net/ajax/illust/%s/recommend/init?limit=%d";
private static final String ARTWORK = "https://www.pixiv.net/artworks/";
@@ -54,7 +55,7 @@ public static PixivAccount getAccount(String cookieString, String proxyHost, Int
return userData;
}
} catch (Exception e) {
- e.printStackTrace();
+ throw new RuntimeException(e);
}
return null;
}
@@ -222,7 +223,7 @@ public static LinkedList getRankingIDs(@NotNull String major, String min
Elements rankingItems = c.get().body().getElementsByClass("ranking-item");
LinkedList ids = new LinkedList<>();
for (Element rankingItem : rankingItems) {
- String href = rankingItem.getElementsByClass("ranking-image-item").get(0).getElementsByTag("a").get(0).attr("href");
+ String href = rankingItem.getElementsByClass("ranking-image-item").getFirst().getElementsByTag("a").getFirst().attr("href");
String id = href.substring(href.lastIndexOf("/") + 1);
ids.add(id);
}
@@ -679,6 +680,7 @@ public static String getArtworkPageUrl(@NotNull PixivArtwork artwork) {
* @param id 作品id
* @return 作品页面URL
*/
+ @SuppressWarnings("unused")
public static String getArtworkPageUrl(@NotNull String id) {
return ARTWORK + id;
}
diff --git a/src/main/resources/xyz/zcraft/acgpicdownload/gui/fxml/PixivAccountPane.fxml b/src/main/resources/xyz/zcraft/acgpicdownload/gui/fxml/PixivAccountPane.fxml
index 2ba1a3c..c1fc29c 100644
--- a/src/main/resources/xyz/zcraft/acgpicdownload/gui/fxml/PixivAccountPane.fxml
+++ b/src/main/resources/xyz/zcraft/acgpicdownload/gui/fxml/PixivAccountPane.fxml
@@ -1,14 +1,17 @@
+
+
-
-
+
-
-
-
-
-
-
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
diff --git a/src/main/resources/xyz/zcraft/acgpicdownload/gui/fxml/PixivLoginPane.fxml b/src/main/resources/xyz/zcraft/acgpicdownload/gui/fxml/PixivLoginPane.fxml
new file mode 100644
index 0000000..da93e9b
--- /dev/null
+++ b/src/main/resources/xyz/zcraft/acgpicdownload/gui/fxml/PixivLoginPane.fxml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/xyz/zcraft/acgpicdownload/languages/String.properties b/src/main/resources/xyz/zcraft/acgpicdownload/languages/String.properties
index dd5310f..129a386 100644
--- a/src/main/resources/xyz/zcraft/acgpicdownload/languages/String.properties
+++ b/src/main/resources/xyz/zcraft/acgpicdownload/languages/String.properties
@@ -170,3 +170,9 @@ gui.pixiv.account.added=添加成功!
gui.pixiv.account.notLogin=未登录
gui.pixiv.account.refresh=刷新
gui.fetch.info.fetch=正在从%s抓取
+gui.pixiv.account.add.or=或手动输入Cookie登录
+gui.pixiv.account.add.browser.alert.title=提示
+gui.pixiv.account.add.browser.alert.header=通过内置浏览器登录
+gui.pixiv.account.add.browser.alert.content=点击确认后将会打开内置浏览器,请在浏览器中登录Pixiv账号,\
+ 登录成功后关闭浏览器窗口即可。\n若无法打开内置浏览器或登录过程出现问题,请手动输入Cookie登录
+gui.pixiv.account.add.browser=通过内置浏览器登录
diff --git a/src/main/resources/xyz/zcraft/acgpicdownload/languages/String_en.properties b/src/main/resources/xyz/zcraft/acgpicdownload/languages/String_en.properties
index ea23d44..672da2e 100644
--- a/src/main/resources/xyz/zcraft/acgpicdownload/languages/String_en.properties
+++ b/src/main/resources/xyz/zcraft/acgpicdownload/languages/String_en.properties
@@ -167,3 +167,11 @@ gui.pixiv.account.del=Del
gui.pixiv.account.addFailed=Failed to add!
gui.pixiv.account.refresh=Refresh
gui.fetch.info.fetch=Fetching from %s
+gui.pixiv.account.add.or=OR Enter cookie manually
+gui.pixiv.account.add.browser.alert.title=Directions
+gui.pixiv.account.add.browser.alert.header=Logging in via built-in browser
+gui.pixiv.account.add.browser.alert.content=Click Confirm to open the built-in browser, \
+ log in to your Pixiv account, and close the browser window after logging in.\
+ \nIf you are unable to open the built-in browser or have problems logging in, \
+ please manually enter the cookie to log in.
+gui.pixiv.account.add.browser=Login via built-in browser
diff --git a/src/main/resources/xyz/zcraft/acgpicdownload/languages/String_zh_CN.properties b/src/main/resources/xyz/zcraft/acgpicdownload/languages/String_zh_CN.properties
index f0eb208..17926d3 100644
--- a/src/main/resources/xyz/zcraft/acgpicdownload/languages/String_zh_CN.properties
+++ b/src/main/resources/xyz/zcraft/acgpicdownload/languages/String_zh_CN.properties
@@ -169,4 +169,10 @@ gui.pixiv.account.addFailed=添加失败!
gui.pixiv.account.added=添加成功!
gui.pixiv.account.notLogin=未登录
gui.pixiv.account.refresh=刷新
-gui.fetch.info.fetch=正在从%s抓取
\ No newline at end of file
+gui.fetch.info.fetch=正在从%s抓取
+gui.pixiv.account.add.or=或手动输入Cookie登录
+gui.pixiv.account.add.browser.alert.title=提示
+gui.pixiv.account.add.browser.alert.header=通过内置浏览器登录
+gui.pixiv.account.add.browser.alert.content=点击确认后将会打开内置浏览器,请在浏览器中登录Pixiv账号,\
+ 登录成功后关闭浏览器窗口即可。\n若无法打开内置浏览器或登录过程出现问题,请手动输入Cookie登录。
+gui.pixiv.account.add.browser=通过内置浏览器登录