@rblez/authly 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/authly.js
CHANGED
|
@@ -11,7 +11,7 @@ const COMMANDS = {
|
|
|
11
11
|
init: { description: "Initialize authly in your project", handler: cmdInit },
|
|
12
12
|
ext: { description: "Manage extensions (add, remove)", handler: cmdExt },
|
|
13
13
|
audit: { description: "Check auth configuration for issues", handler: cmdAudit },
|
|
14
|
-
version: { description: "Show version", handler: () => console.log("0.
|
|
14
|
+
version: { description: "Show version", handler: () => console.log("0.4.0") },
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
async function main() {
|
package/dist/dashboard/app.js
CHANGED
|
@@ -7,11 +7,14 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
|
7
7
|
const statusText = document.getElementById("statusText");
|
|
8
8
|
const statusDot = document.querySelector(".header__dot");
|
|
9
9
|
|
|
10
|
+
// All API calls go to the hosted authly instance
|
|
11
|
+
const API_URL = "https://authly.rblez.com/api";
|
|
12
|
+
|
|
10
13
|
checkHealth();
|
|
11
14
|
|
|
12
15
|
// ── Helpers ─────────────────────────────────────────
|
|
13
16
|
async function api(endpoint, opts = {}) {
|
|
14
|
-
const res = await fetch(
|
|
17
|
+
const res = await fetch(`${API_URL}${endpoint}`, {
|
|
15
18
|
headers: { "Content-Type": "application/json" },
|
|
16
19
|
...opts,
|
|
17
20
|
});
|
|
@@ -40,7 +43,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
|
40
43
|
// ── Health ──────────────────────────────────────────
|
|
41
44
|
async function checkHealth() {
|
|
42
45
|
try {
|
|
43
|
-
const res = await fetch(
|
|
46
|
+
const res = await fetch(`${API_URL}/health`);
|
|
44
47
|
if (res.ok) {
|
|
45
48
|
statusText.textContent = "Connected";
|
|
46
49
|
statusDot.style.background = "#22c55e";
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
|
|
55
55
|
<!-- Platform: Connect Supabase (OAuth to Supabase API) -->
|
|
56
56
|
<div class="section-label">Platform connection</div>
|
|
57
|
-
<a href="/api/auth/supabase/authorize" id="supabasePlatformBtn" class="platform-connect">
|
|
57
|
+
<a href="https://authly.rblez.com/api/auth/supabase/authorize" id="supabasePlatformBtn" class="platform-connect">
|
|
58
58
|
<img src="https://cdn.simpleicons.org/supabase/fff" width="20" height="20" alt="Supabase" />
|
|
59
59
|
<span class="label">Connect Supabase</span>
|
|
60
60
|
<span class="status" id="sbStatus">Not connected</span>
|
|
@@ -68,10 +68,12 @@
|
|
|
68
68
|
</div>
|
|
69
69
|
|
|
70
70
|
<script>
|
|
71
|
+
const API_URL = "https://authly.rblez.com/api";
|
|
72
|
+
|
|
71
73
|
async function loadProviders() {
|
|
72
74
|
const container = document.getElementById("providerList");
|
|
73
75
|
try {
|
|
74
|
-
const res = await fetch(
|
|
76
|
+
const res = await fetch(`${API_URL}/providers`);
|
|
75
77
|
const data = await res.json();
|
|
76
78
|
if (!data.providers) { container.innerHTML = "<p style='color:#555'>—</p>"; return; }
|
|
77
79
|
|
|
@@ -86,11 +88,10 @@
|
|
|
86
88
|
</div>`;
|
|
87
89
|
}).join("");
|
|
88
90
|
|
|
89
|
-
// Attach click handlers
|
|
90
91
|
container.querySelectorAll(".provider-btn[data-enabled='true']").forEach(el => {
|
|
91
92
|
el.addEventListener("click", () => {
|
|
92
93
|
const provider = el.dataset.provider;
|
|
93
|
-
window.location.href =
|
|
94
|
+
window.location.href = `${API_URL}/auth/${provider}/authorize`;
|
|
94
95
|
});
|
|
95
96
|
});
|
|
96
97
|
} catch {
|
|
@@ -98,14 +99,12 @@
|
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
101
|
|
|
101
|
-
// Check if Supabase is already connected
|
|
102
102
|
async function checkSupabaseConnected() {
|
|
103
103
|
try {
|
|
104
|
-
const res = await fetch(
|
|
104
|
+
const res = await fetch(`${API_URL}/health`);
|
|
105
105
|
if (res.ok) {
|
|
106
106
|
document.getElementById("sbStatus").textContent = "Connected";
|
|
107
|
-
|
|
108
|
-
btn.classList.add("connected");
|
|
107
|
+
document.getElementById("supabasePlatformBtn").classList.add("connected");
|
|
109
108
|
}
|
|
110
109
|
} catch {}
|
|
111
110
|
}
|
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
<div id="integrationDetail" class="hidden" style="margin-top:12px"></div>
|
|
188
188
|
<div style="margin-top:16px;display:flex;gap:8px;flex-wrap:wrap">
|
|
189
189
|
<button class="btn btn--primary btn--sm" id="reconnectBtn"><i class="ri-refresh-line"></i> Re-scan & reconnect</button>
|
|
190
|
-
<a href="/api/auth/supabase/authorize" class="btn btn--sm" style="background:#0d1b3e;border:1px solid #1d355e;color:#58a6ff;text-decoration:none" id="connectSbPlatformBtn"><i class="ri-plug-line"></i> Connect via OAuth</a>
|
|
190
|
+
<a href="https://authly.rblez.com/api/auth/supabase/authorize" target="_blank" class="btn btn--sm" style="background:#0d1b3e;border:1px solid #1d355e;color:#58a6ff;text-decoration:none" id="connectSbPlatformBtn"><i class="ri-plug-line"></i> Connect via OAuth</a>
|
|
191
191
|
</div>
|
|
192
192
|
</div>
|
|
193
193
|
</section>
|
package/package.json
CHANGED
package/src/commands/serve.js
CHANGED
|
@@ -41,6 +41,17 @@ export async function cmdServe() {
|
|
|
41
41
|
|
|
42
42
|
const app = new Hono();
|
|
43
43
|
|
|
44
|
+
// ── CORS — allow localhost to call the hosted API ──
|
|
45
|
+
app.use("/api/*", (c) => {
|
|
46
|
+
c.header("Access-Control-Allow-Origin", "*");
|
|
47
|
+
c.header("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
|
|
48
|
+
c.header("Access-Control-Allow-Headers", "Content-Type, Authorization");
|
|
49
|
+
if (c.req.method === "OPTIONS") {
|
|
50
|
+
return new Response(null, { status: 204 });
|
|
51
|
+
}
|
|
52
|
+
return c.next();
|
|
53
|
+
});
|
|
54
|
+
|
|
44
55
|
// ── Static file serving ────────────────────────────
|
|
45
56
|
const dashboardPath = path.join(__dirname, "../../dist/dashboard");
|
|
46
57
|
const hasDashboard = fs.existsSync(dashboardPath);
|