mirror of
https://github.com/sune-org/D1P.git
synced 2026-01-13 16:17:59 +00:00
Initial commit
This commit is contained in:
17
.github/workflows/auto-name.yml
vendored
Normal file
17
.github/workflows/auto-name.yml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
on: push
|
||||
permissions: write-all
|
||||
jobs:
|
||||
j:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: |
|
||||
n=${GITHUB_REPOSITORY#*/};n=$(echo $n|tr A-Z a-z)
|
||||
jq ".name=\"$n\"" package.json>p.json && mv p.json package.json
|
||||
sed -i "s/^name *=.*$/name = \"$n\"/" wrangler.toml
|
||||
git diff --quiet || {
|
||||
git config user.email a@a.a
|
||||
git config user.name a
|
||||
git commit -am update
|
||||
git push
|
||||
}
|
||||
11
.github/workflows/deep.yml
vendored
Normal file
11
.github/workflows/deep.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
jobs:
|
||||
deploy-cloudflare:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: cloudflare/wrangler-action@v3
|
||||
with:
|
||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
167
.gitignore
vendored
Normal file
167
.gitignore
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
# Logs
|
||||
|
||||
logs
|
||||
_.log
|
||||
npm-debug.log_
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
|
||||
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
|
||||
|
||||
# Runtime data
|
||||
|
||||
pids
|
||||
_.pid
|
||||
_.seed
|
||||
\*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
|
||||
coverage
|
||||
\*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Snowpack dependency directory (https://snowpack.dev/)
|
||||
|
||||
web_modules/
|
||||
|
||||
# TypeScript cache
|
||||
|
||||
\*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
|
||||
.eslintcache
|
||||
|
||||
# Optional stylelint cache
|
||||
|
||||
.stylelintcache
|
||||
|
||||
# Microbundle cache
|
||||
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
|
||||
\*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
|
||||
.yarn-integrity
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
|
||||
.cache
|
||||
.parcel-cache
|
||||
|
||||
# Next.js build output
|
||||
|
||||
.next
|
||||
out
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
|
||||
.cache/
|
||||
|
||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
|
||||
.vuepress/dist
|
||||
|
||||
# vuepress v2.x temp and cache directory
|
||||
|
||||
.temp
|
||||
.cache
|
||||
|
||||
# Docusaurus cache and generated files
|
||||
|
||||
.docusaurus
|
||||
|
||||
# Serverless directories
|
||||
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
|
||||
.tern-port
|
||||
|
||||
# Stores VSCode versions used for testing VSCode extensions
|
||||
|
||||
.vscode-test
|
||||
|
||||
# yarn v2
|
||||
|
||||
.yarn/cache
|
||||
.yarn/unplugged
|
||||
.yarn/build-state.yml
|
||||
.yarn/install-state.gz
|
||||
.pnp.\*
|
||||
|
||||
# wrangler project
|
||||
|
||||
.dev.vars*
|
||||
!.dev.vars.example
|
||||
.env*
|
||||
!.env.example
|
||||
.wrangler/
|
||||
11
index.js
Normal file
11
index.js
Normal file
@@ -0,0 +1,11 @@
|
||||
async function fetch(request) {
|
||||
if (request.method === 'OPTIONS') {
|
||||
const headers = new Headers()
|
||||
headers.set('Access-Control-Allow-Origin', '*')
|
||||
headers.set('Access-Control-Allow-Headers', 'Authorization, Content-Type')
|
||||
return new Response(null, { headers })
|
||||
}
|
||||
return new Response('OK')
|
||||
}
|
||||
|
||||
export default { fetch }
|
||||
15
package.json
Normal file
15
package.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "workertemplate",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"deploy": "wrangler deploy",
|
||||
"dev": "wrangler dev",
|
||||
"start": "wrangler dev"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"wrangler": "4.33.*"
|
||||
}
|
||||
}
|
||||
253
wrangler.toml
Normal file
253
wrangler.toml
Normal file
@@ -0,0 +1,253 @@
|
||||
# Wrangler configuration for Cloudflare Workers
|
||||
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/
|
||||
# This template aims to enumerate the major, commonly used options in wrangler.toml.
|
||||
# Not every experimental/beta option is listed; prefer official docs for edge cases.
|
||||
|
||||
# Required: unique Worker name in your Cloudflare account.
|
||||
name = "workertemplate"
|
||||
|
||||
# Entry point for a Modules Worker. Use .ts/.mjs if needed.
|
||||
# If you ship a Service Worker script instead of Modules, see [build.upload] below.
|
||||
main = "index.js"
|
||||
|
||||
# Required: locks your Worker to a specific runtime API version.
|
||||
# Bump intentionally after testing: https://developers.cloudflare.com/workers/platform/compatibility-dates/
|
||||
compatibility_date = "2025-09-09"
|
||||
|
||||
# Optional: granular runtime feature flags; use sparingly.
|
||||
# Example: ["nodejs_compat"] or other flags listed in docs.
|
||||
# https://developers.cloudflare.com/workers/platform/compatibility-dates/#compatibility-flags
|
||||
# compatibility_flags = []
|
||||
|
||||
# Optional: enable Node.js API polyfills (fetch-based). Prefer compatibility_flags where appropriate.
|
||||
# node_compat = true
|
||||
|
||||
# Account to deploy under (auto-detected by login, but set explicitly for CI).
|
||||
# https://developers.cloudflare.com/workers/wrangler/commands/#login
|
||||
# account_id = ""
|
||||
|
||||
# Deploy to *.workers.dev when true (useful without routes/zone).
|
||||
# workers_dev = true
|
||||
|
||||
# Retain vars across publish if they already exist on the server (helps CI idempotency).
|
||||
keep_vars = true
|
||||
|
||||
# Choose pricing/limits model. "bundled" (default) or "unbound".
|
||||
# https://developers.cloudflare.com/workers/platform/pricing/#usage-models
|
||||
# usage_model = "bundled"
|
||||
|
||||
# Routing
|
||||
# Simple route list (no per-route options). Requires a zone.
|
||||
# routes = ["example.com/*", "api.example.com/*"]
|
||||
|
||||
# Advanced per-route objects. Use either routes above OR [[routes]] blocks below.
|
||||
# [[routes]]
|
||||
# pattern = "example.com/*"
|
||||
# zone_name = "example.com" # or zone_id = "..."
|
||||
# # Optional: custom placement per route (rare). See [placement] below.
|
||||
# # script = "<another-worker-name>" # only when defining routes for other scripts
|
||||
|
||||
# Triggers (CRON)
|
||||
# CRON schedules in crontab format (UTC). Your Worker must export a scheduled handler.
|
||||
# https://developers.cloudflare.com/workers/configuration/cron-triggers/
|
||||
# [triggers]
|
||||
# crons = ["*/5 * * * *"]
|
||||
|
||||
# Observability
|
||||
# Collect platform metrics/traces; view in Dashboard > Observability.
|
||||
[observability]
|
||||
enabled = true
|
||||
# head_sampling_rate = 1.0 # 0.0–1.0 fraction to sample traces, when supported.
|
||||
|
||||
# Smart Placement
|
||||
# Let Cloudflare place your Worker near the origin/data location automatically.
|
||||
# https://developers.cloudflare.com/workers/configuration/smart-placement/
|
||||
# [placement]
|
||||
# mode = "smart" # "smart" or "off" (default if omitted)
|
||||
|
||||
# Environment Variables (plaintext)
|
||||
# Do NOT store secrets here. For secrets, use `wrangler secret put`.
|
||||
# https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
|
||||
# [vars]
|
||||
# NODE_ENV = "production"
|
||||
# API_BASE_URL = "https://api.example.com"
|
||||
|
||||
# Secrets
|
||||
# Define at deploy-time:
|
||||
# $ wrangler secret put MY_SECRET
|
||||
# They do not appear in wrangler.toml by design.
|
||||
|
||||
# Static Assets (Workers Assets)
|
||||
# Serve static files bundled into your Worker and expose as a binding.
|
||||
# https://developers.cloudflare.com/workers/static-assets/binding/
|
||||
# [assets]
|
||||
# directory = "./public"
|
||||
# binding = "ASSETS"
|
||||
# html_handling = "auto" # "auto" | "none"
|
||||
# not_found_handling = "none" # "none" | "single-page-application"
|
||||
|
||||
# Modules: additional resources
|
||||
# Inline module maps. Keys become import names in your worker code.
|
||||
# [wasm_modules]
|
||||
# WASM_PARSER = "./wasm/parser.wasm"
|
||||
|
||||
# [text_blobs]
|
||||
# EMAIL_TEMPLATE = "./templates/welcome.txt"
|
||||
|
||||
# [data_blobs]
|
||||
# BINARY_CHUNK = "./assets/blob.bin"
|
||||
|
||||
# Build Pipeline
|
||||
# Run a custom build before publish/dev.
|
||||
# https://developers.cloudflare.com/workers/wrangler/configuration/#build
|
||||
# [build]
|
||||
# command = "npm run build"
|
||||
# cwd = "." # working directory for the build command
|
||||
# watch_dir = "src" # re-run build during `wrangler dev` on changes
|
||||
|
||||
# Switch between Modules and Service Worker upload formats.
|
||||
# [build.upload]
|
||||
# format = "modules" # "modules" (default) or "service-worker"
|
||||
# main = "./worker.js" # if using service-worker format, point to the SW bundle
|
||||
# dir = "dist" # directory to upload when using service-worker format
|
||||
# rules = [
|
||||
# { type = "Text", globs = ["**/*.txt"] },
|
||||
# { type = "Data", globs = ["**/*.bin"] },
|
||||
# { type = "CompiledWasm", globs = ["**/*.wasm"] },
|
||||
# ]
|
||||
|
||||
# Local Dev Server
|
||||
# Customize `wrangler dev` behavior.
|
||||
# https://developers.cloudflare.com/workers/wrangler/configuration/#dev
|
||||
# [dev]
|
||||
# ip = "127.0.0.1"
|
||||
# port = 8787
|
||||
# local_protocol = "http" # "http" or "https"
|
||||
# host = "localhost"
|
||||
# live_reload = true
|
||||
# inspector_port = 9229
|
||||
|
||||
# KV Namespaces
|
||||
# https://developers.cloudflare.com/workers/wrangler/configuration/#kv-namespaces
|
||||
# [[kv_namespaces]]
|
||||
# binding = "MY_KV"
|
||||
# id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
# preview_id = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
|
||||
|
||||
# R2 Object Storage
|
||||
# https://developers.cloudflare.com/r2/
|
||||
# [[r2_buckets]]
|
||||
# binding = "MY_BUCKET"
|
||||
# bucket_name = "my-bucket"
|
||||
|
||||
# D1 Databases
|
||||
# https://developers.cloudflare.com/d1/
|
||||
# [[d1_databases]]
|
||||
# binding = "DB"
|
||||
# database_name = "my-db"
|
||||
# database_id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
# preview_database_id = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
|
||||
|
||||
# Durable Objects (fully commented)
|
||||
# Bind Durable Object classes by name. Implement and export classes in your code.
|
||||
# https://developers.cloudflare.com/workers/runtime-apis/durable-objects/
|
||||
# [durable_objects]
|
||||
# bindings = [
|
||||
# { name = "MY_DO", class_name = "MyDurableObject" }
|
||||
# ]
|
||||
|
||||
# Durable Object migrations define class lifecycle changes over time.
|
||||
# Apply sequentially; never edit old tags once deployed.
|
||||
# https://developers.cloudflare.com/workers/wrangler/configuration/#migrations
|
||||
# [[migrations]]
|
||||
# tag = "v1"
|
||||
# new_classes = ["MyDurableObject"]
|
||||
|
||||
# [[migrations]]
|
||||
# tag = "v2"
|
||||
# renamed_classes = [{ from = "MyDurableObject", to = "MyDO" }]
|
||||
|
||||
# [[migrations]]
|
||||
# tag = "v3"
|
||||
# deleted_classes = ["LegacyObject"]
|
||||
|
||||
# Queues (Producers & Consumers)
|
||||
# https://developers.cloudflare.com/queues/
|
||||
# [queues]
|
||||
# [[queues.producers]]
|
||||
# binding = "MY_QUEUE"
|
||||
# queue = "my-queue"
|
||||
# [[queues.consumers]]
|
||||
# queue = "my-queue"
|
||||
# max_batch_size = 10
|
||||
# max_batch_timeout = 2 # seconds
|
||||
# max_retries = 3
|
||||
# dead_letter_queue = "my-queue-dlq"
|
||||
|
||||
# Analytics Engine
|
||||
# https://developers.cloudflare.com/analytics/analytics-engine/
|
||||
# [[analytics_engine_datasets]]
|
||||
# binding = "ANALYTICS"
|
||||
# dataset = "my_dataset"
|
||||
|
||||
# Vectorize (Vector DB)
|
||||
# https://developers.cloudflare.com/vectorize/
|
||||
# [[vectorize]]
|
||||
# binding = "VECTORS"
|
||||
# index_name = "my-index"
|
||||
|
||||
# Hyperdrive (Managed Postgres Connectivity)
|
||||
# https://developers.cloudflare.com/hyperdrive/
|
||||
# [[hyperdrive]]
|
||||
# binding = "PG"
|
||||
# id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # Hyperdrive config ID
|
||||
|
||||
# Browser Rendering API
|
||||
# https://developers.cloudflare.com/browser-rendering/
|
||||
# [browser]
|
||||
# binding = "BROWSER"
|
||||
|
||||
# Service Bindings (intra-account Workers RPC)
|
||||
# https://developers.cloudflare.com/workers/wrangler/configuration/#service-bindings
|
||||
# [[services]]
|
||||
# binding = "MY_SERVICE"
|
||||
# service = "my-service"
|
||||
# environment = "production" # optional
|
||||
|
||||
# Dispatch Namespaces (advanced routing to multiple services)
|
||||
# https://developers.cloudflare.com/workers/learning/service-dispatch/
|
||||
# [[dispatch_namespaces]]
|
||||
# binding = "DISPATCH"
|
||||
# namespace = "my-namespace"
|
||||
|
||||
# Tail Consumers (forward tail logs to another Worker)
|
||||
# https://developers.cloudflare.com/workers/platform/tail-workers/
|
||||
# [[tail_consumers]]
|
||||
# service = "log-sink"
|
||||
# environment = "production"
|
||||
|
||||
# mTLS Certificates for outbound requests (Client Certs)
|
||||
# https://developers.cloudflare.com/workers/runtime-apis/mtls/
|
||||
# [[mtls_certificates]]
|
||||
# binding = "CLIENT_CERT"
|
||||
# certificate_id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
|
||||
# AI (Workers AI binding)
|
||||
# https://developers.cloudflare.com/workers-ai/
|
||||
# [ai]
|
||||
# binding = "AI"
|
||||
|
||||
# Per-Environment Overrides
|
||||
# Any top-level key can be nested under [env.<name>] to override for that env.
|
||||
# Example: production overrides.
|
||||
# [env.production]
|
||||
# route = "api.example.com/*"
|
||||
# vars = { NODE_ENV = "production" }
|
||||
# [env.production.kv_namespaces]
|
||||
# # env-scoped tables must be re-declared within env blocks as needed.
|
||||
|
||||
# Notes:
|
||||
# • Secrets are managed via `wrangler secret` and never stored here.
|
||||
# • Avoid enabling flags you don’t need. Test changes behind environments.
|
||||
# • When using routes, ensure the zone is in the same account as `account_id`.
|
||||
# • Prefer Modules syntax for new Workers.
|
||||
Reference in New Issue
Block a user