Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta44 #114

Closed
wants to merge 56 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
1479feb
beta9
Hoshinonyaruko Jan 26, 2024
4a6f523
beta11
Hoshinonyaruko Jan 26, 2024
8739198
beta11
Hoshinonyaruko Jan 26, 2024
d9e0844
beta13
Hoshinonyaruko Jan 26, 2024
ab96bf7
beta14
Hoshinonyaruko Jan 26, 2024
9b7bf0e
beta12
Hoshinonyaruko Jan 26, 2024
7c66e7d
beta13
Hoshinonyaruko Jan 26, 2024
eb0b186
beta15
Hoshinonyaruko Jan 26, 2024
122de8b
beta16
Hoshinonyaruko Jan 26, 2024
5e4903f
beta17
Hoshinonyaruko Jan 26, 2024
7a82cfb
beta18
Hoshinonyaruko Jan 27, 2024
ecc8263
mergefix
Hoshinonyaruko Jan 27, 2024
d0a0a85
beta19
Hoshinonyaruko Jan 27, 2024
afcb856
beta20
Hoshinonyaruko Jan 27, 2024
fafe0f9
beta20
Hoshinonyaruko Jan 27, 2024
397d4c7
beta21
Hoshinonyaruko Jan 27, 2024
c00e1a8
fixmerge
Hoshinonyaruko Jan 27, 2024
42ed202
add_playermanager_api
Hoshinonyaruko Jan 27, 2024
31a6771
beta22
Hoshinonyaruko Jan 27, 2024
050d359
beta22
Hoshinonyaruko Jan 27, 2024
939e818
beta23
Hoshinonyaruko Jan 28, 2024
19cf927
merge
Hoshinonyaruko Jan 28, 2024
8073f3a
beta24
Hoshinonyaruko Jan 29, 2024
fdd6016
mergechanges
Hoshinonyaruko Jan 29, 2024
b167455
beta25
Hoshinonyaruko Jan 30, 2024
844698b
merge
Hoshinonyaruko Jan 30, 2024
f5c8d82
beta26
Hoshinonyaruko Jan 30, 2024
2d5e94d
merge
Hoshinonyaruko Jan 30, 2024
3076085
beta27
Hoshinonyaruko Jan 30, 2024
a8a67ed
beta28
Hoshinonyaruko Jan 31, 2024
4c954fa
beta28
Hoshinonyaruko Jan 31, 2024
2f9063e
beta28
Hoshinonyaruko Jan 31, 2024
cd6fad7
beta29
Hoshinonyaruko Jan 31, 2024
2651176
beta29
Hoshinonyaruko Jan 31, 2024
265b5e3
beta30
Hoshinonyaruko Jan 31, 2024
8aac47a
beta31
Hoshinonyaruko Feb 2, 2024
a559fa2
beta31
Hoshinonyaruko Feb 2, 2024
f5bb66a
beta32
Hoshinonyaruko Feb 2, 2024
44fac8f
beta33
Hoshinonyaruko Feb 6, 2024
a44ef68
merge
Hoshinonyaruko Feb 6, 2024
e731f93
beta34
Hoshinonyaruko Feb 8, 2024
c8921a1
beta34
Hoshinonyaruko Feb 8, 2024
e6b4a3e
beta35
Hoshinonyaruko Feb 8, 2024
ac77292
merge
Hoshinonyaruko Feb 8, 2024
3992e84
beta35
Hoshinonyaruko Feb 8, 2024
d19fc5c
beta36
Hoshinonyaruko Feb 8, 2024
ff271bc
merge
Hoshinonyaruko Feb 8, 2024
a451334
beta37
Hoshinonyaruko Feb 18, 2024
6e4f28c
beta37
Hoshinonyaruko Feb 18, 2024
89d6c06
beta38
Hoshinonyaruko Feb 18, 2024
75002bc
beta39
Hoshinonyaruko Feb 18, 2024
e808a36
beta40
Hoshinonyaruko Feb 18, 2024
d2d5f4c
beta41
Hoshinonyaruko Feb 25, 2024
a40afd7
beta41
Hoshinonyaruko Feb 25, 2024
5977c8d
beat43
Hoshinonyaruko Mar 2, 2024
0ca7960
beta43
Hoshinonyaruko Mar 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 2 additions & 30 deletions Broadcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package main
import (
"log"
"math/rand"
"net/http"
"net/url"
"strconv"
"time"

Expand Down Expand Up @@ -34,7 +32,7 @@ func (task *palworldBroadcast) RunpalworldBroadcast() {
log.Println("准备进行全服推送...现已支持所有语言broadcast!")
// 初始化RCON客户端
address := task.Config.Address + ":" + strconv.Itoa(task.Config.WorldSettings.RconPort)
rconClient := NewRconClient(address, task.Config.WorldSettings.AdminPassword, task.BackupTask)
rconClient := NewRconClient(address, task.Config.WorldSettings.AdminPassword, task.BackupTask, &task.Config)
if rconClient == nil {
log.Println("RCON客户端初始化失败,无法进行定期推送,请按教程正确开启rcon和设置服务端admin密码")
return
Expand All @@ -46,32 +44,6 @@ func (task *palworldBroadcast) RunpalworldBroadcast() {

// 获取随机选择的消息
randomMessage := task.Config.RegularMessages[randomIndex]

// 根据task.Config.UseDLL来决定发送方式
if task.Config.UseDll {
// 使用HTTP请求发送消息
dllPort, err := strconv.Atoi(task.Config.DllPort)
if err != nil {
log.Printf("Error converting DllPort from string to int: %v", err)
// 處理錯誤,例如返回或設置一個默認值
return
}
base := "http://127.0.0.1:" + strconv.Itoa(dllPort) + "/rcon?text="

messageText := url.QueryEscape("broadcast " + randomMessage)
fullURL := base + messageText

resp, err := http.Get(fullURL)
if err != nil {
log.Printf("Error sending HTTP request: %v", err)
} else {
defer resp.Body.Close()
// 这里可以添加对resp的处理逻辑
log.Println("Broadcast message sent successfully via HTTP")
}
} else {
// 使用Broadcast函数发送消息
Broadcast(randomMessage, rconClient)
}
Broadcast(randomMessage, rconClient, task.Config.UseDll)
}
}
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ type Config struct {
EnableEngineSetting bool `json:"enableEngineSetting"` // 是否开启引擎设置
EnableBotNotification bool `json:"enableBotNotification"` // 是否开启机器人广播
EnableRebootLater bool `json:"enableRebootLater"` // 是否开启延时关闭&重启
OverrideDLL bool `json:"overrideDLL"` // 是否由palgo中内置的dll覆盖游戏目录的dll
}

// 默认配置
Expand All @@ -89,6 +90,7 @@ var defaultConfig = Config{
AutolaunchWebui: true,
EnableUe4Debug: false,
EnableEngineSetting: true,
OverrideDLL: true,
BackupInterval: 1800, // 30 分钟
MemoryCheckInterval: 30, // 30 秒
MemoryUsageThreshold: 80, // 80%
Expand Down
189 changes: 189 additions & 0 deletions front/palworld-front/src/components/PalguardManage.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
<template>
<q-page class="q-pa-md">
<div class="q-mb-md">
<q-btn label="保存配置" color="primary" @click="saveConfig" />
<q-btn
label="重启服务器"
color="negative"
@click="restartServer"
class="q-ml-md"
/>
</div>
<q-form class="q-gutter-md">
<q-toggle v-model="config.RCONbase64" label="RCON 基于 Base64" />
<q-field label="管理员 IP">
<q-chip
v-for="(ip, index) in config.adminIPs"
:key="index"
removable
@remove="config.adminIPs.splice(index, 1)"
>
{{ ip }}
</q-chip>
<q-input
v-model="newAdminIP"
dense
placeholder="添加新 IP"
@keyup.enter="addAdminIP"
/>
</q-field>
<q-toggle v-model="config.allowAdminCheats" label="允许管理员作弊" />
<q-toggle
v-model="config.allowNoSpoilModWhichCanCrashYourServer"
label="允许NoSpoil模组(可能会崩溃服务器)"
/>
<q-toggle
v-model="config.allowSpawningNPCItems"
label="允许生成 NPC 物品"
/>
<q-toggle v-model="config.announceConnections" label="公告连接" />
<q-toggle v-model="config.announcePunishments" label="公告惩罚" />
<q-field label="禁止的聊天词">
<q-chip
v-for="(word, index) in config.bannedChatWords"
:key="index"
removable
@remove="config.bannedChatWords.splice(index, 1)"
>
{{ word }}
</q-chip>
<q-input
v-model="newBannedChatWord"
dense
placeholder="添加新聊天禁词"
@keyup.enter="addBannedChatWord"
/>
</q-field>
<q-field label="禁止的玩家昵称">
<q-chip
v-for="(name, index) in config.bannedNames"
:key="index"
removable
@remove="config.bannedNames.splice(index, 1)"
>
{{ name }}
</q-chip>
<q-input
v-model="newBannedName"
dense
placeholder="添加新禁止玩家昵称"
@keyup.enter="addBannedName"
/>
</q-field>
<q-toggle
v-model="config.blockNPCVendorCapture"
label="阻止 NPC 商人捕获"
/>
<q-toggle
v-model="config.blockTowerBossCapture"
label="阻止塔楼 Boss 捕获"
/>
<q-toggle v-model="config.chatBypassWait" label="聊天绕过等待" />
<q-toggle v-model="config.isChineseCmd" label="中文命令" />
<q-toggle v-model="config.isStealingAllowed" label="允许偷窃" />
<q-toggle v-model="config.logChat" label="输出聊天信息日志" />
<q-toggle v-model="config.logNetworking" label="输出网络日志" />
<q-toggle v-model="config.logRCON" label="输出RCON日志" />
<q-input
v-model="config.pveMaxToPalBanThreshold"
label="PvE 最大宠物封禁阈值"
type="number"
/>
<q-input
v-model="config.pvpMaxToBuildingDamage"
label="PvP 对建筑伤害最大值"
type="number"
/>
<q-input
v-model="config.pvpMaxToPalDamage"
label="PvP 对宠物伤害最大值"
type="number"
/>
<q-input
v-model="config.pvpMaxToPlayerDamage"
label="PvP 对玩家伤害最大值"
type="number"
/>
<q-toggle v-model="config.shouldBanCheaters" label="应封禁作弊者" />
<q-toggle v-model="config.shouldIPBanCheaters" label="应 IP 封禁作弊者" />
<q-toggle v-model="config.shouldKickCheaters" label="应踢出作弊者" />
<q-toggle v-model="config.shouldWarnCheaters" label="应警告作弊者" />
<q-toggle
v-model="config.shouldWarnCheatersReason"
label="警告作弊者原因"
/>
<q-toggle v-model="config.steamidProtection" label="Steam ID 保护" />
<q-toggle v-model="config.useAdminWhitelist" label="使用管理员白名单" />
<q-toggle v-model="config.useWhitelist" label="使用白名单" />
<q-input
v-model="config.whitelistMessage"
label="白名单消息"
type="textarea"
/>
</q-form>
</q-page>
</template>

<script setup>
import { ref, onMounted } from 'vue';
import { useQuasar } from 'quasar';
import axios from 'axios';
const $q = useQuasar();
const config = ref({});

onMounted(async () => {
try {
const response = await axios.get('/api/getpalguardjson', {
withCredentials: true,
});
config.value = response.data;
$q.notify({
type: 'positive',
message: '配置加载成功',
});
} catch (error) {
console.error('Error fetching configuration:', error);
$q.notify({
type: 'negative',
message: '获取配置失败',
});
}
});

const saveConfig = async () => {
try {
await axios.post('/api/savepalguardjson', config.value, {
withCredentials: true,
});
$q.notify({
type: 'positive',
message: '配置已保存!',
});
} catch (error) {
console.error('Error saving configuration:', error);
$q.notify({
type: 'negative',
message: '保存配置失败',
});
}
};

const restartServer = async () => {
try {
const response = await axios.post(
'/api/restart',
{},
{
withCredentials: true,
}
);
if (response.status === 200) {
alert('服务器重启命令已发送!');
} else {
console.error('服务器重启失败:', response.status);
}
} catch (error) {
console.error('Error sending restart command:', error);
}
};
</script>
57 changes: 34 additions & 23 deletions front/palworld-front/src/pages/IndexView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<q-tab name="server-check" label="主机管理" />
<q-tab name="save-manage" label="存档管理" />
<q-tab name="bot-manage" label="机器人管理" />
<q-tab name="palguard-manage" label="palguard管理" />
</q-tabs>
</q-header>

Expand All @@ -39,13 +40,13 @@
@click="restartServer"
class="q-mt-md"
/>
<!-- 答疑按钮 -->
<q-btn
color="secondary"
label="遇到问题,答疑按钮"
@click="getGroupLink"
class="q-mt-md"
/>
<!-- 答疑按钮 -->
<q-btn
color="secondary"
label="遇到问题,答疑按钮"
@click="getGroupLink"
class="q-mt-md"
/>
<!-- 文本输入框 -->
<q-input
filled
Expand Down Expand Up @@ -89,6 +90,11 @@
label="是否开启UE4窗口(关闭可以解决闪退,内存占用问题)"
class="q-my-md"
/>
<q-toggle
v-model="config.overrideDLL"
label="是否覆盖dll(不开请自己管理palguard和ue4的dll)"
class="q-my-md"
/>
<q-toggle
v-model="config.enableEngineSetting"
label="是否启用引擎配置,部分电脑修改引擎配置会卡顿,可关闭"
Expand Down Expand Up @@ -318,20 +324,20 @@
</div>
</q-page>
<q-page padding v-if="tab === 'server'">
<!-- 保存按钮 -->
<q-btn
color="primary"
label="保存"
@click="saveConfig"
class="q-mt-md"
/>
<!-- 重启服务端按钮 -->
<q-btn
color="secondary"
label="重启服务端"
@click="restartServer"
class="q-mt-md"
/>
<!-- 保存按钮 -->
<q-btn
color="primary"
label="保存"
@click="saveConfig"
class="q-mt-md"
/>
<!-- 重启服务端按钮 -->
<q-btn
color="secondary"
label="重启服务端"
@click="restartServer"
class="q-mt-md"
/>
<!-- 服务端配置修改页面内容 -->
<div class="q-gutter-xs q-mt-md">
<div class="text-subtitle2">服务端配置修改</div>
Expand Down Expand Up @@ -1056,6 +1062,10 @@
<q-page padding v-if="tab === 'bot-manage'">
<bot-manage />
</q-page>
<!-- palguard管理组件 -->
<q-page padding v-if="tab === 'palguard-manage'">
<palguard-manage />
</q-page>
</q-page-container>
</q-layout>
</template>
Expand All @@ -1070,13 +1080,16 @@
import SaveManage from 'components/SaveManage.vue';
import BotManage from 'components/BotManage.vue';
import BanManage from 'components/BanManage.vue';
import PalguardManage from 'components/PalguardManage.vue';

const $q = useQuasar();

//给components传递数据
const props = defineProps({
uin: Number,
});

const players = ref([]);

Check warning on line 1092 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on darwin for amd64

'players' is assigned a value but never used

Check warning on line 1092 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on linux for amd64

'players' is assigned a value but never used

Check warning on line 1092 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on darwin for arm64

'players' is assigned a value but never used

Check warning on line 1092 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on windows for amd64

'players' is assigned a value but never used

Check warning on line 1092 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on linux for arm64

'players' is assigned a value but never used

Check warning on line 1092 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on windows for amd64

'players' is assigned a value but never used

Check warning on line 1092 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on linux for arm64

'players' is assigned a value but never used

Check warning on line 1092 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on darwin for amd64

'players' is assigned a value but never used

Check warning on line 1092 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on linux for amd64

'players' is assigned a value but never used

Check warning on line 1092 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on darwin for arm64

'players' is assigned a value but never used

const status = ref(null); // 假设 ProcessInfo 是一个对象,这里使用 null 作为初始值

Expand All @@ -1090,11 +1103,11 @@
const showDifficultyTooltip = ref(false);
const showDeathPenaltyTooltip = ref(false);

const toggleTooltip = (type) => {

Check warning on line 1106 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on darwin for amd64

'type' is defined but never used

Check warning on line 1106 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on linux for amd64

'type' is defined but never used

Check warning on line 1106 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on darwin for arm64

'type' is defined but never used

Check warning on line 1106 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on windows for amd64

'type' is defined but never used

Check warning on line 1106 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on linux for arm64

'type' is defined but never used

Check warning on line 1106 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on windows for amd64

'type' is defined but never used

Check warning on line 1106 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on linux for arm64

'type' is defined but never used

Check warning on line 1106 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on darwin for amd64

'type' is defined but never used

Check warning on line 1106 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on linux for amd64

'type' is defined but never used

Check warning on line 1106 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on darwin for arm64

'type' is defined but never used
showDeathPenaltyTooltip.value = !showDeathPenaltyTooltip.value;
};

const toggleTooltip2 = (type) => {

Check warning on line 1110 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on darwin for amd64

'type' is defined but never used

Check warning on line 1110 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on linux for amd64

'type' is defined but never used

Check warning on line 1110 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on darwin for arm64

'type' is defined but never used

Check warning on line 1110 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on windows for amd64

'type' is defined but never used

Check warning on line 1110 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on linux for arm64

'type' is defined but never used

Check warning on line 1110 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on windows for amd64

'type' is defined but never used

Check warning on line 1110 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on linux for arm64

'type' is defined but never used

Check warning on line 1110 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on darwin for amd64

'type' is defined but never used

Check warning on line 1110 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on linux for amd64

'type' is defined but never used

Check warning on line 1110 in front/palworld-front/src/pages/IndexView.vue

View workflow job for this annotation

GitHub Actions / Build on darwin for arm64

'type' is defined but never used
showDifficultyTooltip.value = !showDifficultyTooltip.value;
};

Expand Down Expand Up @@ -1146,7 +1159,6 @@
}

onMounted(async () => {
const $q = useQuasar();
try {
const response = await axios.get('/api/getjson', {
withCredentials: true, // 确保携带 cookie
Expand All @@ -1166,7 +1178,6 @@
});

const saveConfig = async () => {
const $q = useQuasar();
try {
await axios.post('/api/savejson', config.value, {
withCredentials: true, // 确保携带 cookie
Expand Down
2 changes: 1 addition & 1 deletion memorycheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (task *MemoryCheckTask) checkMemory() {
log.Printf("Memory usage is above %v%%. Running clean command.", threshold)
// 初始化RCON客户端
address := task.Config.Address + ":" + strconv.Itoa(task.Config.WorldSettings.RconPort)
rconClient := NewRconClient(address, task.Config.WorldSettings.AdminPassword, task.BackupTask)
rconClient := NewRconClient(address, task.Config.WorldSettings.AdminPassword, task.BackupTask, &task.Config)
if rconClient == nil {
log.Println("RCON客户端初始化失败,无法处理内存使用情况,请按教程正确开启rcon和设置服务端admin密码")
return
Expand Down
Loading
Loading