diff --git a/src/components/AppShelf/AddAppShelfItem.tsx b/src/components/AppShelf/AddAppShelfItem.tsx
index 0c8071c83..cff74d57a 100644
--- a/src/components/AppShelf/AddAppShelfItem.tsx
+++ b/src/components/AppShelf/AddAppShelfItem.tsx
@@ -15,6 +15,7 @@ import {
Tabs,
MultiSelect,
ScrollArea,
+ Switch,
} from '@mantine/core';
import { useForm } from '@mantine/form';
import { useEffect, useState } from 'react';
@@ -22,7 +23,7 @@ import { IconApps as Apps } from '@tabler/icons';
import { v4 as uuidv4 } from 'uuid';
import { useDebouncedValue } from '@mantine/hooks';
import { useConfig } from '../../tools/state';
-import { ServiceTypeList, StatusCodes, Targets } from '../../tools/types';
+import { ServiceTypeList, StatusCodes } from '../../tools/types';
export function AddItemShelfButton(props: any) {
const [opened, setOpened] = useState(false);
@@ -117,7 +118,7 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } &
password: props.password ?? (undefined as unknown as string),
openedUrl: props.openedUrl ?? (undefined as unknown as string),
status: props.status ?? ['200'],
- target: props.target ?? '_blank',
+ newTab: props.newTab ?? true,
},
validate: {
apiKey: () => null,
@@ -181,8 +182,8 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } &
if (JSON.stringify(form.values.status) === JSON.stringify(['200'])) {
form.values.status = undefined;
}
- if (form.values.target === '_blank') {
- form.values.target = undefined;
+ if (form.values.newTab === true) {
+ form.values.newTab = undefined;
}
// If service already exists, update it.
if (config.services && config.services.find((s) => s.id === form.values.id)) {
@@ -208,155 +209,154 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } &
form.reset();
})}
>
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/src/components/AppShelf/AppShelfItem.tsx b/src/components/AppShelf/AppShelfItem.tsx
index c1cfdf6a2..109b873c2 100644
--- a/src/components/AppShelf/AppShelfItem.tsx
+++ b/src/components/AppShelf/AppShelfItem.tsx
@@ -83,7 +83,7 @@ export function AppShelfItem(props: any) {
>
@@ -127,13 +127,9 @@ export function AppShelfItem(props: any) {
src={service.icon}
fit="contain"
onClick={() => {
- if (service.target === undefined || service.target === '_blank') {
- if (service.openedUrl) window.open(service.openedUrl, '_blank');
- else window.open(service.url);
- } else {
- if (service.openedUrl) window.location.href = service.openedUrl;
- else window.location.href = service.url;
- }
+ if (service.openedUrl) {
+ window.open(service.openedUrl, service.newTab === false ? '_top' : '_blank');
+ } else window.open(service.url, service.newTab === false ? '_top' : '_blank');
}}
/>
diff --git a/src/components/AppShelf/AppShelfMenu.tsx b/src/components/AppShelf/AppShelfMenu.tsx
index 84f573756..5aada187a 100644
--- a/src/components/AppShelf/AppShelfMenu.tsx
+++ b/src/components/AppShelf/AppShelfMenu.tsx
@@ -22,18 +22,7 @@ export default function AppShelfMenu(props: any) {
>
diff --git a/src/pages/api/modules/ping.ts b/src/pages/api/modules/ping.ts
index 751747ad4..6662cd8a6 100644
--- a/src/pages/api/modules/ping.ts
+++ b/src/pages/api/modules/ping.ts
@@ -10,7 +10,11 @@ async function Get(req: NextApiRequest, res: NextApiResponse) {
res.status(response.status).json(response.statusText);
})
.catch((error) => {
- res.status(error.response.status).json(error.response.statusText);
+ if (error.response) {
+ res.status(error.response.status).json(error.response.statusText);
+ } else {
+ res.status(500).json('Server Error');
+ }
});
// // Make a request to the URL
// const response = await axios.get(url);
diff --git a/src/tools/types.ts b/src/tools/types.ts
index eedac4f69..1b3953a1f 100644
--- a/src/tools/types.ts
+++ b/src/tools/types.ts
@@ -92,6 +92,6 @@ export interface serviceItem {
password?: string;
username?: string;
openedUrl?: string;
- status: string[];
- target: string;
+ newTab?: boolean;
+ status?: string[];
}