palworld added
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const API_URL = import.meta.env.VITE_API_URL || 'https://monitor.dimension47.de/api'
|
||||
const API_URL = import.meta.env.VITE_API_URL || '/api'
|
||||
|
||||
async function fetchAPI(endpoint, options = {}) {
|
||||
const response = await fetch(`${API_URL}${endpoint}`, {
|
||||
@@ -185,3 +185,67 @@ export async function getFactorioWorldSettings(token, saveName) {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
})
|
||||
}
|
||||
|
||||
// Auto-Shutdown Settings
|
||||
export async function getAutoShutdownSettings(token, serverId) {
|
||||
return fetchAPI(`/servers/${serverId}/autoshutdown`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
})
|
||||
}
|
||||
|
||||
export async function setAutoShutdownSettings(token, serverId, enabled, timeoutMinutes) {
|
||||
return fetchAPI(`/servers/${serverId}/autoshutdown`, {
|
||||
method: 'PUT',
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
body: JSON.stringify({ enabled, timeoutMinutes }),
|
||||
})
|
||||
}
|
||||
|
||||
// Zomboid Config Management
|
||||
export async function getZomboidConfigs(token) {
|
||||
return fetchAPI('/servers/zomboid/config', {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
})
|
||||
}
|
||||
|
||||
export async function getZomboidConfig(token, filename) {
|
||||
return fetchAPI(`/servers/zomboid/config/${encodeURIComponent(filename)}`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
})
|
||||
}
|
||||
|
||||
export async function saveZomboidConfig(token, filename, content) {
|
||||
return fetchAPI(`/servers/zomboid/config/${encodeURIComponent(filename)}`, {
|
||||
method: 'PUT',
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
body: JSON.stringify({ content }),
|
||||
})
|
||||
}
|
||||
|
||||
// Palworld Config Management
|
||||
export async function getPalworldConfigs(token) {
|
||||
return fetchAPI('/servers/palworld/config', {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
})
|
||||
}
|
||||
|
||||
export async function getPalworldConfig(token, filename) {
|
||||
return fetchAPI(`/servers/palworld/config/${encodeURIComponent(filename)}`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
})
|
||||
}
|
||||
|
||||
export async function savePalworldConfig(token, filename, content) {
|
||||
return fetchAPI(`/servers/palworld/config/${encodeURIComponent(filename)}`, {
|
||||
method: 'PUT',
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
body: JSON.stringify({ content }),
|
||||
})
|
||||
}
|
||||
|
||||
// Activity Log
|
||||
export async function getActivityLog(token, limit = 100) {
|
||||
return fetchAPI(`/servers/activity-log?limit=${limit}`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user