feat: Add teleport config frontend — Pinia store, views, 2 components, router + nav
All checks were successful
Test Asgard Runner / test (push) Successful in 2s
All checks were successful
Test Asgard Runner / test (push) Successful in 2s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,7 @@ import {
|
|||||||
FileText,
|
FileText,
|
||||||
FolderOpen,
|
FolderOpen,
|
||||||
Crosshair,
|
Crosshair,
|
||||||
|
Navigation2,
|
||||||
Menu,
|
Menu,
|
||||||
X,
|
X,
|
||||||
} from 'lucide-vue-next'
|
} from 'lucide-vue-next'
|
||||||
@@ -46,6 +47,7 @@ const navItems = [
|
|||||||
{ name: 'Plugins', path: '/plugins', icon: Puzzle, permission: 'plugins.view' },
|
{ name: 'Plugins', path: '/plugins', icon: Puzzle, permission: 'plugins.view' },
|
||||||
{ name: 'File Manager', path: '/files', icon: FolderOpen, permission: 'files.view' },
|
{ name: 'File Manager', path: '/files', icon: FolderOpen, permission: 'files.view' },
|
||||||
{ name: 'Loot Builder', path: '/loot-builder', icon: Crosshair, permission: 'loot.view' },
|
{ name: 'Loot Builder', path: '/loot-builder', icon: Crosshair, permission: 'loot.view' },
|
||||||
|
{ name: 'Teleport Config', path: '/teleport-config', icon: Navigation2, permission: 'teleport.view' },
|
||||||
{ name: 'Auto-Wiper', path: '/wipes', icon: RefreshCw, permission: 'wipes.view' },
|
{ name: 'Auto-Wiper', path: '/wipes', icon: RefreshCw, permission: 'wipes.view' },
|
||||||
{ name: 'Maps', path: '/maps', icon: Map, permission: 'maps.view' },
|
{ name: 'Maps', path: '/maps', icon: Map, permission: 'maps.view' },
|
||||||
{ name: 'Chat Log', path: '/chat', icon: MessageSquare, permission: 'chat.view' },
|
{ name: 'Chat Log', path: '/chat', icon: MessageSquare, permission: 'chat.view' },
|
||||||
|
|||||||
195
frontend/src/components/teleport/PermissionGroupEditor.vue
Normal file
195
frontend/src/components/teleport/PermissionGroupEditor.vue
Normal file
@@ -0,0 +1,195 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, ref } from 'vue'
|
||||||
|
import { Plus, Trash2 } from 'lucide-vue-next'
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
configData: Record<string, any>
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
'update:configData': [configData: Record<string, any>]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const newGroupName = ref('')
|
||||||
|
|
||||||
|
// Merge all VIP maps by key name to compute the unified group list
|
||||||
|
const groups = computed(() => {
|
||||||
|
const homesLimits: Record<string, number> = props.configData?.Home?.VIPHomesLimits || {}
|
||||||
|
const cooldowns: Record<string, number> = props.configData?.TPR?.VIPCooldowns || {}
|
||||||
|
const countdowns: Record<string, number> = props.configData?.TPR?.VIPCountdowns || {}
|
||||||
|
const dailyLimits: Record<string, number> = props.configData?.TPR?.VIPDailyLimits || {}
|
||||||
|
|
||||||
|
const allKeys = new Set([
|
||||||
|
...Object.keys(homesLimits),
|
||||||
|
...Object.keys(cooldowns),
|
||||||
|
...Object.keys(countdowns),
|
||||||
|
...Object.keys(dailyLimits),
|
||||||
|
])
|
||||||
|
|
||||||
|
return Array.from(allKeys).map(name => ({
|
||||||
|
name,
|
||||||
|
homesLimit: homesLimits[name] ?? 5,
|
||||||
|
cooldown: cooldowns[name] ?? 300,
|
||||||
|
countdown: countdowns[name] ?? 5,
|
||||||
|
dailyLimit: dailyLimits[name] ?? 10,
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
|
||||||
|
function ensurePaths(data: Record<string, any>) {
|
||||||
|
if (!data.Home) data.Home = {}
|
||||||
|
if (!data.Home.VIPHomesLimits) data.Home.VIPHomesLimits = {}
|
||||||
|
if (!data.TPR) data.TPR = {}
|
||||||
|
if (!data.TPR.VIPCooldowns) data.TPR.VIPCooldowns = {}
|
||||||
|
if (!data.TPR.VIPCountdowns) data.TPR.VIPCountdowns = {}
|
||||||
|
if (!data.TPR.VIPDailyLimits) data.TPR.VIPDailyLimits = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addGroup() {
|
||||||
|
const name = newGroupName.value.trim()
|
||||||
|
if (!name) return
|
||||||
|
// Check if already exists
|
||||||
|
if (groups.value.some(g => g.name === name)) return
|
||||||
|
|
||||||
|
const updated = { ...props.configData }
|
||||||
|
ensurePaths(updated)
|
||||||
|
updated.Home.VIPHomesLimits[name] = 5
|
||||||
|
updated.TPR.VIPCooldowns[name] = 300
|
||||||
|
updated.TPR.VIPCountdowns[name] = 5
|
||||||
|
updated.TPR.VIPDailyLimits[name] = 10
|
||||||
|
emit('update:configData', updated)
|
||||||
|
newGroupName.value = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeGroup(name: string) {
|
||||||
|
if (!confirm(`Remove VIP group "${name}"?`)) return
|
||||||
|
const updated = { ...props.configData }
|
||||||
|
ensurePaths(updated)
|
||||||
|
delete updated.Home.VIPHomesLimits[name]
|
||||||
|
delete updated.TPR.VIPCooldowns[name]
|
||||||
|
delete updated.TPR.VIPCountdowns[name]
|
||||||
|
delete updated.TPR.VIPDailyLimits[name]
|
||||||
|
emit('update:configData', updated)
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateField(groupName: string, field: string, value: number) {
|
||||||
|
const updated = { ...props.configData }
|
||||||
|
ensurePaths(updated)
|
||||||
|
|
||||||
|
switch (field) {
|
||||||
|
case 'homesLimit':
|
||||||
|
updated.Home.VIPHomesLimits[groupName] = value
|
||||||
|
break
|
||||||
|
case 'cooldown':
|
||||||
|
updated.TPR.VIPCooldowns[groupName] = value
|
||||||
|
break
|
||||||
|
case 'countdown':
|
||||||
|
updated.TPR.VIPCountdowns[groupName] = value
|
||||||
|
break
|
||||||
|
case 'dailyLimit':
|
||||||
|
updated.TPR.VIPDailyLimits[groupName] = value
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
emit('update:configData', updated)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="space-y-4">
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<h3 class="text-sm font-semibold text-neutral-300 uppercase tracking-wider">VIP Permission Groups</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Add Group -->
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<input
|
||||||
|
v-model="newGroupName"
|
||||||
|
placeholder="New group name (e.g. vip, vip+, mvp)..."
|
||||||
|
class="flex-1 bg-neutral-800 border border-neutral-700 rounded-lg px-3 py-2 text-sm text-neutral-200"
|
||||||
|
@keydown.enter="addGroup"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
@click="addGroup"
|
||||||
|
:disabled="!newGroupName.trim()"
|
||||||
|
class="flex items-center gap-1 px-3 py-2 bg-oxide-500 text-white rounded-lg hover:bg-oxide-600 disabled:opacity-50 text-sm"
|
||||||
|
>
|
||||||
|
<Plus class="w-4 h-4" />
|
||||||
|
Add Group
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Empty State -->
|
||||||
|
<div v-if="groups.length === 0" class="bg-neutral-900 border border-neutral-800 rounded-xl p-8 text-center text-neutral-500 text-sm">
|
||||||
|
No VIP groups defined. Add groups to configure per-permission teleport limits, cooldowns, and countdowns.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Groups Table -->
|
||||||
|
<div v-else class="bg-neutral-900 border border-neutral-800 rounded-xl overflow-hidden">
|
||||||
|
<table class="w-full text-sm">
|
||||||
|
<thead>
|
||||||
|
<tr class="border-b border-neutral-800">
|
||||||
|
<th class="text-left py-3 px-4 text-neutral-500 font-medium">Group Name</th>
|
||||||
|
<th class="text-center py-3 px-4 text-neutral-500 font-medium w-28">Homes Limit</th>
|
||||||
|
<th class="text-center py-3 px-4 text-neutral-500 font-medium w-28">Cooldown (s)</th>
|
||||||
|
<th class="text-center py-3 px-4 text-neutral-500 font-medium w-28">Countdown (s)</th>
|
||||||
|
<th class="text-center py-3 px-4 text-neutral-500 font-medium w-28">Daily Limit</th>
|
||||||
|
<th class="w-12"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr
|
||||||
|
v-for="group in groups"
|
||||||
|
:key="group.name"
|
||||||
|
class="border-b border-neutral-800/50"
|
||||||
|
>
|
||||||
|
<td class="py-3 px-4 text-neutral-200 font-medium">{{ group.name }}</td>
|
||||||
|
<td class="py-3 px-4">
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
:value="group.homesLimit"
|
||||||
|
@input="updateField(group.name, 'homesLimit', Number(($event.target as HTMLInputElement).value))"
|
||||||
|
class="w-full bg-neutral-800 border border-neutral-700 rounded px-2 py-1 text-center text-neutral-200"
|
||||||
|
min="0"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td class="py-3 px-4">
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
:value="group.cooldown"
|
||||||
|
@input="updateField(group.name, 'cooldown', Number(($event.target as HTMLInputElement).value))"
|
||||||
|
class="w-full bg-neutral-800 border border-neutral-700 rounded px-2 py-1 text-center text-neutral-200"
|
||||||
|
min="0"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td class="py-3 px-4">
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
:value="group.countdown"
|
||||||
|
@input="updateField(group.name, 'countdown', Number(($event.target as HTMLInputElement).value))"
|
||||||
|
class="w-full bg-neutral-800 border border-neutral-700 rounded px-2 py-1 text-center text-neutral-200"
|
||||||
|
min="0"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td class="py-3 px-4">
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
:value="group.dailyLimit"
|
||||||
|
@input="updateField(group.name, 'dailyLimit', Number(($event.target as HTMLInputElement).value))"
|
||||||
|
class="w-full bg-neutral-800 border border-neutral-700 rounded px-2 py-1 text-center text-neutral-200"
|
||||||
|
min="0"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td class="py-3 px-4">
|
||||||
|
<button
|
||||||
|
@click="removeGroup(group.name)"
|
||||||
|
class="text-neutral-600 hover:text-red-400 transition-colors p-1"
|
||||||
|
>
|
||||||
|
<Trash2 class="w-4 h-4" />
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
76
frontend/src/components/teleport/WarpEditor.vue
Normal file
76
frontend/src/components/teleport/WarpEditor.vue
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { Plus, Trash2 } from 'lucide-vue-next'
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
warps: Record<string, { x: number; y: number; z: number }>
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
'update:warps': [warps: Record<string, { x: number; y: number; z: number }>]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const newWarpName = ref('')
|
||||||
|
|
||||||
|
function addWarp() {
|
||||||
|
const name = newWarpName.value.trim()
|
||||||
|
if (!name || props.warps[name]) return
|
||||||
|
const updated = { ...props.warps, [name]: { x: 0, y: 0, z: 0 } }
|
||||||
|
emit('update:warps', updated)
|
||||||
|
newWarpName.value = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeWarp(name: string) {
|
||||||
|
const updated = { ...props.warps }
|
||||||
|
delete updated[name]
|
||||||
|
emit('update:warps', updated)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="space-y-4">
|
||||||
|
<h3 class="text-sm font-semibold text-neutral-300 uppercase tracking-wider">Warps</h3>
|
||||||
|
|
||||||
|
<!-- Add Warp -->
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<input
|
||||||
|
v-model="newWarpName"
|
||||||
|
placeholder="Warp name..."
|
||||||
|
class="flex-1 bg-neutral-800 border border-neutral-700 rounded-lg px-3 py-2 text-sm text-neutral-200"
|
||||||
|
@keydown.enter="addWarp"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
@click="addWarp"
|
||||||
|
:disabled="!newWarpName.trim()"
|
||||||
|
class="flex items-center gap-1 px-3 py-2 bg-oxide-500 text-white rounded-lg hover:bg-oxide-600 disabled:opacity-50 text-sm"
|
||||||
|
>
|
||||||
|
<Plus class="w-4 h-4" />
|
||||||
|
Add
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Warp List -->
|
||||||
|
<div v-if="Object.keys(warps).length === 0" class="text-neutral-500 text-sm text-center py-4">
|
||||||
|
No warps defined. Add warps here and set coordinates in-game.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-for="(coords, name) in warps"
|
||||||
|
:key="name"
|
||||||
|
class="flex items-center justify-between bg-neutral-800/50 border border-neutral-700/50 rounded-lg px-4 py-3"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<span class="text-neutral-200 font-medium">{{ name }}</span>
|
||||||
|
<span class="text-neutral-500 text-xs ml-3">
|
||||||
|
{{ coords.x.toFixed(1) }}, {{ coords.y.toFixed(1) }}, {{ coords.z.toFixed(1) }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
@click="removeWarp(name as string)"
|
||||||
|
class="text-neutral-600 hover:text-red-400 transition-colors p-1"
|
||||||
|
>
|
||||||
|
<Trash2 class="w-4 h-4" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -115,6 +115,11 @@ const panelRoutes: RouteRecordRaw[] = [
|
|||||||
name: 'loot-builder',
|
name: 'loot-builder',
|
||||||
component: () => import('@/views/admin/LootBuilderView.vue'),
|
component: () => import('@/views/admin/LootBuilderView.vue'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'teleport-config',
|
||||||
|
name: 'teleport-config',
|
||||||
|
component: () => import('@/views/admin/TeleportConfigView.vue'),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'wipes',
|
path: 'wipes',
|
||||||
name: 'wipes',
|
name: 'wipes',
|
||||||
|
|||||||
145
frontend/src/stores/teleport.ts
Normal file
145
frontend/src/stores/teleport.ts
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
import { defineStore } from 'pinia'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { useApi } from '@/composables/useApi'
|
||||||
|
import { useToastStore } from '@/stores/toast'
|
||||||
|
import type { TeleportConfigSummary, TeleportConfigFull, TeleportApplyResult } from '@/types'
|
||||||
|
|
||||||
|
export const useTeleportStore = defineStore('teleport', () => {
|
||||||
|
const configs = ref<TeleportConfigSummary[]>([])
|
||||||
|
const currentConfig = ref<TeleportConfigFull | null>(null)
|
||||||
|
const isLoading = ref(false)
|
||||||
|
const isSaving = ref(false)
|
||||||
|
const isApplying = ref(false)
|
||||||
|
const isDirty = ref(false)
|
||||||
|
const api = useApi()
|
||||||
|
const toast = useToastStore()
|
||||||
|
|
||||||
|
async function fetchConfigs() {
|
||||||
|
isLoading.value = true
|
||||||
|
try {
|
||||||
|
const res = await api.get<{ configs: TeleportConfigSummary[] }>('/teleport/configs')
|
||||||
|
configs.value = res.configs
|
||||||
|
} catch (err) {
|
||||||
|
toast.error((err as Error).message)
|
||||||
|
} finally {
|
||||||
|
isLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadConfig(id: string) {
|
||||||
|
isLoading.value = true
|
||||||
|
try {
|
||||||
|
const res = await api.get<{ config: TeleportConfigFull }>(`/teleport/configs/${id}`)
|
||||||
|
currentConfig.value = res.config
|
||||||
|
isDirty.value = false
|
||||||
|
} catch (err) {
|
||||||
|
toast.error((err as Error).message)
|
||||||
|
} finally {
|
||||||
|
isLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createConfig(name: string, description?: string) {
|
||||||
|
try {
|
||||||
|
const res = await api.post<{ config: TeleportConfigFull }>('/teleport/configs', {
|
||||||
|
config_name: name,
|
||||||
|
description,
|
||||||
|
})
|
||||||
|
await fetchConfigs()
|
||||||
|
currentConfig.value = res.config
|
||||||
|
isDirty.value = false
|
||||||
|
toast.success(`Config "${name}" created`)
|
||||||
|
return res.config
|
||||||
|
} catch (err) {
|
||||||
|
toast.error((err as Error).message)
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function saveCurrentConfig() {
|
||||||
|
if (!currentConfig.value) return
|
||||||
|
isSaving.value = true
|
||||||
|
try {
|
||||||
|
await api.put(`/teleport/configs/${currentConfig.value.id}`, {
|
||||||
|
config_name: currentConfig.value.config_name,
|
||||||
|
description: currentConfig.value.description,
|
||||||
|
config_data: currentConfig.value.config_data,
|
||||||
|
})
|
||||||
|
isDirty.value = false
|
||||||
|
await fetchConfigs()
|
||||||
|
toast.success('Config saved')
|
||||||
|
} catch (err) {
|
||||||
|
toast.error((err as Error).message)
|
||||||
|
} finally {
|
||||||
|
isSaving.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteConfig(id: string) {
|
||||||
|
try {
|
||||||
|
await api.del(`/teleport/configs/${id}`)
|
||||||
|
if (currentConfig.value?.id === id) {
|
||||||
|
currentConfig.value = null
|
||||||
|
}
|
||||||
|
await fetchConfigs()
|
||||||
|
toast.success('Config deleted')
|
||||||
|
} catch (err) {
|
||||||
|
toast.error((err as Error).message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function applyToServer(id: string) {
|
||||||
|
isApplying.value = true
|
||||||
|
try {
|
||||||
|
const res = await api.post<TeleportApplyResult>(`/teleport/configs/${id}/apply`)
|
||||||
|
await fetchConfigs()
|
||||||
|
toast.success(res.message)
|
||||||
|
return res
|
||||||
|
} catch (err) {
|
||||||
|
toast.error((err as Error).message)
|
||||||
|
return null
|
||||||
|
} finally {
|
||||||
|
isApplying.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function importFromServer(configName: string) {
|
||||||
|
isLoading.value = true
|
||||||
|
try {
|
||||||
|
const res = await api.post<{ config: TeleportConfigFull }>('/teleport/import-from-server', {
|
||||||
|
config_name: configName,
|
||||||
|
})
|
||||||
|
await fetchConfigs()
|
||||||
|
currentConfig.value = res.config
|
||||||
|
isDirty.value = false
|
||||||
|
toast.success(`Config imported from server as "${configName}"`)
|
||||||
|
return res.config
|
||||||
|
} catch (err) {
|
||||||
|
toast.error((err as Error).message)
|
||||||
|
return null
|
||||||
|
} finally {
|
||||||
|
isLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function markDirty() {
|
||||||
|
isDirty.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
configs,
|
||||||
|
currentConfig,
|
||||||
|
isLoading,
|
||||||
|
isSaving,
|
||||||
|
isApplying,
|
||||||
|
isDirty,
|
||||||
|
fetchConfigs,
|
||||||
|
loadConfig,
|
||||||
|
createConfig,
|
||||||
|
saveCurrentConfig,
|
||||||
|
deleteConfig,
|
||||||
|
applyToServer,
|
||||||
|
importFromServer,
|
||||||
|
markDirty,
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -519,3 +519,30 @@ export interface LootApplyResult {
|
|||||||
profile_name: string
|
profile_name: string
|
||||||
multiplier: number
|
multiplier: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Teleport Config types — NTeleportation integration
|
||||||
|
export interface TeleportConfigSummary {
|
||||||
|
id: string
|
||||||
|
config_name: string
|
||||||
|
description: string | null
|
||||||
|
is_active: boolean
|
||||||
|
created_at: string
|
||||||
|
updated_at: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TeleportConfigFull {
|
||||||
|
id: string
|
||||||
|
license_id: string
|
||||||
|
config_name: string
|
||||||
|
description: string | null
|
||||||
|
config_data: Record<string, any>
|
||||||
|
is_active: boolean
|
||||||
|
created_at: string
|
||||||
|
updated_at: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TeleportApplyResult {
|
||||||
|
success: boolean
|
||||||
|
message: string
|
||||||
|
config_name: string
|
||||||
|
}
|
||||||
|
|||||||
694
frontend/src/views/admin/TeleportConfigView.vue
Normal file
694
frontend/src/views/admin/TeleportConfigView.vue
Normal file
@@ -0,0 +1,694 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, onMounted } from 'vue'
|
||||||
|
import { useTeleportStore } from '@/stores/teleport'
|
||||||
|
import { useToastStore } from '@/stores/toast'
|
||||||
|
import PermissionGroupEditor from '@/components/teleport/PermissionGroupEditor.vue'
|
||||||
|
import {
|
||||||
|
Save,
|
||||||
|
Play,
|
||||||
|
Download,
|
||||||
|
Plus,
|
||||||
|
Trash2,
|
||||||
|
Navigation2,
|
||||||
|
Home,
|
||||||
|
Users,
|
||||||
|
Settings as SettingsIcon,
|
||||||
|
Loader2,
|
||||||
|
} from 'lucide-vue-next'
|
||||||
|
|
||||||
|
const store = useTeleportStore()
|
||||||
|
const toast = useToastStore()
|
||||||
|
|
||||||
|
const activeTab = ref<'general' | 'homes' | 'tpr' | 'vip'>('general')
|
||||||
|
const showCreateModal = ref(false)
|
||||||
|
const showImportModal = ref(false)
|
||||||
|
const newConfigName = ref('')
|
||||||
|
const newConfigDesc = ref('')
|
||||||
|
const importConfigName = ref('')
|
||||||
|
|
||||||
|
const tabs = [
|
||||||
|
{ key: 'general', label: 'General', icon: SettingsIcon },
|
||||||
|
{ key: 'homes', label: 'Homes', icon: Home },
|
||||||
|
{ key: 'tpr', label: 'TPR', icon: Navigation2 },
|
||||||
|
{ key: 'vip', label: 'VIP Groups', icon: Users },
|
||||||
|
]
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
await store.fetchConfigs()
|
||||||
|
if (store.configs.length > 0 && store.configs[0]) {
|
||||||
|
await store.loadConfig(store.configs[0].id)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// --- Config data helpers ---
|
||||||
|
|
||||||
|
function getConfigValue(path: string, defaultValue: any = false): any {
|
||||||
|
if (!store.currentConfig?.config_data) return defaultValue
|
||||||
|
const parts = path.split('.')
|
||||||
|
let current: any = store.currentConfig.config_data
|
||||||
|
for (const part of parts) {
|
||||||
|
if (current == null || typeof current !== 'object') return defaultValue
|
||||||
|
current = current[part]
|
||||||
|
}
|
||||||
|
return current ?? defaultValue
|
||||||
|
}
|
||||||
|
|
||||||
|
function setConfigValue(path: string, value: any) {
|
||||||
|
if (!store.currentConfig) return
|
||||||
|
if (!store.currentConfig.config_data) store.currentConfig.config_data = {}
|
||||||
|
const parts = path.split('.')
|
||||||
|
let current: any = store.currentConfig.config_data
|
||||||
|
for (let i = 0; i < parts.length - 1; i++) {
|
||||||
|
const part = parts[i]!
|
||||||
|
if (current[part] == null || typeof current[part] !== 'object') {
|
||||||
|
current[part] = {}
|
||||||
|
}
|
||||||
|
current = current[part]
|
||||||
|
}
|
||||||
|
current[parts[parts.length - 1]!] = value
|
||||||
|
store.markDirty()
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Action handlers ---
|
||||||
|
|
||||||
|
async function handleConfigChange(id: string) {
|
||||||
|
if (store.isDirty) {
|
||||||
|
if (!confirm('Unsaved changes will be lost. Continue?')) return
|
||||||
|
}
|
||||||
|
await store.loadConfig(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleCreateConfig() {
|
||||||
|
if (!newConfigName.value.trim()) return
|
||||||
|
const config = await store.createConfig(
|
||||||
|
newConfigName.value.trim(),
|
||||||
|
newConfigDesc.value.trim() || undefined,
|
||||||
|
)
|
||||||
|
if (config) {
|
||||||
|
showCreateModal.value = false
|
||||||
|
newConfigName.value = ''
|
||||||
|
newConfigDesc.value = ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleDeleteConfig() {
|
||||||
|
if (!store.currentConfig) return
|
||||||
|
if (!confirm(`Delete "${store.currentConfig.config_name}"? This cannot be undone.`)) return
|
||||||
|
await store.deleteConfig(store.currentConfig.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleApply() {
|
||||||
|
if (!store.currentConfig) return
|
||||||
|
if (!confirm('Apply this teleport config to the server? This will overwrite the current NTeleportation config.')) return
|
||||||
|
if (store.isDirty) {
|
||||||
|
await store.saveCurrentConfig()
|
||||||
|
}
|
||||||
|
await store.applyToServer(store.currentConfig.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleImport() {
|
||||||
|
if (!importConfigName.value.trim()) return
|
||||||
|
const config = await store.importFromServer(importConfigName.value.trim())
|
||||||
|
if (config) {
|
||||||
|
showImportModal.value = false
|
||||||
|
importConfigName.value = ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePermissionGroupUpdate(updatedData: Record<string, any>) {
|
||||||
|
if (!store.currentConfig) return
|
||||||
|
store.currentConfig.config_data = updatedData
|
||||||
|
store.markDirty()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="p-6 space-y-6">
|
||||||
|
<!-- Header -->
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<h1 class="text-2xl font-bold text-white">Teleport Config</h1>
|
||||||
|
<div class="flex items-center gap-3">
|
||||||
|
<button
|
||||||
|
@click="showCreateModal = true"
|
||||||
|
class="flex items-center gap-2 px-3 py-2 bg-neutral-800 text-neutral-300 rounded-lg hover:bg-neutral-700 text-sm"
|
||||||
|
>
|
||||||
|
<Plus class="w-4 h-4" />
|
||||||
|
New Config
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Config Selector + Action Bar -->
|
||||||
|
<div class="bg-neutral-900 border border-neutral-800 rounded-xl p-4">
|
||||||
|
<div class="flex items-center gap-3 flex-wrap">
|
||||||
|
<!-- Config Selector -->
|
||||||
|
<select
|
||||||
|
v-if="store.configs.length > 0"
|
||||||
|
:value="store.currentConfig?.id || ''"
|
||||||
|
@change="handleConfigChange(($event.target as HTMLSelectElement).value)"
|
||||||
|
class="bg-neutral-800 border border-neutral-700 text-neutral-200 rounded-lg px-3 py-2 text-sm min-w-[200px]"
|
||||||
|
>
|
||||||
|
<option v-for="c in store.configs" :key="c.id" :value="c.id">
|
||||||
|
{{ c.config_name }}
|
||||||
|
<template v-if="c.is_active"> (Active)</template>
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<span v-else class="text-neutral-500 text-sm">No configs yet</span>
|
||||||
|
|
||||||
|
<!-- Save -->
|
||||||
|
<button
|
||||||
|
@click="store.saveCurrentConfig()"
|
||||||
|
:disabled="!store.currentConfig || !store.isDirty || store.isSaving"
|
||||||
|
class="flex items-center gap-2 px-3 py-2 bg-oxide-500 text-white rounded-lg hover:bg-oxide-600 disabled:opacity-50 disabled:cursor-not-allowed text-sm"
|
||||||
|
>
|
||||||
|
<Save class="w-4 h-4" />
|
||||||
|
{{ store.isSaving ? 'Saving...' : 'Save' }}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<!-- Apply to Server -->
|
||||||
|
<button
|
||||||
|
@click="handleApply"
|
||||||
|
:disabled="!store.currentConfig || store.isApplying"
|
||||||
|
class="flex items-center gap-2 px-3 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 disabled:opacity-50 disabled:cursor-not-allowed text-sm"
|
||||||
|
>
|
||||||
|
<Play class="w-4 h-4" />
|
||||||
|
{{ store.isApplying ? 'Applying...' : 'Apply to Server' }}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<!-- Import from Server -->
|
||||||
|
<button
|
||||||
|
@click="showImportModal = true"
|
||||||
|
class="flex items-center gap-2 px-3 py-2 bg-neutral-800 text-neutral-300 rounded-lg hover:bg-neutral-700 text-sm"
|
||||||
|
>
|
||||||
|
<Download class="w-4 h-4" />
|
||||||
|
Import from Server
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<!-- Delete -->
|
||||||
|
<button
|
||||||
|
@click="handleDeleteConfig"
|
||||||
|
:disabled="!store.currentConfig"
|
||||||
|
class="flex items-center gap-2 px-3 py-2 bg-red-500/10 text-red-400 rounded-lg hover:bg-red-500/20 disabled:opacity-50 text-sm ml-auto"
|
||||||
|
>
|
||||||
|
<Trash2 class="w-4 h-4" />
|
||||||
|
Delete
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Loading State -->
|
||||||
|
<div v-if="store.isLoading" class="flex items-center justify-center py-20">
|
||||||
|
<div class="animate-spin w-8 h-8 border-2 border-oxide-500 border-t-transparent rounded-full" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- No Config Selected -->
|
||||||
|
<div v-else-if="!store.currentConfig" class="bg-neutral-900 border border-neutral-800 rounded-xl p-12 text-center">
|
||||||
|
<Navigation2 class="w-12 h-12 text-neutral-600 mx-auto mb-4" />
|
||||||
|
<h2 class="text-lg font-semibold text-neutral-300 mb-2">No Teleport Config Selected</h2>
|
||||||
|
<p class="text-neutral-500 mb-4">Create a new config, import from server, or select one from the dropdown above.</p>
|
||||||
|
<button
|
||||||
|
@click="showCreateModal = true"
|
||||||
|
class="px-4 py-2 bg-oxide-500 text-white rounded-lg hover:bg-oxide-600"
|
||||||
|
>
|
||||||
|
Create First Config
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Config Editor -->
|
||||||
|
<div v-else class="space-y-6">
|
||||||
|
<!-- Tab Bar -->
|
||||||
|
<div class="flex border-b border-neutral-800">
|
||||||
|
<button
|
||||||
|
v-for="tab in tabs"
|
||||||
|
:key="tab.key"
|
||||||
|
@click="activeTab = tab.key as typeof activeTab"
|
||||||
|
class="flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 transition-colors"
|
||||||
|
:class="activeTab === tab.key
|
||||||
|
? 'border-oxide-500 text-oxide-400'
|
||||||
|
: 'border-transparent text-neutral-500 hover:text-neutral-300'"
|
||||||
|
>
|
||||||
|
<component :is="tab.icon" class="w-4 h-4" />
|
||||||
|
{{ tab.label }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- General Tab -->
|
||||||
|
<div v-if="activeTab === 'general'" class="bg-neutral-900 border border-neutral-800 rounded-xl p-6 space-y-6">
|
||||||
|
<h3 class="text-sm font-semibold text-neutral-300 uppercase tracking-wider">General Settings</h3>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||||
|
<!-- UseEconomics -->
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<div>
|
||||||
|
<label class="text-sm text-neutral-200">Use Economics</label>
|
||||||
|
<p class="text-xs text-neutral-500">Charge players for teleports via Economics plugin</p>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
@click="setConfigValue('Settings.UseEconomics', !getConfigValue('Settings.UseEconomics', false))"
|
||||||
|
class="relative w-11 h-6 rounded-full transition-colors"
|
||||||
|
:class="getConfigValue('Settings.UseEconomics', false) ? 'bg-oxide-500' : 'bg-neutral-700'"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full transition-transform"
|
||||||
|
:class="getConfigValue('Settings.UseEconomics', false) ? 'translate-x-5' : 'translate-x-0'"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- UseServerRewards -->
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<div>
|
||||||
|
<label class="text-sm text-neutral-200">Use Server Rewards</label>
|
||||||
|
<p class="text-xs text-neutral-500">Charge players via ServerRewards plugin</p>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
@click="setConfigValue('Settings.UseServerRewards', !getConfigValue('Settings.UseServerRewards', false))"
|
||||||
|
class="relative w-11 h-6 rounded-full transition-colors"
|
||||||
|
:class="getConfigValue('Settings.UseServerRewards', false) ? 'bg-oxide-500' : 'bg-neutral-700'"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full transition-transform"
|
||||||
|
:class="getConfigValue('Settings.UseServerRewards', false) ? 'translate-x-5' : 'translate-x-0'"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- CheckBoundaries -->
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<div>
|
||||||
|
<label class="text-sm text-neutral-200">Cave/Water boundary checks</label>
|
||||||
|
<p class="text-xs text-neutral-500">Prevent teleporting into caves or underwater</p>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
@click="setConfigValue('Settings.CheckBoundaries', !getConfigValue('Settings.CheckBoundaries', false))"
|
||||||
|
class="relative w-11 h-6 rounded-full transition-colors"
|
||||||
|
:class="getConfigValue('Settings.CheckBoundaries', false) ? 'bg-oxide-500' : 'bg-neutral-700'"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full transition-transform"
|
||||||
|
:class="getConfigValue('Settings.CheckBoundaries', false) ? 'translate-x-5' : 'translate-x-0'"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- InterruptTPOnHostile -->
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<div>
|
||||||
|
<label class="text-sm text-neutral-200">Cancel TP if hostile timer</label>
|
||||||
|
<p class="text-xs text-neutral-500">Cancel pending teleport if player becomes hostile</p>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
@click="setConfigValue('Settings.InterruptTPOnHostile', !getConfigValue('Settings.InterruptTPOnHostile', false))"
|
||||||
|
class="relative w-11 h-6 rounded-full transition-colors"
|
||||||
|
:class="getConfigValue('Settings.InterruptTPOnHostile', false) ? 'bg-oxide-500' : 'bg-neutral-700'"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full transition-transform"
|
||||||
|
:class="getConfigValue('Settings.InterruptTPOnHostile', false) ? 'translate-x-5' : 'translate-x-0'"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- WipeHomesOnUpgrade -->
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<div>
|
||||||
|
<label class="text-sm text-neutral-200">Wipe homes on map update</label>
|
||||||
|
<p class="text-xs text-neutral-500">Clear all home locations when the map changes</p>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
@click="setConfigValue('Settings.WipeHomesOnUpgrade', !getConfigValue('Settings.WipeHomesOnUpgrade', false))"
|
||||||
|
class="relative w-11 h-6 rounded-full transition-colors"
|
||||||
|
:class="getConfigValue('Settings.WipeHomesOnUpgrade', false) ? 'bg-oxide-500' : 'bg-neutral-700'"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full transition-transform"
|
||||||
|
:class="getConfigValue('Settings.WipeHomesOnUpgrade', false) ? 'translate-x-5' : 'translate-x-0'"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- PlayersOnlyCannotTeleport -->
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<div>
|
||||||
|
<label class="text-sm text-neutral-200">Players Only Cannot Teleport</label>
|
||||||
|
<p class="text-xs text-neutral-500">Restrict teleport to specific player groups only</p>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
@click="setConfigValue('Settings.PlayersOnlyCannotTeleport', !getConfigValue('Settings.PlayersOnlyCannotTeleport', false))"
|
||||||
|
class="relative w-11 h-6 rounded-full transition-colors"
|
||||||
|
:class="getConfigValue('Settings.PlayersOnlyCannotTeleport', false) ? 'bg-oxide-500' : 'bg-neutral-700'"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full transition-transform"
|
||||||
|
:class="getConfigValue('Settings.PlayersOnlyCannotTeleport', false) ? 'translate-x-5' : 'translate-x-0'"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Global Cooldown (number) -->
|
||||||
|
<div class="max-w-sm">
|
||||||
|
<label class="block text-sm text-neutral-200 mb-1">Global cooldown (seconds)</label>
|
||||||
|
<p class="text-xs text-neutral-500 mb-2">Minimum time between any teleport commands</p>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
:value="getConfigValue('Settings.GlobalTeleportCooldown', 0)"
|
||||||
|
@input="setConfigValue('Settings.GlobalTeleportCooldown', Number(($event.target as HTMLInputElement).value))"
|
||||||
|
min="0"
|
||||||
|
class="w-full bg-neutral-800 border border-neutral-700 rounded-lg px-3 py-2 text-neutral-200 text-sm"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Homes Tab -->
|
||||||
|
<div v-else-if="activeTab === 'homes'" class="bg-neutral-900 border border-neutral-800 rounded-xl p-6 space-y-6">
|
||||||
|
<h3 class="text-sm font-semibold text-neutral-300 uppercase tracking-wider">Home Teleport Settings</h3>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||||
|
<!-- UsableOutOfBuildingBlocked -->
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<div>
|
||||||
|
<label class="text-sm text-neutral-200">Can use outside building privilege</label>
|
||||||
|
<p class="text-xs text-neutral-500">Allow home teleport even without building privilege</p>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
@click="setConfigValue('Home.UsableOutOfBuildingBlocked', !getConfigValue('Home.UsableOutOfBuildingBlocked', false))"
|
||||||
|
class="relative w-11 h-6 rounded-full transition-colors"
|
||||||
|
:class="getConfigValue('Home.UsableOutOfBuildingBlocked', false) ? 'bg-oxide-500' : 'bg-neutral-700'"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full transition-transform"
|
||||||
|
:class="getConfigValue('Home.UsableOutOfBuildingBlocked', false) ? 'translate-x-5' : 'translate-x-0'"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ForceOnTopOfFoundation -->
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<div>
|
||||||
|
<label class="text-sm text-neutral-200">Force home on foundation</label>
|
||||||
|
<p class="text-xs text-neutral-500">Homes can only be set on a foundation block</p>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
@click="setConfigValue('Home.ForceOnTopOfFoundation', !getConfigValue('Home.ForceOnTopOfFoundation', false))"
|
||||||
|
class="relative w-11 h-6 rounded-full transition-colors"
|
||||||
|
:class="getConfigValue('Home.ForceOnTopOfFoundation', false) ? 'bg-oxide-500' : 'bg-neutral-700'"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full transition-transform"
|
||||||
|
:class="getConfigValue('Home.ForceOnTopOfFoundation', false) ? 'translate-x-5' : 'translate-x-0'"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- CheckFoundationForOwner -->
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<div>
|
||||||
|
<label class="text-sm text-neutral-200">Verify foundation ownership</label>
|
||||||
|
<p class="text-xs text-neutral-500">Only allow homes on foundations the player owns</p>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
@click="setConfigValue('Home.CheckFoundationForOwner', !getConfigValue('Home.CheckFoundationForOwner', false))"
|
||||||
|
class="relative w-11 h-6 rounded-full transition-colors"
|
||||||
|
:class="getConfigValue('Home.CheckFoundationForOwner', false) ? 'bg-oxide-500' : 'bg-neutral-700'"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full transition-transform"
|
||||||
|
:class="getConfigValue('Home.CheckFoundationForOwner', false) ? 'translate-x-5' : 'translate-x-0'"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- AllowAboveFoundation -->
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<div>
|
||||||
|
<label class="text-sm text-neutral-200">Allow Above Foundation</label>
|
||||||
|
<p class="text-xs text-neutral-500">Allow setting homes above foundation level</p>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
@click="setConfigValue('Home.AllowAboveFoundation', !getConfigValue('Home.AllowAboveFoundation', false))"
|
||||||
|
class="relative w-11 h-6 rounded-full transition-colors"
|
||||||
|
:class="getConfigValue('Home.AllowAboveFoundation', false) ? 'bg-oxide-500' : 'bg-neutral-700'"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full transition-transform"
|
||||||
|
:class="getConfigValue('Home.AllowAboveFoundation', false) ? 'translate-x-5' : 'translate-x-0'"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- CupOwnerAllowOnBuildingBlocked -->
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<div>
|
||||||
|
<label class="text-sm text-neutral-200">Cupboard Owner Allow on Building Blocked</label>
|
||||||
|
<p class="text-xs text-neutral-500">Allow TC owners to teleport even when building blocked</p>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
@click="setConfigValue('Home.CupOwnerAllowOnBuildingBlocked', !getConfigValue('Home.CupOwnerAllowOnBuildingBlocked', false))"
|
||||||
|
class="relative w-11 h-6 rounded-full transition-colors"
|
||||||
|
:class="getConfigValue('Home.CupOwnerAllowOnBuildingBlocked', false) ? 'bg-oxide-500' : 'bg-neutral-700'"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full transition-transform"
|
||||||
|
:class="getConfigValue('Home.CupOwnerAllowOnBuildingBlocked', false) ? 'translate-x-5' : 'translate-x-0'"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Number Inputs -->
|
||||||
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm text-neutral-200 mb-1">Homes Limit</label>
|
||||||
|
<p class="text-xs text-neutral-500 mb-2">Default max homes per player</p>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
:value="getConfigValue('Home.HomesLimit', 3)"
|
||||||
|
@input="setConfigValue('Home.HomesLimit', Number(($event.target as HTMLInputElement).value))"
|
||||||
|
min="0"
|
||||||
|
class="w-full bg-neutral-800 border border-neutral-700 rounded-lg px-3 py-2 text-neutral-200 text-sm"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm text-neutral-200 mb-1">Daily Limit</label>
|
||||||
|
<p class="text-xs text-neutral-500 mb-2">Max home teleports per day</p>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
:value="getConfigValue('Home.DefaultDailyLimit', 5)"
|
||||||
|
@input="setConfigValue('Home.DefaultDailyLimit', Number(($event.target as HTMLInputElement).value))"
|
||||||
|
min="0"
|
||||||
|
class="w-full bg-neutral-800 border border-neutral-700 rounded-lg px-3 py-2 text-neutral-200 text-sm"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm text-neutral-200 mb-1">Cooldown (seconds)</label>
|
||||||
|
<p class="text-xs text-neutral-500 mb-2">Time between home teleports</p>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
:value="getConfigValue('Home.DefaultCooldown', 600)"
|
||||||
|
@input="setConfigValue('Home.DefaultCooldown', Number(($event.target as HTMLInputElement).value))"
|
||||||
|
min="0"
|
||||||
|
class="w-full bg-neutral-800 border border-neutral-700 rounded-lg px-3 py-2 text-neutral-200 text-sm"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm text-neutral-200 mb-1">Countdown (seconds)</label>
|
||||||
|
<p class="text-xs text-neutral-500 mb-2">Countdown before teleport</p>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
:value="getConfigValue('Home.DefaultCountdown', 5)"
|
||||||
|
@input="setConfigValue('Home.DefaultCountdown', Number(($event.target as HTMLInputElement).value))"
|
||||||
|
min="0"
|
||||||
|
class="w-full bg-neutral-800 border border-neutral-700 rounded-lg px-3 py-2 text-neutral-200 text-sm"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- TPR Tab -->
|
||||||
|
<div v-else-if="activeTab === 'tpr'" class="bg-neutral-900 border border-neutral-800 rounded-xl p-6 space-y-6">
|
||||||
|
<h3 class="text-sm font-semibold text-neutral-300 uppercase tracking-wider">Teleport Request Settings</h3>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||||
|
<!-- BlockTPAOnCeiling -->
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<div>
|
||||||
|
<label class="text-sm text-neutral-200">Block TP accept on ceiling</label>
|
||||||
|
<p class="text-xs text-neutral-500">Prevent accepting a TP while on a ceiling tile</p>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
@click="setConfigValue('TPR.BlockTPAOnCeiling', !getConfigValue('TPR.BlockTPAOnCeiling', false))"
|
||||||
|
class="relative w-11 h-6 rounded-full transition-colors"
|
||||||
|
:class="getConfigValue('TPR.BlockTPAOnCeiling', false) ? 'bg-oxide-500' : 'bg-neutral-700'"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full transition-transform"
|
||||||
|
:class="getConfigValue('TPR.BlockTPAOnCeiling', false) ? 'translate-x-5' : 'translate-x-0'"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- OffsetTPRTarget -->
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<div>
|
||||||
|
<label class="text-sm text-neutral-200">Offset teleport target position</label>
|
||||||
|
<p class="text-xs text-neutral-500">Slightly offset the teleport landing position</p>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
@click="setConfigValue('TPR.OffsetTPRTarget', !getConfigValue('TPR.OffsetTPRTarget', false))"
|
||||||
|
class="relative w-11 h-6 rounded-full transition-colors"
|
||||||
|
:class="getConfigValue('TPR.OffsetTPRTarget', false) ? 'bg-oxide-500' : 'bg-neutral-700'"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full transition-transform"
|
||||||
|
:class="getConfigValue('TPR.OffsetTPRTarget', false) ? 'translate-x-5' : 'translate-x-0'"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- AutoAcceptEnabled -->
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<div>
|
||||||
|
<label class="text-sm text-neutral-200">Auto Accept Enabled</label>
|
||||||
|
<p class="text-xs text-neutral-500">Automatically accept incoming TP requests</p>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
@click="setConfigValue('TPR.AutoAcceptEnabled', !getConfigValue('TPR.AutoAcceptEnabled', false))"
|
||||||
|
class="relative w-11 h-6 rounded-full transition-colors"
|
||||||
|
:class="getConfigValue('TPR.AutoAcceptEnabled', false) ? 'bg-oxide-500' : 'bg-neutral-700'"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full transition-transform"
|
||||||
|
:class="getConfigValue('TPR.AutoAcceptEnabled', false) ? 'translate-x-5' : 'translate-x-0'"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Number Inputs -->
|
||||||
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm text-neutral-200 mb-1">Cooldown (seconds)</label>
|
||||||
|
<p class="text-xs text-neutral-500 mb-2">Cooldown between TPR requests</p>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
:value="getConfigValue('TPR.Cooldown', 600)"
|
||||||
|
@input="setConfigValue('TPR.Cooldown', Number(($event.target as HTMLInputElement).value))"
|
||||||
|
min="0"
|
||||||
|
class="w-full bg-neutral-800 border border-neutral-700 rounded-lg px-3 py-2 text-neutral-200 text-sm"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm text-neutral-200 mb-1">Countdown (seconds)</label>
|
||||||
|
<p class="text-xs text-neutral-500 mb-2">Countdown before teleport</p>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
:value="getConfigValue('TPR.Countdown', 5)"
|
||||||
|
@input="setConfigValue('TPR.Countdown', Number(($event.target as HTMLInputElement).value))"
|
||||||
|
min="0"
|
||||||
|
class="w-full bg-neutral-800 border border-neutral-700 rounded-lg px-3 py-2 text-neutral-200 text-sm"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm text-neutral-200 mb-1">Daily Limit</label>
|
||||||
|
<p class="text-xs text-neutral-500 mb-2">Max TPR per day</p>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
:value="getConfigValue('TPR.DailyLimit', 5)"
|
||||||
|
@input="setConfigValue('TPR.DailyLimit', Number(($event.target as HTMLInputElement).value))"
|
||||||
|
min="0"
|
||||||
|
class="w-full bg-neutral-800 border border-neutral-700 rounded-lg px-3 py-2 text-neutral-200 text-sm"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm text-neutral-200 mb-1">Request Duration (seconds)</label>
|
||||||
|
<p class="text-xs text-neutral-500 mb-2">How long a TPR request lasts</p>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
:value="getConfigValue('TPR.RequestDuration', 30)"
|
||||||
|
@input="setConfigValue('TPR.RequestDuration', Number(($event.target as HTMLInputElement).value))"
|
||||||
|
min="0"
|
||||||
|
class="w-full bg-neutral-800 border border-neutral-700 rounded-lg px-3 py-2 text-neutral-200 text-sm"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- VIP Groups Tab -->
|
||||||
|
<div v-else-if="activeTab === 'vip'" class="bg-neutral-900 border border-neutral-800 rounded-xl p-6">
|
||||||
|
<PermissionGroupEditor
|
||||||
|
:config-data="store.currentConfig.config_data"
|
||||||
|
@update:config-data="handlePermissionGroupUpdate"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Create Config Modal -->
|
||||||
|
<div v-if="showCreateModal" class="fixed inset-0 bg-black/60 z-50 flex items-center justify-center p-4" @click.self="showCreateModal = false">
|
||||||
|
<div class="bg-neutral-900 border border-neutral-800 rounded-xl p-6 w-full max-w-md">
|
||||||
|
<h2 class="text-lg font-semibold text-neutral-100 mb-4">New Teleport Config</h2>
|
||||||
|
<div class="space-y-4">
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm text-neutral-400 mb-1">Config Name</label>
|
||||||
|
<input
|
||||||
|
v-model="newConfigName"
|
||||||
|
placeholder="e.g. Default TP Settings"
|
||||||
|
class="w-full bg-neutral-800 border border-neutral-700 rounded-lg px-3 py-2 text-neutral-200 text-sm"
|
||||||
|
@keydown.enter="handleCreateConfig"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm text-neutral-400 mb-1">Description (optional)</label>
|
||||||
|
<textarea
|
||||||
|
v-model="newConfigDesc"
|
||||||
|
rows="2"
|
||||||
|
placeholder="What is this config for?"
|
||||||
|
class="w-full bg-neutral-800 border border-neutral-700 rounded-lg px-3 py-2 text-neutral-200 text-sm resize-none"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="flex justify-end gap-2">
|
||||||
|
<button @click="showCreateModal = false" class="px-4 py-2 text-sm text-neutral-400 hover:text-neutral-200">Cancel</button>
|
||||||
|
<button
|
||||||
|
@click="handleCreateConfig"
|
||||||
|
:disabled="!newConfigName.trim()"
|
||||||
|
class="px-4 py-2 bg-oxide-500 text-white rounded-lg hover:bg-oxide-600 disabled:opacity-50 text-sm"
|
||||||
|
>
|
||||||
|
Create
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Import from Server Modal -->
|
||||||
|
<div v-if="showImportModal" class="fixed inset-0 bg-black/60 z-50 flex items-center justify-center p-4" @click.self="showImportModal = false">
|
||||||
|
<div class="bg-neutral-900 border border-neutral-800 rounded-xl p-6 w-full max-w-md">
|
||||||
|
<h2 class="text-lg font-semibold text-neutral-100 mb-4">Import from Server</h2>
|
||||||
|
<p class="text-sm text-neutral-400 mb-4">
|
||||||
|
Import the current NTeleportation config from your live server. This will create a new config profile.
|
||||||
|
</p>
|
||||||
|
<div class="space-y-4">
|
||||||
|
<div>
|
||||||
|
<label class="block text-sm text-neutral-400 mb-1">Config Name</label>
|
||||||
|
<input
|
||||||
|
v-model="importConfigName"
|
||||||
|
placeholder="e.g. Imported Server Config"
|
||||||
|
class="w-full bg-neutral-800 border border-neutral-700 rounded-lg px-3 py-2 text-neutral-200 text-sm"
|
||||||
|
@keydown.enter="handleImport"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="flex justify-end gap-2">
|
||||||
|
<button @click="showImportModal = false" class="px-4 py-2 text-sm text-neutral-400 hover:text-neutral-200">Cancel</button>
|
||||||
|
<button
|
||||||
|
@click="handleImport"
|
||||||
|
:disabled="!importConfigName.trim()"
|
||||||
|
class="px-4 py-2 bg-oxide-500 text-white rounded-lg hover:bg-oxide-600 disabled:opacity-50 text-sm"
|
||||||
|
>
|
||||||
|
Import
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
Reference in New Issue
Block a user