From b1d8df5ebe02e3084b82ee140de89fe9f7574521 Mon Sep 17 00:00:00 2001
From: Bart van der Braak <bartvdbraak@gmail.com>
Date: Thu, 22 Feb 2024 00:23:24 +0100
Subject: [PATCH] feat: add well-know path for msid associated

---
 .env.example                                           |  2 ++
 .../microsoft-identity-association.json/+server.js     | 10 ++++++++++
 2 files changed, 12 insertions(+)
 create mode 100644 src/routes/.well-known/microsoft-identity-association.json/+server.js

diff --git a/.env.example b/.env.example
index 26b65f3..65c8070 100644
--- a/.env.example
+++ b/.env.example
@@ -1,2 +1,4 @@
 SERVER_PB="http://localhost:8090"
 PUBLIC_CLIENT_PB="http://127.0.0.1:8090"
+PUBLIC_MSID_ASSOCIATION="{}"
+PUBLIC_PLAUSIBLE_DOMAIN="plausible.example.com"
\ No newline at end of file
diff --git a/src/routes/.well-known/microsoft-identity-association.json/+server.js b/src/routes/.well-known/microsoft-identity-association.json/+server.js
new file mode 100644
index 0000000..8dbeafe
--- /dev/null
+++ b/src/routes/.well-known/microsoft-identity-association.json/+server.js
@@ -0,0 +1,10 @@
+import { MSID_ASSOCIATION } from '$env/static/private';
+
+export async function GET() {
+	return new Response(JSON.stringify(MSID_ASSOCIATION), {
+		headers: {
+			'Cache-Control': `public, max-age=${86400}`,
+			'Content-Type': 'application/json'
+		}
+	});
+}
\ No newline at end of file