-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
63f86b4
commit 7ab5eb1
Showing
201 changed files
with
6,065 additions
and
7,753 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,66 @@ | ||
import { Hono } from "hono"; | ||
import { ZoneCache } from "./lib/cache"; | ||
import { ABBY_WINDOW_KEY, AbbyDataResponse } from "@tryabby/core"; | ||
import { Hono } from 'hono' | ||
import { ZoneCache } from './lib/cache' | ||
import { ABBY_WINDOW_KEY, AbbyDataResponse } from '@tryabby/core' | ||
|
||
import { cors } from "hono/cors"; | ||
import { timing } from "hono/timing"; | ||
import { logger } from "hono/logger"; | ||
import { ConfigService } from "./lib/config"; | ||
import { cors } from 'hono/cors' | ||
import { timing } from 'hono/timing' | ||
import { logger } from 'hono/logger' | ||
import { ConfigService } from './lib/config' | ||
|
||
const cache = new ZoneCache<{ | ||
config: AbbyDataResponse; | ||
config: AbbyDataResponse | ||
}>({ | ||
cloudflareApiKey: "", | ||
domain: "cache.tryabby.com", | ||
cloudflareApiKey: '', | ||
domain: 'cache.tryabby.com', | ||
fresh: 60 * 1000, | ||
stale: 60 * 1000, | ||
zoneId: "", | ||
}); | ||
zoneId: '', | ||
}) | ||
|
||
const configCache = new ConfigService(cache); | ||
const configCache = new ConfigService(cache) | ||
|
||
const app = new Hono() | ||
.use( | ||
"*", | ||
'*', | ||
cors({ | ||
origin: "*", | ||
origin: '*', | ||
maxAge: 60 * 60 * 24 * 30, | ||
}) | ||
) | ||
.use("*", timing()) | ||
.use("*", logger()) | ||
.get("/:projectId/:environment", async (c) => { | ||
const environment = c.req.param("environment"); | ||
const projectId = c.req.param("projectId"); | ||
.use('*', timing()) | ||
.use('*', logger()) | ||
.get('/:projectId/:environment', async (c) => { | ||
const environment = c.req.param('environment') | ||
const projectId = c.req.param('projectId') | ||
|
||
const [data, , reason] = await configCache.retrieveConfig({ | ||
c, | ||
environment, | ||
projectId, | ||
}); | ||
}) | ||
|
||
c.header("x-abby-cache", reason); | ||
return c.json(data); | ||
c.header('x-abby-cache', reason) | ||
return c.json(data) | ||
}) | ||
.get("/:projectId/:environment/script.js", async (c) => { | ||
const environment = c.req.param("environment"); | ||
const projectId = c.req.param("projectId"); | ||
.get('/:projectId/:environment/script.js', async (c) => { | ||
const environment = c.req.param('environment') | ||
const projectId = c.req.param('projectId') | ||
|
||
const [data, , reason] = await configCache.retrieveConfig({ | ||
c, | ||
environment, | ||
projectId, | ||
}); | ||
}) | ||
|
||
c.header("x-abby-cache", reason); | ||
c.header('x-abby-cache', reason) | ||
|
||
const script = `window.${ABBY_WINDOW_KEY} = ${JSON.stringify(data)};`; | ||
const script = `window.${ABBY_WINDOW_KEY} = ${JSON.stringify(data)};` | ||
|
||
return c.text(script, { | ||
headers: { | ||
"Content-Type": "application/javascript", | ||
'Content-Type': 'application/javascript', | ||
}, | ||
}); | ||
}); | ||
}) | ||
}) | ||
|
||
export default app; | ||
export default app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
const withNextra = require("nextra")({ | ||
theme: "nextra-theme-docs", | ||
themeConfig: "./theme.config.jsx", | ||
const withNextra = require('nextra')({ | ||
theme: 'nextra-theme-docs', | ||
themeConfig: './theme.config.jsx', | ||
defaultShowCopyCode: true, | ||
}); | ||
}) | ||
|
||
const { withPlausibleProxy } = require("next-plausible"); | ||
const { withPlausibleProxy } = require('next-plausible') | ||
|
||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
reactStrictMode: true, | ||
swcMinify: true, | ||
// use this to add <html lang="en"> to all pages | ||
i18n: { | ||
locales: ["en"], | ||
defaultLocale: "en", | ||
locales: ['en'], | ||
defaultLocale: 'en', | ||
}, | ||
}; | ||
} | ||
|
||
module.exports = withPlausibleProxy()(withNextra(nextConfig)); | ||
module.exports = withPlausibleProxy()(withNextra(nextConfig)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{ | ||
"nextjs": "Next.js", | ||
"react": "React", | ||
"svelte": "Svelte", | ||
"angular": "Angular", | ||
"http": "HTTP API", | ||
"cli": "CLI" | ||
} | ||
"nextjs": "Next.js", | ||
"react": "React", | ||
"svelte": "Svelte", | ||
"angular": "Angular", | ||
"http": "HTTP API", | ||
"cli": "CLI" | ||
} |
Oops, something went wrong.