-
Notifications
You must be signed in to change notification settings - Fork 0
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
fc339a6
commit a2f8de3
Showing
144 changed files
with
8,476 additions
and
12,396 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
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
use-node-version=18.18.2 |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Guide changelog | ||
|
||
## 10-05-2023 | ||
|
||
- add section about comparing local classes | ||
|
||
## 23-01-2023 | ||
|
||
- initial documentation release |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "@kismet.ts/docs", | ||
"version": "1.0.0", | ||
"description": "", | ||
"private": true, | ||
"scripts": { | ||
"docs:dev": "vuepress dev src", | ||
"docs:ref": "cd ../.. && pnpm prestart && node ./dist/typedoc.js --out apps/docs/src/ && cd apps/docs/", | ||
"docs:build": "pnpm docs:ref && vuepress build src" | ||
}, | ||
"keywords": [], | ||
"author": "ghostrider-05", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@kismet.ts/core": "link:packages\\core", | ||
"@kismet.ts/items": "link:packages\\items" | ||
}, | ||
"devDependencies": { | ||
"@vuepress/client": "2.0.0-beta.67", | ||
"vue": "^3.3.7", | ||
"vuepress": "2.0.0-beta.67" | ||
} | ||
} |
File renamed without changes.
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
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "kismet-cdn", | ||
"version": "0.1.0", | ||
"description": "A CF worker for kismet assets", | ||
"devDependencies": {}, | ||
"private": true, | ||
"scripts": { | ||
"publish": "wrangler publish -c ./wrangler.toml" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/ghostrider-05/kismet.ts.git" | ||
}, | ||
"author": "ghostrider-05", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/ghostrider-05/kismet.ts/issues" | ||
}, | ||
"homepage": "https://github.com/ghostrider-05/kismet.ts#readme" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { R2AssetHandlerItem, handleR2AssetReq } from '../../shared/r2.js' | ||
|
||
interface Env { | ||
KISMET_ASSETS: R2Bucket | ||
KISMET_KV: KVNamespace | ||
TAGS: string | ||
AUTH: string | ||
CACHE_DISABLED_MODE: string | ||
} | ||
|
||
export default<ExportedHandler<Env>> { | ||
async fetch (request, env, ctx) { | ||
const LATEST_KV_KEY = 'latest_version' | ||
const { pathname, searchParams } = new URL(request.url) | ||
|
||
const handleR2Req = (item: R2AssetHandlerItem) => handleR2AssetReq({ | ||
bucket: env.KISMET_ASSETS, | ||
auth: env.AUTH, | ||
ctx, | ||
cacheOptions: { | ||
use: searchParams.get('mode') !== env.CACHE_DISABLED_MODE, | ||
versionedControl: 'max-age=31536000, immutable', | ||
control: 'max-age=604800', | ||
}, | ||
req: request, | ||
}, item) | ||
|
||
if (pathname.startsWith('/assets')) { | ||
let version = searchParams.get('version') | ||
const tag = searchParams.get('tag'), | ||
useLatestVersion = version === 'latest' | ||
|
||
if (!version || !tag || !env.TAGS.split(',').includes(tag)) { | ||
return new Response(null, { status: 400 }) | ||
} | ||
|
||
const latest = await env.KISMET_KV.get(LATEST_KV_KEY, { type: 'text', cacheTtl: 604800 }) | ||
if (!latest) return new Response(null, { status: 500 }) | ||
|
||
if (useLatestVersion) { | ||
version = latest | ||
} | ||
|
||
const key = `versions/${version}/${tag}` | ||
|
||
return await handleR2Req({ key, | ||
messages: { error: 'Asset not found for version ' + version }, | ||
versioned: !useLatestVersion, | ||
view: ['true', '1'].includes(searchParams.get('view')), | ||
headersToAppend: [ | ||
['x-kismet-latest-version', latest], | ||
], | ||
}) | ||
} else if (pathname.startsWith('/images')) { | ||
const name = searchParams.get('name') | ||
|
||
if (!name) return new Response(null, { status: 400 }) | ||
|
||
return await handleR2Req({ | ||
key: `images/${name}`, | ||
messages: { error: 'Image not found for this class...' }, | ||
}) | ||
} | ||
|
||
return new Response(null, { status: 404 }); | ||
}, | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name="kismet-cdn" | ||
main="./src/index.ts" | ||
compatibility_date="2023-05-14" | ||
|
||
kv_namespaces = [ | ||
{ binding = "KISMET_KV", id = "89f9e0f8f12042469151882e25cb57c8" } | ||
] | ||
|
||
r2_buckets = [ | ||
{ binding = "KISMET_ASSETS", bucket_name = "assets" } | ||
] | ||
|
||
[vars] | ||
TAGS="itemdb,blender,classes,compact_tree,nodes,tree,history,nodes_automated" | ||
CACHE_DISABLED_MODE="dev" |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# @workers/shared | ||
|
||
A collection of shared utilities for Cloudflare workers |
Oops, something went wrong.