feat(language): 添加多语言支持和文件关联管理器
- 新增 FileAssociationManager 类,用于管理文件扩展名与程序的关联 - 添加多语言支持,包括中文(简体、繁体)、英文、日文等 - 新增语言配置文件,定义了各种界面文本和提示信息 - 实现了在不同操作系统(Windows、macOS、Linux)上的文件关联功能
This commit is contained in:
14
build.gradle
14
build.gradle
@@ -89,15 +89,15 @@ dependencies {
|
|||||||
|
|
||||||
implementation 'com.github.javaparser:javaparser-core:3.25.1'
|
implementation 'com.github.javaparser:javaparser-core:3.25.1'
|
||||||
|
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-web' // Web支持
|
//implementation 'org.springframework.boot:spring-boot-starter-web' // Web支持
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa' // JPA数据库支持
|
//implementation 'org.springframework.boot:spring-boot-starter-data-jpa' // JPA数据库支持
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-validation' // 参数校验
|
//implementation 'org.springframework.boot:spring-boot-starter-validation' // 参数校验
|
||||||
|
|
||||||
// 安全相关依赖
|
// 安全相关依赖
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-security' // Spring Security
|
//implementation 'org.springframework.boot:spring-boot-starter-security' // Spring Security
|
||||||
implementation 'io.jsonwebtoken:jjwt-api:0.12.3' // JWT API
|
//implementation 'io.jsonwebtoken:jjwt-api:0.12.3' // JWT API
|
||||||
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.12.3', // JWT实现
|
//runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.12.3', // JWT实现
|
||||||
'io.jsonwebtoken:jjwt-jackson:0.12.3' // JWT序列化
|
// 'io.jsonwebtoken:jjwt-jackson:0.12.3' // JWT序列化
|
||||||
|
|
||||||
|
|
||||||
runtimeOnly 'com.mysql:mysql-connector-j'
|
runtimeOnly 'com.mysql:mysql-connector-j'
|
||||||
|
|||||||
@@ -45,8 +45,17 @@ fridaWindow.inject.end.err=[ERROR] \u505C\u6B62\u5931\u8D25:
|
|||||||
fridaWindow.inject.end.err.1=[WARN] \u6CA1\u6709\u6B63\u5728\u8FD0\u884C\u7684\u6CE8\u5165\u8FDB\u7A0B
|
fridaWindow.inject.end.err.1=[WARN] \u6CA1\u6709\u6B63\u5728\u8FD0\u884C\u7684\u6CE8\u5165\u8FDB\u7A0B
|
||||||
fridaWindow.menu=\u6587\u4EF6
|
fridaWindow.menu=\u6587\u4EF6
|
||||||
fridaWindow.menu.exit=\u9000\u51FA
|
fridaWindow.menu.exit=\u9000\u51FA
|
||||||
|
fridaWindow.menu.open=\u6253\u5F00\u6587\u4EF6
|
||||||
|
fridaWindow.menu.save=\u4FDD\u5B58\u6587\u4EF6
|
||||||
fridaWindow.menu.2=\u9000\u51FA
|
fridaWindow.menu.2=\u9000\u51FA
|
||||||
fridaWindow.menu.help=\u5E2E\u52A9
|
fridaWindow.menu.help=\u5E2E\u52A9
|
||||||
|
fridaWindow.menu.settingsMenu=\u8BBE\u7F6E
|
||||||
|
fridaWindow.menu.settingsMenu.settingsItem=\u7F16\u8F91\u5668\u8BBE\u7F6E
|
||||||
|
fridaWindow.settings.title=\u8BBE\u7F6E
|
||||||
|
fridaWindow.settings.font=\u5B57\u4F53
|
||||||
|
fridaWindow.settings.size=\u5927\u5C0F
|
||||||
|
fridaWindow.settings.theme=\u4E3B\u9898
|
||||||
|
fridaWindow.menu.settingsMenu.settingsItem.1=\u8BBE\u7F6E
|
||||||
fridaWindow.menu.help.about=\u5173\u4E8E
|
fridaWindow.menu.help.about=\u5173\u4E8E
|
||||||
|
|
||||||
localWindow.newBtn=\u65B0\u5BF9\u8BDD
|
localWindow.newBtn=\u65B0\u5BF9\u8BDD
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import com.axis.innovators.box.tools.LibraryLoad;
|
|||||||
import com.axis.innovators.box.tools.StateManager;
|
import com.axis.innovators.box.tools.StateManager;
|
||||||
import com.axis.innovators.box.tools.SystemInfoUtil;
|
import com.axis.innovators.box.tools.SystemInfoUtil;
|
||||||
import com.axis.innovators.box.util.PythonResult;
|
import com.axis.innovators.box.util.PythonResult;
|
||||||
|
import com.axis.innovators.box.util.UserLocalInformation;
|
||||||
|
import com.axis.innovators.box.verification.UserTags;
|
||||||
import com.formdev.flatlaf.FlatLightLaf;
|
import com.formdev.flatlaf.FlatLightLaf;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
@@ -58,6 +60,7 @@ public class AxisInnovatorsBox {
|
|||||||
private final RegistrationTopic registrationTopic = new RegistrationTopic(this);
|
private final RegistrationTopic registrationTopic = new RegistrationTopic(this);
|
||||||
private final List<WindowsJDialog> windowsJDialogList = new ArrayList<>();
|
private final List<WindowsJDialog> windowsJDialogList = new ArrayList<>();
|
||||||
private final StateManager stateManager = new StateManager();
|
private final StateManager stateManager = new StateManager();
|
||||||
|
private UserTags userTags;
|
||||||
|
|
||||||
public AxisInnovatorsBox(String[] args) {
|
public AxisInnovatorsBox(String[] args) {
|
||||||
this.args = args;
|
this.args = args;
|
||||||
@@ -340,7 +343,7 @@ public class AxisInnovatorsBox {
|
|||||||
public static void run(String[] args) {
|
public static void run(String[] args) {
|
||||||
main = new AxisInnovatorsBox(args);
|
main = new AxisInnovatorsBox(args);
|
||||||
try {
|
try {
|
||||||
//main.initLog4j2();
|
main.initLog4j2();
|
||||||
main.setTopic();
|
main.setTopic();
|
||||||
|
|
||||||
List<Map<String, String>> validFiles = ArgsParser.parseArgs(args);
|
List<Map<String, String>> validFiles = ArgsParser.parseArgs(args);
|
||||||
@@ -356,10 +359,13 @@ public class AxisInnovatorsBox {
|
|||||||
|
|
||||||
main.thread = new Thread(() -> {
|
main.thread = new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
|
UserLocalInformation userLocalInformation = new UserLocalInformation(main);
|
||||||
// 登录窗口
|
main.userTags = userLocalInformation.getUserTags();
|
||||||
LoginWindow.createAndShow();
|
if (main.userTags == null) {
|
||||||
|
// 登录窗口
|
||||||
|
main.userTags = LoginWindow.createAndShow();
|
||||||
|
userLocalInformation.setUserTags(main.userTags);
|
||||||
|
}
|
||||||
|
|
||||||
// 主任务1:加载插件
|
// 主任务1:加载插件
|
||||||
logger.info("Loaded plugins Started");
|
logger.info("Loaded plugins Started");
|
||||||
@@ -460,6 +466,14 @@ public class AxisInnovatorsBox {
|
|||||||
return AUTHOR;
|
return AUTHOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户标签
|
||||||
|
* @return 用户标签
|
||||||
|
*/
|
||||||
|
public UserTags getUserTags() {
|
||||||
|
return userTags;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取状态管理器
|
* 获取状态管理器
|
||||||
* @return 状态管理器
|
* @return 状态管理器
|
||||||
|
|||||||
@@ -16,16 +16,17 @@ import org.fife.ui.rtextarea.RTextScrollPane;
|
|||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.border.EmptyBorder;
|
import javax.swing.border.EmptyBorder;
|
||||||
|
import javax.swing.event.ChangeListener;
|
||||||
import javax.swing.table.DefaultTableCellRenderer;
|
import javax.swing.table.DefaultTableCellRenderer;
|
||||||
import javax.swing.table.DefaultTableModel;
|
import javax.swing.table.DefaultTableModel;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import java.io.BufferedReader;
|
import java.io.*;
|
||||||
import java.io.IOException;
|
import java.text.SimpleDateFormat;
|
||||||
import java.io.InputStreamReader;
|
import java.util.*;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.prefs.Preferences;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Frida注入工具窗口
|
* Frida注入工具窗口
|
||||||
@@ -41,6 +42,7 @@ public class FridaWindow extends WindowsJDialog {
|
|||||||
// IDEA风格配色
|
// IDEA风格配色
|
||||||
private static final Color BACKGROUND = new Color(0x2B2B2B);
|
private static final Color BACKGROUND = new Color(0x2B2B2B);
|
||||||
private static final Color SELECTION_COLOR = new Color(0x214283);
|
private static final Color SELECTION_COLOR = new Color(0x214283);
|
||||||
|
private JDialog settingsDialog;
|
||||||
|
|
||||||
public FridaWindow(Window owner) {
|
public FridaWindow(Window owner) {
|
||||||
super(owner, language.getText("fridaWindow.title"), ModalityType.APPLICATION_MODAL);
|
super(owner, language.getText("fridaWindow.title"), ModalityType.APPLICATION_MODAL);
|
||||||
@@ -99,6 +101,66 @@ public class FridaWindow extends WindowsJDialog {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createMenuBar() {
|
||||||
|
JMenuBar menuBar = new JMenuBar();
|
||||||
|
// 菜单栏深色背景
|
||||||
|
menuBar.setBackground(new Color(0x3C3F41));
|
||||||
|
menuBar.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0));
|
||||||
|
|
||||||
|
// 统一设置菜单UI属性
|
||||||
|
UIManager.put("Menu.background", new Color(0x3C3F41));
|
||||||
|
UIManager.put("Menu.foreground", new Color(0xBBBBBB));
|
||||||
|
UIManager.put("MenuItem.background", new Color(0x3C3F41));
|
||||||
|
UIManager.put("MenuItem.foreground", new Color(0xBBBBBB));
|
||||||
|
UIManager.put("MenuItem.selectionBackground", new Color(0x214283));
|
||||||
|
|
||||||
|
// 文件菜单
|
||||||
|
JMenu fileMenu = new JMenu(language.getText("fridaWindow.menu"));
|
||||||
|
styleMenu(fileMenu);
|
||||||
|
|
||||||
|
// 退出菜单项
|
||||||
|
JMenuItem exitItem = new JMenuItem(language.getText("fridaWindow.menu.exit"));
|
||||||
|
styleMenuItem(exitItem);
|
||||||
|
exitItem.addActionListener(e -> dispose());
|
||||||
|
|
||||||
|
JMenuItem openItem = new JMenuItem(language.getText("fridaWindow.menu.open"));
|
||||||
|
styleMenuItem(openItem);
|
||||||
|
openItem.addActionListener(e -> openFile());
|
||||||
|
|
||||||
|
JMenuItem saveItem = new JMenuItem(language.getText("fridaWindow.menu.save"));
|
||||||
|
styleMenuItem(saveItem);
|
||||||
|
saveItem.addActionListener(e -> saveFile());
|
||||||
|
|
||||||
|
fileMenu.add(exitItem);
|
||||||
|
fileMenu.add(openItem);
|
||||||
|
fileMenu.add(saveItem);
|
||||||
|
|
||||||
|
// 帮助菜单
|
||||||
|
JMenu helpMenu = new JMenu(language.getText("fridaWindow.menu.help"));
|
||||||
|
styleMenu(helpMenu);
|
||||||
|
|
||||||
|
// 设置菜单
|
||||||
|
JMenu settingsMenu = new JMenu(language.getText("fridaWindow.menu.settingsMenu"));
|
||||||
|
styleMenu(fileMenu);
|
||||||
|
|
||||||
|
JMenuItem settingsItem = new JMenuItem(language.getText("fridaWindow.menu.settingsMenu.settingsItem"));
|
||||||
|
styleMenuItem(settingsItem);
|
||||||
|
settingsItem.addActionListener(e -> settingsWindow());
|
||||||
|
settingsMenu.add(settingsItem);
|
||||||
|
|
||||||
|
// 关于菜单项
|
||||||
|
JMenuItem aboutItem = new JMenuItem(language.getText("fridaWindow.menu.help.about"));
|
||||||
|
styleMenuItem(aboutItem);
|
||||||
|
aboutItem.addActionListener(e -> showAboutDialog());
|
||||||
|
|
||||||
|
helpMenu.add(aboutItem);
|
||||||
|
|
||||||
|
menuBar.add(fileMenu);
|
||||||
|
menuBar.add(settingsMenu);
|
||||||
|
menuBar.add(helpMenu);
|
||||||
|
setJMenuBar(menuBar);
|
||||||
|
}
|
||||||
|
|
||||||
private void styleTextField(JTextField field, String placeholder) {
|
private void styleTextField(JTextField field, String placeholder) {
|
||||||
field.setFont(new Font("Microsoft YaHei", Font.PLAIN, 12));
|
field.setFont(new Font("Microsoft YaHei", Font.PLAIN, 12));
|
||||||
field.setBackground(new Color(0x3C3F41));
|
field.setBackground(new Color(0x3C3F41));
|
||||||
@@ -154,6 +216,7 @@ public class FridaWindow extends WindowsJDialog {
|
|||||||
public void mouseEntered(MouseEvent e) {
|
public void mouseEntered(MouseEvent e) {
|
||||||
btn.setBackground(new Color(color).brighter());
|
btn.setBackground(new Color(color).brighter());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mouseExited(MouseEvent e) {
|
public void mouseExited(MouseEvent e) {
|
||||||
btn.setBackground(new Color(color));
|
btn.setBackground(new Color(color));
|
||||||
}
|
}
|
||||||
@@ -161,6 +224,246 @@ public class FridaWindow extends WindowsJDialog {
|
|||||||
return btn;
|
return btn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void settingsWindow() {
|
||||||
|
settingsDialog = new JDialog(this, "编辑器设置", true);
|
||||||
|
settingsDialog.setSize(600, 450);
|
||||||
|
settingsDialog.setLocationRelativeTo(this);
|
||||||
|
|
||||||
|
JPanel mainPanel = new JPanel(new BorderLayout(10, 10));
|
||||||
|
mainPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||||
|
|
||||||
|
// 配置选项面板
|
||||||
|
JTabbedPane tabbedPane = new JTabbedPane();
|
||||||
|
|
||||||
|
// 颜色设置面板
|
||||||
|
JPanel colorPanel = createColorSettingsPanel();
|
||||||
|
tabbedPane.addTab("语法颜色", colorPanel);
|
||||||
|
|
||||||
|
// 字体设置面板
|
||||||
|
JPanel fontPanel = createFontSettingsPanel();
|
||||||
|
tabbedPane.addTab("字体设置", fontPanel);
|
||||||
|
|
||||||
|
// 底部按钮
|
||||||
|
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
|
||||||
|
JButton saveBtn = createModernButton("保存", 0x6897BB);
|
||||||
|
JButton defaultBtn = createModernButton("恢复默认", 0x808080);
|
||||||
|
JButton cancelBtn = createModernButton("取消", 0xD25252);
|
||||||
|
|
||||||
|
saveBtn.addActionListener(e -> applyAndSaveSettings());
|
||||||
|
defaultBtn.addActionListener(e -> restoreDefaultSettings());
|
||||||
|
cancelBtn.addActionListener(e -> settingsDialog.dispose());
|
||||||
|
|
||||||
|
buttonPanel.add(defaultBtn);
|
||||||
|
buttonPanel.add(cancelBtn);
|
||||||
|
buttonPanel.add(saveBtn);
|
||||||
|
|
||||||
|
mainPanel.add(tabbedPane, BorderLayout.CENTER);
|
||||||
|
mainPanel.add(buttonPanel, BorderLayout.SOUTH);
|
||||||
|
|
||||||
|
settingsDialog.setContentPane(mainPanel);
|
||||||
|
settingsDialog.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private JPanel createColorSettingsPanel() {
|
||||||
|
JPanel panel = new JPanel(new BorderLayout());
|
||||||
|
|
||||||
|
// 使用LinkedHashMap保持顺序
|
||||||
|
Map<String, Integer> tokenConfig = new LinkedHashMap<>();
|
||||||
|
tokenConfig.put("关键字(Frida)", Token.RESERVED_WORD);
|
||||||
|
tokenConfig.put("标准库函数", Token.RESERVED_WORD_2);
|
||||||
|
tokenConfig.put("内置函数", Token.FUNCTION);
|
||||||
|
tokenConfig.put("字符串", Token.LITERAL_STRING_DOUBLE_QUOTE);
|
||||||
|
tokenConfig.put("数字", Token.LITERAL_NUMBER_DECIMAL_INT);
|
||||||
|
tokenConfig.put("注释", Token.COMMENT_EOL);
|
||||||
|
tokenConfig.put("运算符", Token.OPERATOR);
|
||||||
|
tokenConfig.put("标识符", Token.IDENTIFIER);
|
||||||
|
tokenConfig.put("分隔符", Token.SEPARATOR);
|
||||||
|
tokenConfig.put("正则表达式", Token.REGEX);
|
||||||
|
|
||||||
|
DefaultTableModel model = new DefaultTableModel(new Object[]{"语法元素", "颜色示例"}, 0);
|
||||||
|
for (Map.Entry<String, Integer> entry : tokenConfig.entrySet()) {
|
||||||
|
Style style = scriptArea.getSyntaxScheme().getStyle(entry.getValue());
|
||||||
|
model.addRow(new Object[]{entry.getKey(), style.foreground});
|
||||||
|
}
|
||||||
|
|
||||||
|
JTable colorTable = new JTable(model);
|
||||||
|
colorTable.setRowHeight(30);
|
||||||
|
colorTable.getColumnModel().getColumn(1).setCellRenderer(new ColorRenderer());
|
||||||
|
colorTable.addMouseListener(new MouseAdapter() {
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
int column = colorTable.columnAtPoint(e.getPoint());
|
||||||
|
if (e.getClickCount() == 1 && column == 1) {
|
||||||
|
int row = colorTable.rowAtPoint(e.getPoint());
|
||||||
|
Color current = (Color) colorTable.getValueAt(row, 1);
|
||||||
|
Color newColor = JColorChooser.showDialog(settingsDialog,
|
||||||
|
"选择颜色", current);
|
||||||
|
if (newColor != null) {
|
||||||
|
colorTable.setValueAt(newColor, row, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
JScrollPane scrollPane = new JScrollPane(colorTable);
|
||||||
|
panel.add(scrollPane, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
// 保存颜色配置引用
|
||||||
|
panel.putClientProperty("tokenConfig", tokenConfig);
|
||||||
|
panel.putClientProperty("colorTable", colorTable);
|
||||||
|
|
||||||
|
return panel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private JPanel createFontSettingsPanel() {
|
||||||
|
JPanel panel = new JPanel(new GridLayout(0, 2, 10, 10));
|
||||||
|
|
||||||
|
// 字体名称
|
||||||
|
String[] fontNames = GraphicsEnvironment.getLocalGraphicsEnvironment()
|
||||||
|
.getAvailableFontFamilyNames();
|
||||||
|
JComboBox<String> fontCombo = new JComboBox<>(fontNames);
|
||||||
|
fontCombo.setSelectedItem(scriptArea.getFont().getFamily());
|
||||||
|
|
||||||
|
// 字体样式
|
||||||
|
JCheckBox boldCheck = new JCheckBox("粗体");
|
||||||
|
JCheckBox italicCheck = new JCheckBox("斜体");
|
||||||
|
|
||||||
|
// 字号
|
||||||
|
SpinnerModel sizeModel = new SpinnerNumberModel(
|
||||||
|
scriptArea.getFont().getSize(), 8, 48, 1);
|
||||||
|
JSpinner sizeSpinner = new JSpinner(sizeModel);
|
||||||
|
|
||||||
|
panel.add(new JLabel("字体名称:"));
|
||||||
|
panel.add(fontCombo);
|
||||||
|
panel.add(new JLabel("字号:"));
|
||||||
|
panel.add(sizeSpinner);
|
||||||
|
panel.add(new JLabel("样式:"));
|
||||||
|
JPanel stylePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
|
stylePanel.add(boldCheck);
|
||||||
|
stylePanel.add(italicCheck);
|
||||||
|
panel.add(stylePanel);
|
||||||
|
|
||||||
|
// 预览区域
|
||||||
|
JTextArea preview = new JTextArea("Frida示例代码:\nJava.perform(() => {\n // 注释\n console.log('Hello');\n for (var i = 0; i < 10; i++) {\n" +
|
||||||
|
" \n" +
|
||||||
|
"}});");
|
||||||
|
preview.setFont(scriptArea.getFont());
|
||||||
|
preview.setEditable(false);
|
||||||
|
preview.setBackground(scriptArea.getBackground());
|
||||||
|
preview.setForeground(scriptArea.getForeground());
|
||||||
|
|
||||||
|
// 监听变化
|
||||||
|
fontCombo.addActionListener(e -> updateFontPreview(fontCombo, sizeSpinner, boldCheck, italicCheck, preview));
|
||||||
|
sizeSpinner.addChangeListener(e -> updateFontPreview(fontCombo, sizeSpinner, boldCheck, italicCheck, preview));
|
||||||
|
boldCheck.addActionListener(e -> updateFontPreview(fontCombo, sizeSpinner, boldCheck, italicCheck, preview));
|
||||||
|
italicCheck.addActionListener(e -> updateFontPreview(fontCombo, sizeSpinner, boldCheck, italicCheck, preview));
|
||||||
|
|
||||||
|
panel.add(new JLabel("预览:"));
|
||||||
|
panel.add(new JScrollPane(preview));
|
||||||
|
|
||||||
|
// 保存控件引用
|
||||||
|
panel.putClientProperty("fontCombo", fontCombo);
|
||||||
|
panel.putClientProperty("sizeSpinner", sizeSpinner);
|
||||||
|
panel.putClientProperty("boldCheck", boldCheck);
|
||||||
|
panel.putClientProperty("italicCheck", italicCheck);
|
||||||
|
|
||||||
|
return panel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateFontPreview(JComboBox<String> fontCombo, JSpinner sizeSpinner,
|
||||||
|
JCheckBox boldCheck, JCheckBox italicCheck, JTextArea preview) {
|
||||||
|
String fontName = (String) fontCombo.getSelectedItem();
|
||||||
|
int size = (Integer) sizeSpinner.getValue();
|
||||||
|
int style = Font.PLAIN;
|
||||||
|
if (boldCheck.isSelected()) style |= Font.BOLD;
|
||||||
|
if (italicCheck.isSelected()) style |= Font.ITALIC;
|
||||||
|
Font newFont = new Font(fontName, style, size);
|
||||||
|
preview.setFont(newFont);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void applyAndSaveSettings() {
|
||||||
|
// 应用颜色设置
|
||||||
|
JPanel colorPanel = (JPanel) ((JTabbedPane)settingsDialog.getContentPane()
|
||||||
|
.getComponent(0)).getComponent(0);
|
||||||
|
|
||||||
|
Map<String, Integer> tokenConfig = (Map<String, Integer>) colorPanel.getClientProperty("tokenConfig");
|
||||||
|
JTable colorTable = (JTable) colorPanel.getClientProperty("colorTable");
|
||||||
|
|
||||||
|
SyntaxScheme scheme = scriptArea.getSyntaxScheme();
|
||||||
|
for (int i = 0; i < colorTable.getRowCount(); i++) {
|
||||||
|
String tokenName = (String) colorTable.getValueAt(i, 0);
|
||||||
|
Color color = (Color) colorTable.getValueAt(i, 1);
|
||||||
|
Integer tokenType = tokenConfig.get(tokenName);
|
||||||
|
if (tokenType != null) {
|
||||||
|
scheme.getStyle(tokenType).foreground = color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 应用字体设置
|
||||||
|
JPanel fontPanel = (JPanel) ((JTabbedPane)settingsDialog.getContentPane()
|
||||||
|
.getComponent(0)).getComponent(1);
|
||||||
|
|
||||||
|
JComboBox<String> fontCombo = (JComboBox<String>) fontPanel.getClientProperty("fontCombo");
|
||||||
|
JSpinner sizeSpinner = (JSpinner) fontPanel.getClientProperty("sizeSpinner");
|
||||||
|
JCheckBox boldCheck = (JCheckBox) fontPanel.getClientProperty("boldCheck");
|
||||||
|
JCheckBox italicCheck = (JCheckBox) fontPanel.getClientProperty("italicCheck");
|
||||||
|
|
||||||
|
String fontName = (String) fontCombo.getSelectedItem();
|
||||||
|
int size = (Integer) sizeSpinner.getValue();
|
||||||
|
int style = Font.PLAIN;
|
||||||
|
if (boldCheck.isSelected()) style |= Font.BOLD;
|
||||||
|
if (italicCheck.isSelected()) style |= Font.ITALIC;
|
||||||
|
Font newFont = new Font(fontName, style, size);
|
||||||
|
scriptArea.setFont(newFont);
|
||||||
|
|
||||||
|
// 保存到首选项
|
||||||
|
Preferences prefs = Preferences.userNodeForPackage(FridaWindow.class);
|
||||||
|
prefs.putInt("editor.font.style", style);
|
||||||
|
prefs.putInt("editor.font.size", size);
|
||||||
|
prefs.put("editor.font.name", fontName);
|
||||||
|
|
||||||
|
settingsDialog.dispose();
|
||||||
|
scriptArea.repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void restoreDefaultSettings() {
|
||||||
|
// 恢复颜色默认
|
||||||
|
configureIDEATheme(scriptArea.getSyntaxScheme());
|
||||||
|
|
||||||
|
// 恢复字体默认
|
||||||
|
Font defaultFont = new Font("JetBrains Mono", Font.PLAIN, 13);
|
||||||
|
if (!Arrays.asList(GraphicsEnvironment.getLocalGraphicsEnvironment()
|
||||||
|
.getAvailableFontFamilyNames()).contains("JetBrains Mono")) {
|
||||||
|
defaultFont = new Font("Consolas", Font.PLAIN, 14);
|
||||||
|
}
|
||||||
|
scriptArea.setFont(defaultFont);
|
||||||
|
|
||||||
|
// 清除首选项存储
|
||||||
|
Preferences prefs = Preferences.userNodeForPackage(FridaWindow.class);
|
||||||
|
prefs.remove("editor.font.name");
|
||||||
|
prefs.remove("editor.font.style");
|
||||||
|
prefs.remove("editor.font.size");
|
||||||
|
|
||||||
|
settingsDialog.dispose();
|
||||||
|
scriptArea.repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 自定义表格渲染器用于显示颜色
|
||||||
|
private static class ColorRenderer extends DefaultTableCellRenderer {
|
||||||
|
@Override
|
||||||
|
public Component getTableCellRendererComponent(JTable table, Object value,
|
||||||
|
boolean isSelected, boolean hasFocus, int row, int column) {
|
||||||
|
Component c = super.getTableCellRendererComponent(table, value,
|
||||||
|
isSelected, hasFocus, row, column);
|
||||||
|
if (value instanceof Color) {
|
||||||
|
setText("");
|
||||||
|
setBackground((Color) value);
|
||||||
|
setBorder(BorderFactory.createLineBorder(Color.GRAY));
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void styleComboBox(JComboBox<?> combo) {
|
private void styleComboBox(JComboBox<?> combo) {
|
||||||
combo.setRenderer(new DefaultListCellRenderer() {
|
combo.setRenderer(new DefaultListCellRenderer() {
|
||||||
@Override
|
@Override
|
||||||
@@ -174,44 +477,55 @@ public class FridaWindow extends WindowsJDialog {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createMenuBar() {
|
|
||||||
JMenuBar menuBar = new JMenuBar();
|
|
||||||
// 菜单栏深色背景
|
|
||||||
menuBar.setBackground(new Color(0x3C3F41));
|
|
||||||
menuBar.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0));
|
|
||||||
|
|
||||||
// 统一设置菜单UI属性
|
private void openFile() {
|
||||||
UIManager.put("Menu.background", new Color(0x3C3F41));
|
JFileChooser fileChooser = new JFileChooser();
|
||||||
UIManager.put("Menu.foreground", new Color(0xBBBBBB));
|
fileChooser.setFileFilter(new javax.swing.filechooser.FileNameExtensionFilter("Frida脚本配置 (*.frida)", "frida"));
|
||||||
UIManager.put("MenuItem.background", new Color(0x3C3F41));
|
int result = fileChooser.showOpenDialog(this);
|
||||||
UIManager.put("MenuItem.foreground", new Color(0xBBBBBB));
|
if (result == JFileChooser.APPROVE_OPTION) {
|
||||||
UIManager.put("MenuItem.selectionBackground", new Color(0x214283));
|
try (BufferedReader reader = new BufferedReader(new FileReader(fileChooser.getSelectedFile()))) {
|
||||||
|
String pid = reader.readLine();
|
||||||
// 文件菜单
|
StringBuilder script = new StringBuilder();
|
||||||
JMenu fileMenu = new JMenu(language.getText("fridaWindow.menu"));
|
String line;
|
||||||
styleMenu(fileMenu);
|
while ((line = reader.readLine()) != null) {
|
||||||
|
script.append(line).append("\n");
|
||||||
// 退出菜单项
|
}
|
||||||
JMenuItem exitItem = new JMenuItem(language.getText("fridaWindow.menu.exit"));
|
pidField.setText(pid);
|
||||||
styleMenuItem(exitItem);
|
scriptArea.setText(script.toString());
|
||||||
exitItem.addActionListener(e -> dispose());
|
} catch (IOException ex) {
|
||||||
|
logger.error("文件打开失败", ex);
|
||||||
// 帮助菜单
|
JOptionPane.showMessageDialog(this,
|
||||||
JMenu helpMenu = new JMenu(language.getText("fridaWindow.menu.help"));
|
"无法加载文件: " + ex.getMessage(),
|
||||||
styleMenu(helpMenu);
|
"IO错误",
|
||||||
|
JOptionPane.ERROR_MESSAGE);
|
||||||
// 关于菜单项
|
}
|
||||||
JMenuItem aboutItem = new JMenuItem(language.getText("fridaWindow.menu.help.about"));
|
}
|
||||||
styleMenuItem(aboutItem);
|
|
||||||
aboutItem.addActionListener(e -> showAboutDialog());
|
|
||||||
|
|
||||||
helpMenu.add(aboutItem);
|
|
||||||
|
|
||||||
menuBar.add(fileMenu);
|
|
||||||
menuBar.add(helpMenu);
|
|
||||||
setJMenuBar(menuBar);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void saveFile() {
|
||||||
|
JFileChooser fileChooser = new JFileChooser();
|
||||||
|
fileChooser.setFileFilter(new javax.swing.filechooser.FileNameExtensionFilter("Frida脚本配置 (*.frida)", "frida"));
|
||||||
|
int result = fileChooser.showSaveDialog(this);
|
||||||
|
if (result == JFileChooser.APPROVE_OPTION) {
|
||||||
|
File file = fileChooser.getSelectedFile();
|
||||||
|
if (!file.getName().toLowerCase().endsWith(".frida")) {
|
||||||
|
file = new File(file.getParentFile(), file.getName() + ".frida");
|
||||||
|
}
|
||||||
|
try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))) {
|
||||||
|
writer.write(pidField.getText());
|
||||||
|
writer.newLine();
|
||||||
|
writer.write(scriptArea.getText());
|
||||||
|
} catch (IOException ex) {
|
||||||
|
logger.error("文件保存失败", ex);
|
||||||
|
JOptionPane.showMessageDialog(this,
|
||||||
|
"无法保存文件: " + ex.getMessage(),
|
||||||
|
"IO错误",
|
||||||
|
JOptionPane.ERROR_MESSAGE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void styleMenu(JMenu menu) {
|
private void styleMenu(JMenu menu) {
|
||||||
menu.setFont(new Font("Microsoft YaHei", Font.PLAIN, 12));
|
menu.setFont(new Font("Microsoft YaHei", Font.PLAIN, 12));
|
||||||
menu.setForeground(new Color(0xBBBBBB));
|
menu.setForeground(new Color(0xBBBBBB));
|
||||||
@@ -232,6 +546,7 @@ public class FridaWindow extends WindowsJDialog {
|
|||||||
public void mouseEntered(MouseEvent e) {
|
public void mouseEntered(MouseEvent e) {
|
||||||
item.setBackground(new Color(0x515658));
|
item.setBackground(new Color(0x515658));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mouseExited(MouseEvent e) {
|
public void mouseExited(MouseEvent e) {
|
||||||
item.setBackground(new Color(0x3C3F41));
|
item.setBackground(new Color(0x3C3F41));
|
||||||
}
|
}
|
||||||
@@ -443,7 +758,9 @@ public class FridaWindow extends WindowsJDialog {
|
|||||||
isRepetition = true;
|
isRepetition = true;
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
frida.run(() -> {}).execute(frida12 -> {}).start();
|
frida.run(() -> {
|
||||||
|
}).execute(frida12 -> {
|
||||||
|
}).start();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
logger.error("Injection failure", ex);
|
logger.error("Injection failure", ex);
|
||||||
}
|
}
|
||||||
@@ -491,8 +808,7 @@ public class FridaWindow extends WindowsJDialog {
|
|||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
if (SwingUtilities.isRightMouseButton(e)) {
|
if (SwingUtilities.isRightMouseButton(e)) {
|
||||||
contextMenu.show(table, e.getX(), e.getY());
|
contextMenu.show(table, e.getX(), e.getY());
|
||||||
}
|
} else if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2) {
|
||||||
else if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2) {
|
|
||||||
injectSelectedProcess();
|
injectSelectedProcess();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -505,7 +821,7 @@ public class FridaWindow extends WindowsJDialog {
|
|||||||
|
|
||||||
private DefaultTableModel createTableModel() {
|
private DefaultTableModel createTableModel() {
|
||||||
processList = getProcesses();
|
processList = getProcesses();
|
||||||
String[] columns = { "进程名称", "进程ID" };
|
String[] columns = {"进程名称", "进程ID"};
|
||||||
Object[][] data = getTableData(processList);
|
Object[][] data = getTableData(processList);
|
||||||
return new DefaultTableModel(data, columns) {
|
return new DefaultTableModel(data, columns) {
|
||||||
@Override
|
@Override
|
||||||
@@ -572,6 +888,7 @@ public class FridaWindow extends WindowsJDialog {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行cmd命令获取所有进程信息
|
* 执行cmd命令获取所有进程信息
|
||||||
|
*
|
||||||
* @return 进程信息列表
|
* @return 进程信息列表
|
||||||
*/
|
*/
|
||||||
private List<ProcessInfo> getProcesses() {
|
private List<ProcessInfo> getProcesses() {
|
||||||
@@ -597,7 +914,8 @@ public class FridaWindow extends WindowsJDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private record ProcessInfo(long pid, String name) {}
|
private record ProcessInfo(long pid, String name) {
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.axis.innovators.box.gui;
|
package com.axis.innovators.box.gui;
|
||||||
|
|
||||||
|
import com.axis.innovators.box.verification.OnlineVerification;
|
||||||
import com.axis.innovators.box.verification.UserTags;
|
import com.axis.innovators.box.verification.UserTags;
|
||||||
import com.axis.innovators.box.verification.VerificationService;
|
import com.axis.innovators.box.verification.VerificationService;
|
||||||
import com.formdev.flatlaf.FlatDarculaLaf;
|
import com.formdev.flatlaf.FlatDarculaLaf;
|
||||||
@@ -8,6 +9,7 @@ import com.formdev.flatlaf.FlatIntelliJLaf;
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.border.LineBorder;
|
import javax.swing.border.LineBorder;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -22,21 +24,17 @@ public class LoginWindow {
|
|||||||
private JCheckBox showPasswordCheckBox;
|
private JCheckBox showPasswordCheckBox;
|
||||||
private static final int FIELD_WIDTH = 300;
|
private static final int FIELD_WIDTH = 300;
|
||||||
private static final int FIELD_HEIGHT = 35;
|
private static final int FIELD_HEIGHT = 35;
|
||||||
public static UserTags createAndShow() {
|
public static UserTags createAndShow() throws InterruptedException, InvocationTargetException {
|
||||||
AtomicReference<UserTags> result = new AtomicReference<>(UserTags.None);
|
AtomicReference<UserTags> result = new AtomicReference<>(UserTags.None);
|
||||||
try {
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
SwingUtilities.invokeAndWait(() -> {
|
LoginWindow loginWindow = new LoginWindow();
|
||||||
LoginWindow loginWindow = new LoginWindow();
|
loginWindow.dialog.setVisible(true);
|
||||||
loginWindow.dialog.setVisible(true);
|
result.set(loginResult.get());
|
||||||
result.set(loginResult.get());
|
|
||||||
|
|
||||||
if(result.get() == UserTags.None) {
|
if (result.get() == UserTags.None) {
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return result.get();
|
return result.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,7 +266,9 @@ public class LoginWindow {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
loginResult.set(VerificationService.determineUserType(null));
|
OnlineVerification onlineVerification = OnlineVerification.validateLogin(email, password);
|
||||||
|
loginResult.set(VerificationService.determineUserType(onlineVerification));
|
||||||
|
|
||||||
dialog.dispose();
|
dialog.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,16 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册主题
|
* 注册主题类,用于管理和注册主题。
|
||||||
|
* 该类允许添加主题,并提供了一系列方法来获取和管理已注册的主题。
|
||||||
|
* <p>
|
||||||
|
* 主要功能:
|
||||||
|
* - 注册主题类或 LookAndFeel 主题
|
||||||
|
* - 检查主题是否已加载
|
||||||
|
* - 设置主题加载状态
|
||||||
|
* - 检查主题列表是否为空
|
||||||
|
* - 获取已注册的主题类、主题名、图标、提示信息等
|
||||||
|
*
|
||||||
* @author tzdwindows 7
|
* @author tzdwindows 7
|
||||||
*/
|
*/
|
||||||
public class RegistrationTopic {
|
public class RegistrationTopic {
|
||||||
@@ -24,16 +33,24 @@ public class RegistrationTopic {
|
|||||||
private final AxisInnovatorsBox axisInnovatorsBox;
|
private final AxisInnovatorsBox axisInnovatorsBox;
|
||||||
private String loadTopics = "";
|
private String loadTopics = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造函数,初始化 RegistrationTopic 实例。
|
||||||
|
*
|
||||||
|
* @param axisInnovatorsBox AxisInnovatorsBox 实例,用于检查窗口状态
|
||||||
|
*/
|
||||||
public RegistrationTopic(AxisInnovatorsBox axisInnovatorsBox) {
|
public RegistrationTopic(AxisInnovatorsBox axisInnovatorsBox) {
|
||||||
this.axisInnovatorsBox = axisInnovatorsBox;
|
this.axisInnovatorsBox = axisInnovatorsBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册主题
|
* 注册主题类。
|
||||||
* @param topicClass 主题类
|
*
|
||||||
* @param topicName 主题名
|
* @param topicClass 主题类名
|
||||||
* @param icon 显示图标
|
* @param topicName 主题名称
|
||||||
* @param registeredName 注册名
|
* @param tip 主题提示信息
|
||||||
|
* @param icon 主题图标
|
||||||
|
* @param registeredName 主题注册名
|
||||||
|
* @throws RegistrationError 如果注册名已存在,则抛出异常
|
||||||
*/
|
*/
|
||||||
public void addTopic(String topicClass, String topicName, String tip ,Icon icon, String registeredName) {
|
public void addTopic(String topicClass, String topicName, String tip ,Icon icon, String registeredName) {
|
||||||
if (!axisInnovatorsBox.isWindow()) {
|
if (!axisInnovatorsBox.isWindow()) {
|
||||||
@@ -52,11 +69,14 @@ public class RegistrationTopic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册主题
|
* 注册 LookAndFeel 主题。
|
||||||
* @param topicClass 主题类
|
*
|
||||||
* @param topicName 主题名
|
* @param topicClass LookAndFeel 主题类
|
||||||
* @param icon 显示图标
|
* @param topicName 主题名称
|
||||||
* @param registeredName 注册名
|
* @param tip 主题提示信息
|
||||||
|
* @param icon 主题图标
|
||||||
|
* @param registeredName 主题注册名
|
||||||
|
* @throws RegistrationError 如果注册名已存在,则抛出异常
|
||||||
*/
|
*/
|
||||||
public void addTopic(LookAndFeel topicClass, String topicName, String tip ,Icon icon, String registeredName) {
|
public void addTopic(LookAndFeel topicClass, String topicName, String tip ,Icon icon, String registeredName) {
|
||||||
if (!axisInnovatorsBox.isWindow()) {
|
if (!axisInnovatorsBox.isWindow()) {
|
||||||
@@ -75,8 +95,10 @@ public class RegistrationTopic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断是否已经加载
|
* 检查指定主题是否已加载。
|
||||||
* @return 是否已经加载
|
*
|
||||||
|
* @param loading 要检查的主题名
|
||||||
|
* @return 如果主题已加载,则返回 true;否则返回 false
|
||||||
*/
|
*/
|
||||||
public boolean isLoading(String loading) {
|
public boolean isLoading(String loading) {
|
||||||
if (loadTopics.isEmpty()) {
|
if (loadTopics.isEmpty()) {
|
||||||
@@ -86,49 +108,82 @@ public class RegistrationTopic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置是否加载
|
* 设置当前加载的主题。
|
||||||
* @param loading 是否加载
|
*
|
||||||
|
* @param loading 要加载的主题名
|
||||||
*/
|
*/
|
||||||
public void setLoading(String loading) {
|
public void setLoading(String loading) {
|
||||||
loadTopics = loading;
|
loadTopics = loading;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断是否为空
|
* 检查主题列表是否为空。
|
||||||
* @return 是否为空
|
*
|
||||||
|
* @return 如果主题列表为空,则返回 true;否则返回 false
|
||||||
*/
|
*/
|
||||||
public boolean isEmpty() {
|
public boolean isEmpty() {
|
||||||
return registeredNameList.isEmpty();
|
return registeredNameList.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取主题类
|
* 获取已注册的主题类列表。
|
||||||
* @return 主题类
|
*
|
||||||
|
* @return 主题类列表
|
||||||
*/
|
*/
|
||||||
public List<String> getTopicsClasses() {
|
public List<String> getTopicsClasses() {
|
||||||
return topicsClasses;
|
return topicsClasses;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 AxisInnovatorsBox 实例。
|
||||||
|
*
|
||||||
|
* @return AxisInnovatorsBox 实例
|
||||||
|
*/
|
||||||
public AxisInnovatorsBox getAxisInnovatorsBox() {
|
public AxisInnovatorsBox getAxisInnovatorsBox() {
|
||||||
return axisInnovatorsBox;
|
return axisInnovatorsBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取已注册的 LookAndFeel 主题类列表。
|
||||||
|
*
|
||||||
|
* @return LookAndFeel 主题类列表
|
||||||
|
*/
|
||||||
public List<LookAndFeel> getTopicsClassesLookAndFeel() {
|
public List<LookAndFeel> getTopicsClassesLookAndFeel() {
|
||||||
return topicsClassesLookAndFeel;
|
return topicsClassesLookAndFeel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取已注册的主题图标列表。
|
||||||
|
*
|
||||||
|
* @return 主题图标列表
|
||||||
|
*/
|
||||||
public List<Icon> getIconList() {
|
public List<Icon> getIconList() {
|
||||||
return iconList;
|
return iconList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取已注册的主题名列表。
|
||||||
|
*
|
||||||
|
* @return 主题名列表
|
||||||
|
*/
|
||||||
public List<String> getRegisteredNameList() {
|
public List<String> getRegisteredNameList() {
|
||||||
return registeredNameList;
|
return registeredNameList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取已注册的主题提示信息列表。
|
||||||
|
*
|
||||||
|
* @return 主题提示信息列表
|
||||||
|
*/
|
||||||
public List<String> getTipList() {
|
public List<String> getTipList() {
|
||||||
return tipList;
|
return tipList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取已注册的主题名称列表。
|
||||||
|
*
|
||||||
|
* @return 主题名称列表
|
||||||
|
*/
|
||||||
public List<String> getTopicsName() {
|
public List<String> getTopicsName() {
|
||||||
return topicsName;
|
return topicsName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.axis.innovators.box.util;
|
||||||
|
|
||||||
|
import com.axis.innovators.box.AxisInnovatorsBox;
|
||||||
|
import com.axis.innovators.box.verification.OnlineVerification;
|
||||||
|
import com.axis.innovators.box.verification.UserTags;
|
||||||
|
import com.axis.innovators.box.verification.VerificationService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于存储用户信息
|
||||||
|
* @author tzdwindows 7
|
||||||
|
*/
|
||||||
|
public class UserLocalInformation {
|
||||||
|
private final AxisInnovatorsBox main;
|
||||||
|
|
||||||
|
public UserLocalInformation(AxisInnovatorsBox main){
|
||||||
|
this.main = main;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置用户信息
|
||||||
|
* @param userTags 用户信息
|
||||||
|
*/
|
||||||
|
public void setUserTags(UserTags userTags){
|
||||||
|
OnlineVerification onlineVerification = userTags.getUser();
|
||||||
|
main.getStateManager().saveState("password", onlineVerification.password);
|
||||||
|
main.getStateManager().saveState("verification", onlineVerification.onlineVerification);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户信息
|
||||||
|
* @return 用户信息
|
||||||
|
*/
|
||||||
|
public UserTags getUserTags(){
|
||||||
|
String verification = main.getStateManager().getState("verification");
|
||||||
|
String password = main.getStateManager().getState("password");
|
||||||
|
if (verification == null || password == null){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
OnlineVerification onlineVerification = OnlineVerification.validateLogin(
|
||||||
|
verification,
|
||||||
|
password);
|
||||||
|
return VerificationService.determineUserType(onlineVerification);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,17 +9,28 @@ import java.util.UUID;
|
|||||||
public class OnlineVerification {
|
public class OnlineVerification {
|
||||||
public String onlineVerification;
|
public String onlineVerification;
|
||||||
public UserTags userTags;
|
public UserTags userTags;
|
||||||
|
public String password;
|
||||||
public OnlineVerification(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
OnlineVerification(String onlineVerification, UserTags userTags){
|
OnlineVerification(String onlineVerification, UserTags userTags){
|
||||||
this.onlineVerification = onlineVerification;
|
this.onlineVerification = onlineVerification;
|
||||||
this.userTags = userTags;
|
this.userTags = userTags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OnlineVerification validateLogin(String identifier, String password){
|
/**
|
||||||
|
* 验证登录
|
||||||
|
* @param identifier
|
||||||
|
* @param password
|
||||||
|
*/
|
||||||
|
OnlineVerification(String identifier, String password){
|
||||||
|
this.onlineVerification = identifier;
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static OnlineVerification validateLogin(String identifier){
|
||||||
return new OnlineVerification(identifier, UserTags.RegularUsers);
|
return new OnlineVerification(identifier, UserTags.RegularUsers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static OnlineVerification validateLogin(String identifier, String password){
|
||||||
|
return new OnlineVerification(identifier, password);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.axis.innovators.box.verification;
|
package com.axis.innovators.box.verification;
|
||||||
|
|
||||||
|
import com.axis.innovators.box.AxisInnovatorsBox;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户标签组
|
* 用户标签组
|
||||||
* @author tzdwindows 7
|
* @author tzdwindows 7
|
||||||
@@ -28,5 +30,14 @@ public enum UserTags {
|
|||||||
/**
|
/**
|
||||||
* 企业用户标签
|
* 企业用户标签
|
||||||
*/
|
*/
|
||||||
EnterpriseUsers
|
EnterpriseUsers;
|
||||||
|
|
||||||
|
private OnlineVerification onlineVerification;
|
||||||
|
void setUser(OnlineVerification onlineVerification) {
|
||||||
|
this.onlineVerification = onlineVerification;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OnlineVerification getUser() {
|
||||||
|
return onlineVerification;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,10 @@ package com.axis.innovators.box.verification;
|
|||||||
* @author tzdwindows 7
|
* @author tzdwindows 7
|
||||||
*/
|
*/
|
||||||
public class VerificationService {
|
public class VerificationService {
|
||||||
public static OnlineVerification validateLogin(String identifier, String password) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static UserTags determineUserType(OnlineVerification identifier) {
|
public static UserTags determineUserType(OnlineVerification identifier) {
|
||||||
return UserTags.RegularUsers;
|
UserTags userTags = UserTags.RegularUsers;
|
||||||
|
userTags.setUser(identifier);
|
||||||
|
return userTags;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#Updated configuration
|
||||||
|
#Fri Mar 07 17:43:24 CST 2025
|
||||||
|
password=safasf
|
||||||
|
verification=aasfsaf
|
||||||
|
|||||||
Reference in New Issue
Block a user