diff --git a/Website/modules/Elements/Lunasea.tsx b/Website/modules/Elements/Lunasea.tsx deleted file mode 100644 index b6b6b65..0000000 --- a/Website/modules/Elements/Lunasea.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import {ReactElement, useState} from "react"; -import NotificationConnector from "../api/NotificationConnector"; -import Loader from "../Loader"; -import ILunaseaRecord from "../types/records/ILunaseaRecord"; - -export function LunaseaItem ({apiUri} : {apiUri: string}) : ReactElement{ - const [record, setRecord] = useState<ILunaseaRecord>({ - id: "" - }); - const [loading, setLoading] = useState(false); - return <div className="NotificationConnectorItem"> - <input className="NotificationConnectorItem-Name" value="LunaSea" disabled={true} /> - <div className="NotificationConnectorItem-Url"> - <input type="text" className="NotificationConnectorItem-RequestUrl" placeholder="device/:device_id or user/:user_id" onChange={(e) => setRecord({...record, id: e.currentTarget.value})} /> - </div> - <> - <button className="NotificationConnectorItem-Save" onClick={(e) => { - if(record === null || Validate(record) === false) - return; - setLoading(true); - NotificationConnector.CreateLunasea(apiUri, record) - .finally(() => setLoading(false)); - }}>Add</button> - <Loader loading={loading} style={{width:"40px",height:"40px",margin:"25vh calc(sin(70)*(50% - 40px))"}}/> - </> - </div>; -} - -const regex = new RegExp("(?:device|user)\/[0-9a-zA-Z\-]+"); -function Validate(record: ILunaseaRecord) : boolean { - return regex.test(record.id); -} \ No newline at end of file diff --git a/Website/modules/Elements/NotificationConnector.tsx b/Website/modules/Elements/NotificationConnector.tsx index 1bb53ce..335d886 100644 --- a/Website/modules/Elements/NotificationConnector.tsx +++ b/Website/modules/Elements/NotificationConnector.tsx @@ -5,7 +5,6 @@ import NotificationConnector from "../api/NotificationConnector"; import INotificationConnector from "../types/INotificationConnector"; import {GotifyItem} from "./Gotify"; import {NtfyItem} from "./Ntfy"; -import {LunaseaItem} from "./Lunasea"; import {PushoverItem} from "./Pushover"; export default function NotificationConnectorItem({apiUri, notificationConnector} : {apiUri: string, notificationConnector: INotificationConnector | null}) : ReactElement { @@ -22,14 +21,12 @@ export default function NotificationConnectorItem({apiUri, notificationConnector case "default": setSelectedConnectorElement(<DefaultItem apiUri={apiUri} notificationConnector={null} />); break; case "gotify": setSelectedConnectorElement(<GotifyItem apiUri={apiUri} />); break; case "ntfy": setSelectedConnectorElement(<NtfyItem apiUri={apiUri} />); break; - case "lunasea": setSelectedConnectorElement(<LunaseaItem apiUri={apiUri} />); break; case "pushover": setSelectedConnectorElement(<PushoverItem apiUri={apiUri} />); break; } }}> <option value="default">Generic REST</option> <option value="gotify">Gotify</option> <option value="ntfy">Ntfy</option> - <option value="lunasea">Lunasea</option> <option value="pushover">Pushover</option> </select> {selectedConnectorElement} diff --git a/Website/modules/api/NotificationConnector.tsx b/Website/modules/api/NotificationConnector.tsx index d303845..a09e5e5 100644 --- a/Website/modules/api/NotificationConnector.tsx +++ b/Website/modules/api/NotificationConnector.tsx @@ -1,7 +1,6 @@ import {deleteData, getData, putData} from "../../App"; import IGotifyRecord from "../types/records/IGotifyRecord"; import INtfyRecord from "../types/records/INtfyRecord"; -import ILunaseaRecord from "../types/records/ILunaseaRecord"; import IPushoverRecord from "../types/records/IPushoverRecord"; import INotificationConnector from "../types/INotificationConnector"; @@ -82,21 +81,6 @@ export default class NotificationConnector { }); } - static async CreateLunasea(apiUri: string, lunasea: ILunaseaRecord) : Promise<string> { - if(lunasea === undefined || lunasea === null) { - console.error(`lunasea was not provided`); - return Promise.reject(); - } - //console.info("Getting Notification Connectors"); - return putData(`${apiUri}/v2/NotificationConnector/Lunasea`, lunasea) - .then((json) => { - //console.info("Got Notification Connectors"); - const ret = json as unknown as string; - //console.debug(ret); - return (ret); - }); - } - static async CreatePushover(apiUri: string, pushover: IPushoverRecord) : Promise<string> { if(pushover === undefined || pushover === null) { console.error(`pushover was not provided`);