Files
Nukumizu/frontend/src/api/index.js
T
NanamiAdmin 6046fb5f88
Build / ubuntu-latest (push) Canceled after 1m0s
Build / windows-latest (push) Canceled after 1m7s
feat(frontend): enhance webhook functionality and UI
- Updated incoming webhook API endpoint to use `/api/webhook/post/<name>` for better namespace management.
- Added a new WebHooks page in the admin UI for managing webhook endpoints.
- Introduced a ConfigSection component to streamline the rendering and saving of configuration fields.
- Enhanced Settings.vue to reference the new WebHooks page and updated the configuration structure.
- Implemented a new webhook API in the frontend to handle listing, adding, modifying, and removing webhook endpoints.
- Improved the sidebar to include a link to the WebHooks page.
- Added functionality to generate tokens for new webhook endpoints and manage notification channels.
2026-09-24 15:02:52 +08:00

35 lines
1.6 KiB
JavaScript

import http from '../utils/http.js';
export const authApi = {
login: (username, password) => http.post('/user/login', { username, password }),
register: (username, password) => http.post('/user/register', { username, password })
};
// /api/server/getStatus?uuid=all → { success, message, data: { "<uuid>": { uuid, name, online, report } } }
export const serverApi = {
statusAll: () => http.get('/server/getStatus?uuid=all'),
infoAll: () => http.get('/server/getInfo?uuid=all')
};
// /api/settings/get?type=… / /api/settings/set?type=…
// get → { success, message, data: { config } }.
// `type` is one of global | bot_user_config | bot_node_config.
// For set, pass a partial object; a JSON null value removes that key.
export const settingsApi = {
get: (type) => http.get(`/settings/get?type=${encodeURIComponent(type)}`),
set: (type, patch) => http.post(`/settings/set?type=${encodeURIComponent(type)}`, patch)
};
// Incoming webhook endpoints (admin). They live in the `webhook.endpoints`
// section of config.json, but are managed here rather than through the settings
// API because they are a keyed collection: add/modify take one endpoint object
// and change only the fields they carry, and a new endpoint is rejected with
// 409 when its name is taken.
// list → { success, message, data: { endpoints: { "<name>": { enabled, token, notifyPipes } } } }.
export const webhookApi = {
list: () => http.get('/webhook/list'),
add: (endpoint) => http.post('/webhook/add', endpoint),
modify: (endpoint) => http.post('/webhook/modify', endpoint),
remove: (name) => http.post('/webhook/delete', { name })
};