Skip to content

Commit

Permalink
Merge pull request #9 from 1eof/master
Browse files Browse the repository at this point in the history
增加macOS手动安装的文档
  • Loading branch information
Ghost-chu authored Nov 3, 2024
2 parents 9e7a696 + 6f9c99a commit 71910b1
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 0 deletions.
32 changes: 32 additions & 0 deletions docs/setup/macOS/Installer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
sidebar_position: 1
---

# 安装器

## 下载和安装

打开 [GitHub Releases](https://github.com/PBH-BTN/PeerBanHelper/releases/latest)。你会找到两个以 `.dmg` 结尾的安装程序。

其中,一种带有 `nojava` 标记,另一种不带。如果你对什么是 Java 不熟悉,请选择**不带**nojava标记的下载。

双击打开刚刚下载的`.dmg`文件,再双击`PeerBanHelper安装程序.app`,选择打开,进行安装流程。

### 开机启动

勾选随系统启动时,当您登录到 macOS 桌面,PBH 就会静默启动到系统托盘。

## GUI/GUI Silent/NoGUI

### GUI

顾名思义,以图形窗口启动 PeerBanHelper。会有一个窗口可以查看日志,以及一个可以打开数据文件夹和免登录打开 WebUI 的菜单。
点击窗口的关闭按钮,就可以最小化到系统托盘图标。

### GUI Silent

以图形窗口启动 PeerBanHelper。但只显示系统托盘图标。

### NoGUI

以控制台的模式情况,最节约资源。适合硬核用户。
72 changes: 72 additions & 0 deletions docs/setup/macOS/Manual.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
sidebar_position: 2
---

# 手动安装
## 安装依赖
使用homebrew安装jdk:

```shell
brew install --cask zulu
```

验证安装是否成功:

```shell
java -version
```

如果安装成功,则会输出类似下列的版本号:

```plain
openjdk version "23.0.1" 2024-10-15
OpenJDK Runtime Environment Zulu23.30+13-CA (build 23.0.1+11)
OpenJDK 64-Bit Server VM Zulu23.30+13-CA (build 23.0.1+11, mixed mode, sharing)
```

## 运行
访问 Github Release 下载 [JAR 文件](https://github.com/PBH-BTN/PeerBanHelper/releases/latest/download/PeerBanHelper.jar)

使用命令启动 PBH:
```shell
java -Djava.awt.headless=true -Xmx512M -Xss512k -XX:+UseG1GC -XX:+UseStringDeduplication -XX:+ShrinkHeapInSteps -jar PeerBanHelper.jar nogui
```

## 服务
创建`~/Library/LaunchAgents/peerbanhelper.plist`文件,并写入:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>peerbanhelper</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/java</string>
<string>-Djava.awt.headless=true</string>
<string>-jar</string>
<string>-Xmx512M</string>
<string>-Xms512k</string>
<string>-XX:+UseG1GC</string>
<string>-XX:+UseStringDeduplication</string>
<string>-XX:+ShrinkHeapInSteps</string>
<string>PeerBanHelper.jar</string>
<string>nogui</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>WorkingDirectory</key>
<string>/path/to/PBH</string>
</dict>
</plist>
```

注意替换`/path/to/PBH`为jar文件的目录,完成后使用以下命令启动:

```shell
launchctl load -w ~/Library/LaunchAgents/peerbanhelper.plist
```

0 comments on commit 71910b1

Please sign in to comment.