managarten/uload/scripts/test-url-variants.js
Till-JS c712a2504a feat: integrate uload and picture, unify package naming
- Add uload project with apps/web structure
  - Reorganize from flat to monorepo structure
  - Remove PocketBase binary and local data
  - Update to pnpm and @uload/web namespace

- Add picture project to monorepo
  - Remove embedded git repository

- Unify all package names to @{project}/{app} schema:
  - @maerchenzauber/* (was @storyteller/*)
  - @manacore/* (was manacore-*, manacore)
  - @manadeck/* (was web, backend, manadeck)
  - @memoro/* (was memoro-web, landing, memoro)
  - @picture/* (already unified)
  - @uload/web

- Add convenient dev scripts for all apps:
  - pnpm dev:{project}:web
  - pnpm dev:{project}:landing
  - pnpm dev:{project}:mobile
  - pnpm dev:{project}:backend

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 04:00:36 +01:00

76 lines
2 KiB
JavaScript

import PocketBase from 'pocketbase';
// Test verschiedene URL-Varianten
const urls = [
'http://pocketbase-xs0ccokk8s0goko4w40gwc0w.91.99.221.179.sslip.io', // ohne trailing slash
'http://pocketbase-xs0ccokk8s0goko4w40gwc0w.91.99.221.179.sslip.io/' // mit trailing slash
];
console.log('Testing different URL configurations...\n');
async function testUrl(url) {
console.log(`Testing: ${url}`);
console.log('-'.repeat(60));
try {
const pb = new PocketBase(url);
// Test 1: Health check
const healthUrl = `${url}/api/health`;
const healthResponse = await fetch(healthUrl);
console.log(`✓ Health check status: ${healthResponse.status}`);
// Test 2: Registration
const testEmail = `test${Date.now()}@example.com`;
const testUsername = `user${Date.now()}`;
const userData = {
email: testEmail,
password: 'TestPass123!',
passwordConfirm: 'TestPass123!',
username: testUsername,
name: 'Test User',
emailVisibility: true
};
console.log(` Attempting registration with: ${testEmail}`);
try {
const result = await pb.collection('users').create(userData);
console.log(`✓ Registration successful! User ID: ${result.id}`);
// Clean up
try {
await pb.collection('users').delete(result.id);
console.log('✓ Test user cleaned up');
} catch (e) {
console.log('⚠ Could not clean up test user');
}
} catch (err) {
console.error(`✗ Registration failed: ${err.message}`);
if (err.response?.data) {
console.error(' Error details:', JSON.stringify(err.response.data, null, 2));
}
}
console.log('✓ URL configuration works!\n');
return true;
} catch (error) {
console.error(`✗ URL configuration failed: ${error.message}\n`);
return false;
}
}
// Test all URLs
async function testAll() {
for (const url of urls) {
const success = await testUrl(url);
if (success) {
console.log(`\n🎉 WORKING URL: ${url}`);
console.log('Use this exact URL in your environment variables (without quotes)');
break;
}
}
}
testAll();