Spaces:
Paused
Paused
Download scripts/fix-visibility.js from veltrixcode/retest: direct link, hf CLI and curl.
- Browser
- Download file 1.7 kB
-
https://huggingface.co/spaces/veltrixcode/retest/resolve/main/scripts/fix-visibility.js
- Command line
-
hf download hf://spaces/veltrixcode/retest/scripts/fix-visibility.js
-
curl -L -o fix-visibility.js https://huggingface.co/spaces/veltrixcode/retest/resolve/main/scripts/fix-visibility.js
1.7 kB
| const fs = require('fs'); | |
| const path = require('path'); | |
| // Load .env manually | |
| try { | |
| const envPath = path.resolve(__dirname, '../.env'); | |
| if (fs.existsSync(envPath)) { | |
| const envConfig = fs.readFileSync(envPath, 'utf8'); | |
| envConfig.split('\n').forEach(line => { | |
| line = line.trim(); | |
| if (!line || line.startsWith('#')) return; | |
| const [key, ...valueParts] = line.split('='); | |
| if (key && valueParts.length > 0) { | |
| let value = valueParts.join('=').trim(); | |
| if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) { | |
| value = value.slice(1, -1); | |
| } | |
| if (!process.env[key.trim()]) { | |
| process.env[key.trim()] = value; | |
| } | |
| } | |
| }); | |
| console.log("Loaded .env file"); | |
| } | |
| } catch (e) { | |
| console.warn("Could not load .env file:", e.message); | |
| } | |
| const { PrismaClient } = require('@prisma/client'); | |
| const prisma = new PrismaClient(); | |
| async function main() { | |
| console.log("🔍 Starting Visibility Fix..."); | |
| try { | |
| const result = await prisma.generation.updateMany({ | |
| where: { | |
| isPublic: false | |
| }, | |
| data: { | |
| isPublic: true | |
| } | |
| }); | |
| console.log(`✅ Updated ${result.count} generations to be public.`); | |
| } catch (error) { | |
| console.error("❌ Error updating visibility:", error); | |
| } | |
| } | |
| main() | |
| .catch(e => { | |
| console.error(e); | |
| process.exit(1); | |
| }) | |
| .finally(async () => { | |
| await prisma.$disconnect(); | |
| }); | |