Compare commits

..

4 commits

25 changed files with 2840 additions and 3425 deletions

35
.zed/settings.json Normal file
View file

@ -0,0 +1,35 @@
// Folder-specific settings
//
// For a full list of overridable settings, and general information on folder-specific settings,
// see the documentation: https://zed.dev/docs/configuring-zed#folder-specific-settings
{
"prettier": {
"allowed": false
},
"languages": {
"JavaScript": {
"formatter": {
"code_actions": {
"source.fixAll.eslint": true
}
},
"tab_size": 2
},
"TypeScript": {
"formatter": {
"code_actions": {
"source.fixAll.eslint": true
}
},
"tab_size": 2
},
"Vue.js": {
"formatter": {
"code_actions": {
"source.fixAll.eslint": true
}
},
"tab_size": 2
}
}
}

View file

@ -13,11 +13,13 @@ export default [
},
},
plugins: { vueParser },
files: ['src/**/*.js', 'src/**/*.ts', 'src/**/*.vue'],
rules: {
'semi': [
'error',
'always',
],
'object-curly-spacing': ['warn', 'always'],
'comma-dangle': [
'error',
'always-multiline',

5549
client/pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
<script setup lang="ts">
import { apiCall } from "../../api";
import getPlugins from "../../plugins";
import { apiCall } from '../../api';
import getPlugins from '../../plugins';
const p = getPlugins();
let peers = $ref({});
@ -8,11 +8,11 @@ let loading = $ref(false);
let selection = $ref([] as number[]);
const columns = [
{ heading: "Name", path: "name" },
{ heading: "Allowed IPs", path: "allowed_ips" },
{ heading: "Endpoint", path: "endpoint" },
{ heading: "Persistent Keepalive", path: "persistent_keepalive" },
{ heading: "Comment", path: "comment" },
{ heading: 'Name', path: 'name' },
{ heading: 'Allowed IPs', path: 'allowed_ips' },
{ heading: 'Endpoint', path: 'endpoint' },
{ heading: 'Persistent Keepalive', path: 'persistent_keepalive' },
{ heading: 'Comment', path: 'comment' },
];
const displayData = $computed(() => {
@ -32,24 +32,24 @@ const displayData = $computed(() => {
async function load() {
loading = true;
let res = await apiCall("vpn.wireguard.peers.list", {});
let res = await apiCall('vpn.wireguard.peers.list', {});
if (res.Error === null) {
console.debug("peers", res.Data);
console.debug('peers', res.Data);
peers = res.Data;
} else {
console.debug("error", res);
console.debug('error', res);
}
loading = false;
}
async function deletePeer() {
let res = await apiCall("vpn.wireguard.peers.delete", {
let res = await apiCall('vpn.wireguard.peers.delete', {
name: displayData[selection[0]].name,
});
if (res.Error === null) {
console.debug("deleted peer");
console.debug('deleted peer');
} else {
console.debug("error", res);
console.debug('error', res);
}
load();
}
@ -76,7 +76,9 @@ onMounted(async () => {
>
<button @click="load">Refresh</button>
<router-link class="button" to="/vpn/wireguard.peers/edit"
>Create</router-link
>
Create
</router-link
>
<button :disabled="selection.length != 1" @click="editPeer">
Edit

View file

@ -15,5 +15,10 @@ export function isNullish(value: any) {
return (value === null || value === undefined);
}
export function variantOf(enumValue: any) {
if (typeof enumValue === 'string') return enumValue;
else return Object.entries(enumValue)[0][0];
}
export type Index = string | number | symbol;
export type MaybeIndex = Index | null;