diff --git a/Alert/.env b/Alert/.env
index 136f2ffe55..59b4c3f258 100644
--- a/Alert/.env
+++ b/Alert/.env
@@ -1 +1 @@
-ONEUPTIME_SECRET=fd57b59aa8f3f516d2f6cb06
\ No newline at end of file
+ONEUPTIME_SECRET=ae60cf8f0cec2df8d05aaf0b
\ No newline at end of file
diff --git a/CommonServer/API/StatusPageSubscriberAPI.ts b/CommonServer/API/StatusPageSubscriberAPI.ts
new file mode 100644
index 0000000000..20dd3f2120
--- /dev/null
+++ b/CommonServer/API/StatusPageSubscriberAPI.ts
@@ -0,0 +1,54 @@
+
+import StatusPageSubscriber from 'Model/Models/StatusPageSubscriber';
+import StatusPageSubscriberService, {
+ Service as StatusPageSubscriberServiceType,
+} from '../Services/StatusPageSubscriberService';
+import {
+ ExpressRequest,
+ ExpressResponse,
+ NextFunction,
+} from '../Utils/Express';
+import BaseAPI from './BaseAPI';
+import Response from '../Utils/Response';
+
+export default class StatusPageSubscriberAPI extends BaseAPI<
+ StatusPageSubscriber,
+ StatusPageSubscriberServiceType
+> {
+ public constructor() {
+ super(StatusPageSubscriber, StatusPageSubscriberService);
+
+ this.router.get(
+ `/${new this.entityType().getCrudApiPath()?.toString()}/unsubscribe/:id`,
+ async (
+ req: ExpressRequest,
+ res: ExpressResponse,
+ next: NextFunction
+ ) => {
+ try {
+
+ await this.service.updateOneBy({
+ query: {
+ _id: req.params['id'] as string,
+ },
+ data: {
+ isUnsubscribed: true,
+ },
+ props: {
+ isRoot: true,
+ ignoreHooks: true,
+ }
+ });
+
+ return Response.sendHtmlResponse(req, res, '
You have been unsubscribed.
');
+ } catch (err) {
+ next(err);
+ }
+ }
+ );
+
+
+
+
+ }
+}
diff --git a/CommonServer/Services/StatusPageSubscriberService.ts b/CommonServer/Services/StatusPageSubscriberService.ts
index ce7af11f12..3c866f37e0 100644
--- a/CommonServer/Services/StatusPageSubscriberService.ts
+++ b/CommonServer/Services/StatusPageSubscriberService.ts
@@ -95,7 +95,7 @@ export class Service extends DatabaseService {
statusPageName: statusPageName,
statusPageUrl: statusPageURL,
isPublicStatusPage: onCreate.carryForward.isPublicStatusPage,
- unsubscribeUrl: new URL(HttpProtocol, Domain).addRoute("/status-page-subscriber/unsubscribe/" + createdItem._id.toString()).toString()
+ unsubscribeUrl: new URL(HttpProtocol, Domain).addRoute("/api/status-page-subscriber/unsubscribe/" + createdItem._id.toString()).toString()
},
subject: 'You have been subscribed to ' + statusPageName,
}).catch((err: Error) => {
diff --git a/CommonServer/Utils/Response.ts b/CommonServer/Utils/Response.ts
index 2a44e46456..439c8a4221 100644
--- a/CommonServer/Utils/Response.ts
+++ b/CommonServer/Utils/Response.ts
@@ -263,4 +263,26 @@ export default class Response {
oneUptimeResponse.status(200).send(text);
this.logResponse(req, res, { text: text as string });
}
+
+
+ public static sendHtmlResponse(
+ req: ExpressRequest,
+ res: ExpressResponse,
+ html: string
+ ): void {
+ const oneUptimeRequest: OneUptimeRequest = req as OneUptimeRequest;
+ const oneUptimeResponse: OneUptimeResponse = res as OneUptimeResponse;
+
+ oneUptimeResponse.set(
+ 'ExpressRequest-Id',
+ oneUptimeRequest.id.toString()
+ );
+
+ oneUptimeResponse.set('Pod-Id', process.env['POD_NAME']);
+
+ oneUptimeResponse.logBody = { html: html as string };
+ oneUptimeResponse.writeHead(200, { 'Content-Type':'text/html'});
+ oneUptimeResponse.end(html);
+ this.logResponse(req, res, { html: html as string });
+ }
}
diff --git a/Dashboard/src/Pages/StatusPages/View/EmailSubscribers.tsx b/Dashboard/src/Pages/StatusPages/View/EmailSubscribers.tsx
index 112adc1e9e..17739ead32 100644
--- a/Dashboard/src/Pages/StatusPages/View/EmailSubscribers.tsx
+++ b/Dashboard/src/Pages/StatusPages/View/EmailSubscribers.tsx
@@ -17,6 +17,7 @@ import NotNull from 'Common/Types/Database/NotNull';
import StatusPagePreviewLink from './StatusPagePreviewLink';
import { JSONObject } from 'Common/Types/JSON';
import Pill from 'CommonUI/src/Components/Pill/Pill';
+import { Green, Red } from 'Common/Types/BrandColors';
// import NotNull from 'Common/Types/Database/NotNull';
const StatusPageDelete: FunctionComponent = (
@@ -151,8 +152,6 @@ const StatusPageDelete: FunctionComponent = (
/>
);
}
-
- return <>>;
},
},
{
diff --git a/DashboardAPI/Index.ts b/DashboardAPI/Index.ts
index b60af35d49..7bea40d30c 100755
--- a/DashboardAPI/Index.ts
+++ b/DashboardAPI/Index.ts
@@ -30,10 +30,6 @@ import StatusPagePrivateUserService, {
Service as StatusPagePrivateUserServiceType,
} from 'CommonServer/Services/StatusPagePrivateUserService';
-import StatusPageSubscriber from 'Model/Models/StatusPageSubscriber';
-import StatusPageSubscriberService, {
- Service as StatusPageSubscriberServiceType,
-} from 'CommonServer/Services/StatusPageSubscriberService';
import StatusPageFooterLink from 'Model/Models/StatusPageFooterLink';
import StatusPageFooterLinkService, {
@@ -189,6 +185,8 @@ import StatusPageDomainService, {
import StatusPageAPI from 'CommonServer/API/StatusPageAPI';
+import StatusPageSubscriberAPI from 'CommonServer/API/StatusPageSubscriberAPI';
+
const app: ExpressApplication = Express.getExpressApp();
const APP_NAME: string = 'api';
@@ -289,12 +287,6 @@ app.use(
).getRouter()
);
-app.use(
- new BaseAPI(
- StatusPageSubscriber,
- StatusPageSubscriberService
- ).getRouter()
-);
app.use(
new BaseAPI(
@@ -389,6 +381,7 @@ app.use(
);
app.use(new StatusPageAPI().getRouter());
+app.use(new StatusPageSubscriberAPI().getRouter());
app.use(new BillingPaymentMethodAPI().getRouter());
app.use(new BillingInvoiceAPI().getRouter());
diff --git a/Nginx/default.tpl.conf b/Nginx/default.tpl.conf
index fdf6e8c53f..d9094d9747 100644
--- a/Nginx/default.tpl.conf
+++ b/Nginx/default.tpl.conf
@@ -114,7 +114,10 @@ server {
}
server {
+
listen 443 ssl; # Port HTTPS
+ listen 80;
+
server_name localhost;
{{ if ne .Env.DOMAIN "localhost" }}
server_name {{ .Env.DOMAIN }};