feat: version API and auth endpoints under /v1 prefix and update documentation labels
This commit is contained in:
+5
-5
@@ -17,8 +17,8 @@ app.doc("/doc", {
|
||||
openapi: "3.0.0",
|
||||
info: {
|
||||
version: "1.0.0",
|
||||
title: "toknd — Auth Broker API",
|
||||
description: "Centralized token management and OAuth2 broker service.",
|
||||
title: "toknd — Auth Broker API v1",
|
||||
description: "Centralized token management and OAuth2 broker service (v1).",
|
||||
},
|
||||
tags: [
|
||||
{ name: "Tokens", description: "Standard API for retrieving and refreshing provider tokens." },
|
||||
@@ -52,9 +52,9 @@ app.use("*", prettyJSON());
|
||||
app.get("/", (c) => c.redirect("/app"));
|
||||
|
||||
app.get("/app/dashboard.js", serveStatic({ path: "./src/views/dashboard.js" }));
|
||||
app.route("/auth", authRoutes);
|
||||
app.route("/api/config", configRoutes);
|
||||
app.route("/api", apiRoutes);
|
||||
app.route("/v1/auth", authRoutes);
|
||||
app.route("/api/v1/config", configRoutes);
|
||||
app.route("/api/v1", apiRoutes);
|
||||
app.route("/app", dashboardRoutes);
|
||||
|
||||
app.notFound((c) => {
|
||||
|
||||
@@ -66,10 +66,13 @@ export const Dashboard = (props: { isUnlocked: boolean }) => (
|
||||
<a
|
||||
href="/docs"
|
||||
target="_blank"
|
||||
class="btn btn-ghost btn-sm text-base-content/60 hover:text-primary gap-2 px-3" rel="noopener"
|
||||
class="btn btn-ghost btn-sm text-base-content/60 hover:text-primary gap-2 px-3"
|
||||
rel="noopener"
|
||||
>
|
||||
<i class="ph-duotone ph-book-open text-lg"></i>
|
||||
<span class="font-bold uppercase tracking-widest text-xs">API Reference</span>
|
||||
<span class="font-bold uppercase tracking-widest text-xs">
|
||||
API Reference <sup class="text-[8px] opacity-50 ml-0.5">v1.0.0</sup>
|
||||
</span>
|
||||
</a>
|
||||
</nav>
|
||||
</div>
|
||||
@@ -439,7 +442,7 @@ export const Dashboard = (props: { isUnlocked: boolean }) => (
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
<button
|
||||
type="button"
|
||||
x-on:click="window.open('/auth/' + provider.name + '/login', '_blank')"
|
||||
x-on:click="window.open('/v1/auth/' + provider.name + '/login', '_blank')"
|
||||
class="btn btn-primary btn-sm"
|
||||
>
|
||||
<i class="ph-bold ph-link"></i> Connect
|
||||
|
||||
@@ -76,8 +76,8 @@ document.addEventListener("alpine:init", () => {
|
||||
this.loading = true;
|
||||
try {
|
||||
const [configRes, statusRes] = await Promise.all([
|
||||
fetch("/api/config"),
|
||||
fetch("/api/status"),
|
||||
fetch("/api/v1/config"),
|
||||
fetch("/api/v1/status"),
|
||||
]);
|
||||
|
||||
if (configRes.status === 401 || statusRes.status === 401) {
|
||||
@@ -112,7 +112,7 @@ document.addEventListener("alpine:init", () => {
|
||||
async saveConfig() {
|
||||
this.loading = true;
|
||||
try {
|
||||
const res = await fetch(`/api/config/${this.form.providerName}`, {
|
||||
const res = await fetch(`/api/v1/config/${this.form.providerName}`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(this.form),
|
||||
@@ -146,7 +146,7 @@ document.addEventListener("alpine:init", () => {
|
||||
async forceRefresh(name) {
|
||||
this.loading = true;
|
||||
try {
|
||||
const res = await fetch(`/api/refresh/${name}`, {
|
||||
const res = await fetch(`/api/v1/refresh/${name}`, {
|
||||
method: "POST",
|
||||
});
|
||||
|
||||
@@ -175,7 +175,7 @@ document.addEventListener("alpine:init", () => {
|
||||
|
||||
this.loading = true;
|
||||
try {
|
||||
const res = await fetch(`/api/config/${name}`, {
|
||||
const res = await fetch(`/api/v1/config/${name}`, {
|
||||
method: "DELETE",
|
||||
});
|
||||
|
||||
@@ -207,7 +207,7 @@ document.addEventListener("alpine:init", () => {
|
||||
},
|
||||
|
||||
getRedirectUri() {
|
||||
return `${window.location.origin}/auth/${this.form.providerName || "{provider}"}/callback`;
|
||||
return `${window.location.origin}/v1/auth/${this.form.providerName || "{provider}"}/callback`;
|
||||
},
|
||||
|
||||
copyToClipboard(text) {
|
||||
|
||||
Reference in New Issue
Block a user