Updates api path to /api
This commit is contained in:
@@ -59,7 +59,7 @@
|
||||
|
||||
async function postGithubDownload(url: string) {
|
||||
try {
|
||||
const apiResponse = await fetch('/rest/downloadUpdate', {
|
||||
const apiResponse = await fetch('/api/downloadUpdate', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic',
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
|
||||
async function validateUser(userdata: userProfile) {
|
||||
try {
|
||||
const response = await fetch('/rest/verifyAuthorization', {
|
||||
const response = await fetch('/api/verifyAuthorization', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: 'Bearer ' + userdata.bearer_token,
|
||||
|
||||
@@ -28,7 +28,7 @@ const loadModelFiles = async () => {
|
||||
export const load = async ({ fetch }) => {
|
||||
await registerFetchIntercept();
|
||||
await loadModelFiles();
|
||||
const result = await fetch('/rest/features');
|
||||
const result = await fetch('/api/features');
|
||||
const features = await result.json();
|
||||
return {
|
||||
features,
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
async function getMQTTStatus() {
|
||||
try {
|
||||
const response = await fetch('/rest/mqttStatus', {
|
||||
const response = await fetch('/api/mqttStatus', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic',
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
async function getMQTTSettings() {
|
||||
try {
|
||||
const response = await fetch('/rest/mqttSettings', {
|
||||
const response = await fetch('/api/mqttSettings', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic',
|
||||
@@ -87,7 +87,7 @@
|
||||
|
||||
async function postMQTTSettings(data: MQTTSettings) {
|
||||
try {
|
||||
const response = await fetch('/rest/mqttSettings', {
|
||||
const response = await fetch('/api/mqttSettings', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic',
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
async function getBrokerSettings() {
|
||||
try {
|
||||
const response = await fetch('/rest/brokerSettings', {
|
||||
const response = await fetch('/api/brokerSettings', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic',
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
async function postBrokerSettings() {
|
||||
try {
|
||||
const response = await fetch('/rest/brokerSettings', {
|
||||
const response = await fetch('/api/brokerSettings', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic',
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
async function getNTPStatus() {
|
||||
try {
|
||||
const response = await fetch('/rest/ntpStatus', {
|
||||
const response = await fetch('/api/ntpStatus', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic',
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
async function getNTPSettings() {
|
||||
try {
|
||||
const response = await fetch('/rest/ntpSettings', {
|
||||
const response = await fetch('/api/ntpSettings', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic',
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
async function postNTPSettings(data: NTPSettings) {
|
||||
try {
|
||||
const response = await fetch('/rest/ntpSettings', {
|
||||
const response = await fetch('/api/ntpSettings', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic',
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
async function signInUser(data: SignInData) {
|
||||
try {
|
||||
const response = await fetch('/rest/signIn', {
|
||||
const response = await fetch('/api/signIn', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
import MdiMoonAndStars from '~icons/mdi/moon-and-stars';
|
||||
|
||||
async function postSleep() {
|
||||
const response = await fetch('/rest/sleep', {
|
||||
const response = await fetch('/api/sleep', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic'
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
async function getSystemStatus() {
|
||||
try {
|
||||
const response = await fetch('/rest/systemStatus', {
|
||||
const response = await fetch('/api/systemStatus', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic',
|
||||
@@ -53,7 +53,7 @@
|
||||
(systemInformation = { ...systemInformation, ...data });
|
||||
|
||||
async function postRestart() {
|
||||
const response = await fetch('/rest/restart', {
|
||||
const response = await fetch('/api/restart', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic'
|
||||
@@ -77,7 +77,7 @@
|
||||
}
|
||||
|
||||
async function postFactoryReset() {
|
||||
const response = await fetch('/rest/factoryReset', {
|
||||
const response = await fetch('/api/factoryReset', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic'
|
||||
@@ -101,7 +101,7 @@
|
||||
}
|
||||
|
||||
async function postSleep() {
|
||||
const response = await fetch('/rest/sleep', {
|
||||
const response = await fetch('/api/sleep', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic'
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
async function postGithubDownload(url: string) {
|
||||
try {
|
||||
const apiResponse = await fetch('/rest/downloadUpdate', {
|
||||
const apiResponse = await fetch('/api/downloadUpdate', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic',
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
try {
|
||||
const formData = new FormData();
|
||||
formData.append('file', files[0]);
|
||||
const response = await fetch('/rest/uploadFirmware', {
|
||||
const response = await fetch('/api/uploadFirmware', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic'
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
async function getSecuritySettings() {
|
||||
try {
|
||||
const response = await fetch('/rest/securitySettings', {
|
||||
const response = await fetch('/api/securitySettings', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic',
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
async function postSecuritySettings(data: SecuritySettings) {
|
||||
try {
|
||||
const response = await fetch('/rest/securitySettings', {
|
||||
const response = await fetch('/api/securitySettings', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic',
|
||||
@@ -81,7 +81,7 @@
|
||||
|
||||
async function validateUser(userdata: userProfile) {
|
||||
try {
|
||||
const response = await fetch('/rest/verifyAuthorization', {
|
||||
const response = await fetch('/api/verifyAuthorization', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: 'Bearer ' + userdata.bearer_token,
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
async function getAPStatus() {
|
||||
try {
|
||||
const response = await fetch('/rest/apStatus', {
|
||||
const response = await fetch('/api/apStatus', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic',
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
async function getAPSettings() {
|
||||
try {
|
||||
const response = await fetch('/rest/apSettings', {
|
||||
const response = await fetch('/api/apSettings', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic',
|
||||
@@ -96,7 +96,7 @@
|
||||
|
||||
async function postAPSettings(data: ApSettings) {
|
||||
try {
|
||||
const response = await fetch('/rest/apSettings', {
|
||||
const response = await fetch('/api/apSettings', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic',
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
async function scanNetworks() {
|
||||
scanActive = true;
|
||||
const scan = await fetch('/rest/scanNetworks', {
|
||||
const scan = await fetch('/api/scanNetworks', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic',
|
||||
@@ -50,7 +50,7 @@
|
||||
}
|
||||
|
||||
async function pollingResults() {
|
||||
const response = await fetch('/rest/listNetworks', {
|
||||
const response = await fetch('/api/listNetworks', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic',
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
async function getWifiStatus() {
|
||||
try {
|
||||
const response = await fetch('/rest/wifiStatus', {
|
||||
const response = await fetch('/api/wifiStatus', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic',
|
||||
@@ -87,7 +87,7 @@
|
||||
|
||||
async function getWifiSettings() {
|
||||
try {
|
||||
const response = await fetch('/rest/wifiSettings', {
|
||||
const response = await fetch('/api/wifiSettings', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic',
|
||||
@@ -113,7 +113,7 @@
|
||||
|
||||
async function postWiFiSettings(data: WifiSettings) {
|
||||
try {
|
||||
const response = await fetch('/rest/wifiSettings', {
|
||||
const response = await fetch('/api/wifiSettings', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: $page.data.features.security ? 'Bearer ' + $user.bearer_token : 'Basic',
|
||||
|
||||
+3
-2
@@ -16,9 +16,10 @@ export default defineConfig({
|
||||
},
|
||||
server: {
|
||||
proxy: {
|
||||
'/rest': {
|
||||
'/api': {
|
||||
target: 'http://192.168.0.172',
|
||||
changeOrigin: true
|
||||
changeOrigin: true,
|
||||
ws: true
|
||||
},
|
||||
'/ws': {
|
||||
target: 'ws://192.168.0.172',
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
#endif
|
||||
|
||||
#define AP_SETTINGS_FILE "/config/apSettings.json"
|
||||
#define AP_SETTINGS_SERVICE_PATH "/rest/apSettings"
|
||||
#define AP_SETTINGS_SERVICE_PATH "/api/apSettings"
|
||||
|
||||
#define AP_MODE_ALWAYS 0
|
||||
#define AP_MODE_DISCONNECTED 1
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <APSettingsService.h>
|
||||
|
||||
#define MAX_AP_STATUS_SIZE 1024
|
||||
#define AP_STATUS_SERVICE_PATH "/rest/apStatus"
|
||||
#define AP_STATUS_SERVICE_PATH "/api/apStatus"
|
||||
|
||||
class APStatus
|
||||
{
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
#include <PsychicHttp.h>
|
||||
#include <SecurityManager.h>
|
||||
|
||||
#define VERIFY_AUTHORIZATION_PATH "/rest/verifyAuthorization"
|
||||
#define SIGN_IN_PATH "/rest/signIn"
|
||||
#define VERIFY_AUTHORIZATION_PATH "/api/verifyAuthorization"
|
||||
#define SIGN_IN_PATH "/api/signIn"
|
||||
|
||||
#define MAX_AUTHENTICATION_SIZE 256
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <HTTPUpdate.h>
|
||||
// #include <SSLCertBundle.h>
|
||||
|
||||
#define GITHUB_FIRMWARE_PATH "/rest/downloadUpdate"
|
||||
#define GITHUB_FIRMWARE_PATH "/api/downloadUpdate"
|
||||
#define EVENT_DOWNLOAD_OTA "otastatus"
|
||||
#define OTA_TASK_STACK_SIZE 9216
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <FS.h>
|
||||
|
||||
#define FS_CONFIG_DIRECTORY "/config"
|
||||
#define FACTORY_RESET_SERVICE_PATH "/rest/factoryReset"
|
||||
#define FACTORY_RESET_SERVICE_PATH "/api/factoryReset"
|
||||
|
||||
class FactoryResetService
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <vector>
|
||||
|
||||
#define MAX_FEATURES_SIZE 256
|
||||
#define FEATURES_SERVICE_PATH "/rest/features"
|
||||
#define FEATURES_SERVICE_PATH "/api/features"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
#endif
|
||||
|
||||
#define MQTT_SETTINGS_FILE "/config/mqttSettings.json"
|
||||
#define MQTT_SETTINGS_SERVICE_PATH "/rest/mqttSettings"
|
||||
#define MQTT_SETTINGS_SERVICE_PATH "/api/mqttSettings"
|
||||
|
||||
#define MQTT_RECONNECTION_DELAY 5000
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <SecurityManager.h>
|
||||
|
||||
#define MAX_MQTT_STATUS_SIZE 1024
|
||||
#define MQTT_STATUS_SERVICE_PATH "/rest/mqttStatus"
|
||||
#define MQTT_STATUS_SERVICE_PATH "/api/mqttStatus"
|
||||
|
||||
class MqttStatus
|
||||
{
|
||||
|
||||
@@ -39,10 +39,10 @@
|
||||
#endif
|
||||
|
||||
#define NTP_SETTINGS_FILE "/config/ntpSettings.json"
|
||||
#define NTP_SETTINGS_SERVICE_PATH "/rest/ntpSettings"
|
||||
#define NTP_SETTINGS_SERVICE_PATH "/api/ntpSettings"
|
||||
|
||||
#define MAX_TIME_SIZE 256
|
||||
#define TIME_PATH "/rest/time"
|
||||
#define TIME_PATH "/api/time"
|
||||
|
||||
class NTPSettings
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <SecurityManager.h>
|
||||
|
||||
#define MAX_NTP_STATUS_SIZE 1024
|
||||
#define NTP_STATUS_SERVICE_PATH "/rest/ntpStatus"
|
||||
#define NTP_STATUS_SERVICE_PATH "/api/ntpStatus"
|
||||
|
||||
class NTPStatus
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <PsychicHttp.h>
|
||||
#include <SecurityManager.h>
|
||||
|
||||
#define RESTART_SERVICE_PATH "/rest/restart"
|
||||
#define RESTART_SERVICE_PATH "/api/restart"
|
||||
|
||||
class RestartService
|
||||
{
|
||||
|
||||
@@ -42,10 +42,10 @@
|
||||
#endif
|
||||
|
||||
#define SECURITY_SETTINGS_FILE "/config/securitySettings.json"
|
||||
#define SECURITY_SETTINGS_PATH "/rest/securitySettings"
|
||||
#define SECURITY_SETTINGS_PATH "/api/securitySettings"
|
||||
|
||||
#define GENERATE_TOKEN_SIZE 512
|
||||
#define GENERATE_TOKEN_PATH "/rest/generateToken"
|
||||
#define GENERATE_TOKEN_PATH "/api/generateToken"
|
||||
|
||||
#if FT_ENABLED(FT_SECURITY)
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <PsychicHttp.h>
|
||||
#include <SecurityManager.h>
|
||||
|
||||
#define SLEEP_SERVICE_PATH "/rest/sleep"
|
||||
#define SLEEP_SERVICE_PATH "/api/sleep"
|
||||
|
||||
#ifndef WAKEUP_PIN_NUMBER
|
||||
#define WAKEUP_PIN_NUMBER 0
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <ESPFS.h>
|
||||
|
||||
#define MAX_ESP_STATUS_SIZE 1024
|
||||
#define SYSTEM_STATUS_SERVICE_PATH "/rest/systemStatus"
|
||||
#define SYSTEM_STATUS_SERVICE_PATH "/api/systemStatus"
|
||||
|
||||
class SystemStatus
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <SecurityManager.h>
|
||||
#include <RestartService.h>
|
||||
|
||||
#define UPLOAD_FIRMWARE_PATH "/rest/uploadFirmware"
|
||||
#define UPLOAD_FIRMWARE_PATH "/api/uploadFirmware"
|
||||
|
||||
enum FileType
|
||||
{
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#include <PsychicHttp.h>
|
||||
#include <SecurityManager.h>
|
||||
|
||||
#define SCAN_NETWORKS_SERVICE_PATH "/rest/scanNetworks"
|
||||
#define LIST_NETWORKS_SERVICE_PATH "/rest/listNetworks"
|
||||
#define SCAN_NETWORKS_SERVICE_PATH "/api/scanNetworks"
|
||||
#define LIST_NETWORKS_SERVICE_PATH "/api/listNetworks"
|
||||
|
||||
#define MAX_WIFI_SCANNER_SIZE 1024
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
#endif
|
||||
|
||||
#define WIFI_SETTINGS_FILE "/config/wifiSettings.json"
|
||||
#define WIFI_SETTINGS_SERVICE_PATH "/rest/wifiSettings"
|
||||
#define WIFI_SETTINGS_SERVICE_PATH "/api/wifiSettings"
|
||||
|
||||
#define WIFI_RECONNECTION_DELAY 1000 * 30
|
||||
#define RSSI_EVENT_DELAY 200
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <SecurityManager.h>
|
||||
|
||||
#define MAX_WIFI_STATUS_SIZE 1024
|
||||
#define WIFI_STATUS_SERVICE_PATH "/rest/wifiStatus"
|
||||
#define WIFI_STATUS_SERVICE_PATH "/api/wifiStatus"
|
||||
|
||||
class WiFiStatus
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user