mirror of
https://github.com/xtr-dev/rondevu-server.git
synced 2025-12-10 02:43:24 +00:00
fix: use Web Crypto API for Cloudflare Workers compatibility
- d1.ts: Use global crypto.randomUUID() instead of importing from 'crypto' - sqlite.ts: Use 'node:crypto' import for Node.js compatibility This fixes the Cloudflare Workers deployment error: "The package 'crypto' wasn't found on the file system but is built into node" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@xtr-dev/rondevu-server",
|
"name": "@xtr-dev/rondevu-server",
|
||||||
"version": "0.2.1",
|
"version": "0.2.2",
|
||||||
"description": "DNS-like WebRTC signaling server with username claiming and service discovery",
|
"description": "DNS-like WebRTC signaling server with username claiming and service discovery",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { randomUUID } from 'crypto';
|
// Use Web Crypto API (available globally in Cloudflare Workers)
|
||||||
import {
|
import {
|
||||||
Storage,
|
Storage,
|
||||||
Offer,
|
Offer,
|
||||||
@@ -402,8 +402,8 @@ export class D1Storage implements Storage {
|
|||||||
service: Service;
|
service: Service;
|
||||||
indexUuid: string;
|
indexUuid: string;
|
||||||
}> {
|
}> {
|
||||||
const serviceId = randomUUID();
|
const serviceId = crypto.randomUUID();
|
||||||
const indexUuid = randomUUID();
|
const indexUuid = crypto.randomUUID();
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
|
|
||||||
// Insert service
|
// Insert service
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import Database from 'better-sqlite3';
|
import Database from 'better-sqlite3';
|
||||||
import { randomUUID } from 'crypto';
|
import { randomUUID } from 'node:crypto';
|
||||||
import {
|
import {
|
||||||
Storage,
|
Storage,
|
||||||
Offer,
|
Offer,
|
||||||
|
|||||||
Reference in New Issue
Block a user