format mjs files

pull/112/head
Sven Sauleau 2023-01-16 16:49:33 +00:00
rodzic 44ecb1f8e4
commit 9020109736
3 zmienionych plików z 12 dodań i 35 usunięć

Wyświetl plik

@ -34,32 +34,9 @@ To activate **_Images_**, please login into your account, select **_Images_** on
![images subscription](https://imagedelivery.net/NkfPDviynOyTAOI79ar_GQ/fd07dede-a883-4372-b0cf-3afb6b2ab400/public)
### API token
Before we begin, you also need to create an API token in your Cloudflare account. To do that, [login](https://dash.cloudflare.com/) into your account, and press the **_Create Token_** button under **_My Profile (top right corner) / API Tokens_**.
![create token](https://imagedelivery.net/NkfPDviynOyTAOI79ar_GQ/589e9e1b-5c50-4269-f039-3414454c4a00/public)
Now press **_Create Custom Token_** and add the following permissions:
- D1, account level, edit permission.
- Cloudflare Pages, account level, edit permission.
- Access: Apps and policies, account level, edit permission.
- Access: Organizations, Identity Providers and Groups, account level, read permission.
- Workers KV Storage, account level, edit permission.
- DNS, zone level, edit permission.
- Cloudflare Images, account level, edit permission.
- Workers Scripts, account level, edit permission.
![token permissions](https://imagedelivery.net/NkfPDviynOyTAOI79ar_GQ/c60327db-b651-4655-6c98-0f4e8c652600/public)
You can limit the token to the specific zone where you will using Wildebeest if you want. Don't set a TTL.
Now **_Continue to Summary_**, review your settings, and **_Create Token_**. Take note of your token and store it in your password manager, you're going to need it later.
### Zone and Account IDs
You also need to take note of your Zone and Account IDs. To find them, [login](https://dash.cloudflare.com/) into your account and select the zone (domain) where you plan to use Wildebeest. Then, on the **_Overview_** page you will the following information:
You need to take note of your Zone and Account IDs. To find them, [login](https://dash.cloudflare.com/) into your account and select the zone (domain) where you plan to use Wildebeest. Then, on the **_Overview_** page you will the following information:
![zone and account IDs](https://imagedelivery.net/NkfPDviynOyTAOI79ar_GQ/f595d8b7-6ce9-4ef7-7416-253efd012800/w=306)

Wyświetl plik

@ -1,14 +1,14 @@
import console from 'console';
import { dirname, resolve } from 'path';
import process from 'process';
import { fileURLToPath } from 'url';
import console from 'console'
import { dirname, resolve } from 'path'
import process from 'process'
import { fileURLToPath } from 'url'
import { unstable_dev } from 'wrangler'
const __dirname = dirname(fileURLToPath(import.meta.url));
const __dirname = dirname(fileURLToPath(import.meta.url))
/**
* A simple utility to run a Cloudflare Worker that will populate a local D1 database with mock data.
*
*
* Uses Wrangler's `unstable_dev()` helper to execute the Worker and exit cleanly;
* this is much harder to do with the command line Wrangler binary.
*/
@ -21,8 +21,8 @@ async function main() {
tsconfig: resolve(__dirname, '../../tsconfig.json'),
define: ['jest:{}'],
}
const workerPath = resolve(__dirname, "./worker.ts");
const worker = await unstable_dev(workerPath, {...options, experimental: {disableExperimentalWarning: true }})
const workerPath = resolve(__dirname, './worker.ts')
const worker = await unstable_dev(workerPath, { ...options, experimental: { disableExperimentalWarning: true } })
await worker.fetch()
await worker.stop()
}

Wyświetl plik

@ -1,6 +1,6 @@
import { webcrypto } from 'node:crypto'
const key = await webcrypto.subtle.generateKey({ name: "ECDSA", namedCurve: "P-256" }, true, ["sign", "verify"]);
const serverKey = await webcrypto.subtle.exportKey("jwk", key.privateKey);
const key = await webcrypto.subtle.generateKey({ name: 'ECDSA', namedCurve: 'P-256' }, true, ['sign', 'verify'])
const serverKey = await webcrypto.subtle.exportKey('jwk', key.privateKey)
console.log(JSON.stringify(serverKey));
console.log(JSON.stringify(serverKey))