updating gitignore
This commit is contained in:
6
.env
6
.env
@@ -1,6 +0,0 @@
|
||||
VITE_FIREBASE_API_KEY=AIzaSyC_hZf9TpIIb4H7y7umUeYtFKD-guN_iR0
|
||||
VITE_FIREBASE_AUTH_DOMAIN=map-jurnal.firebaseapp.com
|
||||
VITE_FIREBASE_PROJECT_ID=map-jurnal
|
||||
VITE_FIREBASE_STORAGE_BUCKET=map-jurnal.firebasestorage.app
|
||||
VITE_FIREBASE_MESSAGING_SENDER_ID=922587077950
|
||||
VITE_FIREBASE_APP_ID=1:922587077950:web:9f140f84468e306152606f
|
||||
@@ -1,7 +0,0 @@
|
||||
[
|
||||
{
|
||||
"origin": ["http://localhost:5173", "https://map-jurnal.web.app", "https://map-jurnal.firebaseapp.com"],
|
||||
"method": ["GET", "HEAD", "PUT", "POST", "DELETE"],
|
||||
"maxAgeSeconds": 3600
|
||||
}
|
||||
]
|
||||
@@ -1,11 +0,0 @@
|
||||
import { getAccessToken } from 'firebase-tools';
|
||||
import { writeFileSync } from 'fs';
|
||||
(async () => {
|
||||
try {
|
||||
const token = await getAccessToken();
|
||||
writeFileSync('token.txt', token);
|
||||
console.log('Token saved');
|
||||
} catch (e) {
|
||||
console.error('Failed:', e.message);
|
||||
}
|
||||
})();
|
||||
@@ -1,36 +0,0 @@
|
||||
import { readFileSync } from 'fs';
|
||||
|
||||
const config = JSON.parse(readFileSync(
|
||||
'C:\\Users\\tomas\\.config\\configstore\\firebase-tools.json', 'utf-8'
|
||||
));
|
||||
const token = config.tokens.access_token;
|
||||
|
||||
// Try to list buckets first
|
||||
const listRes = await fetch('https://storage.googleapis.com/storage/v1/b?project=map-jurnal', {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
const buckets = await listRes.json();
|
||||
console.log('Buckets:', buckets.items?.map(b => b.name) ?? buckets);
|
||||
|
||||
const bucket = 'map-jurnal.appspot.com';
|
||||
const corsConfig = [{
|
||||
origin: ['http://localhost:5173', 'https://map-jurnal.web.app', 'https://map-jurnal.firebaseapp.com'],
|
||||
method: ['GET', 'HEAD', 'PUT', 'POST', 'DELETE'],
|
||||
maxAgeSeconds: 3600,
|
||||
}];
|
||||
|
||||
const res = await fetch(`https://storage.googleapis.com/storage/v1/b/${bucket}`, {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ cors: corsConfig }),
|
||||
});
|
||||
|
||||
if (res.ok) {
|
||||
console.log('CORS configured successfully!');
|
||||
} else {
|
||||
const text = await res.text();
|
||||
console.error('Failed:', res.status, text);
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
import { readFileSync } from 'fs';
|
||||
import { Storage } from '@google-cloud/storage';
|
||||
|
||||
const config = JSON.parse(readFileSync('C:/Users/tomas/.config/configstore/firebase-tools.json', 'utf-8'));
|
||||
|
||||
const storage = new Storage({
|
||||
projectId: 'map-jurnal',
|
||||
credentials: {
|
||||
client_email: 'firebase-cli@map-jurnal.iam.gserviceaccount.com',
|
||||
// We'll use token-based auth instead
|
||||
},
|
||||
});
|
||||
|
||||
// Try with direct token
|
||||
const token = config.tokens.access_token;
|
||||
|
||||
// List all buckets to find the right name
|
||||
const [buckets] = await storage.getBuckets({ project: 'map-jurnal' });
|
||||
console.log('Buckets:', buckets.map(b => b.name));
|
||||
|
||||
if (buckets.length > 0) {
|
||||
const bucket = buckets[0];
|
||||
console.log('Configuring CORS for:', bucket.name);
|
||||
await bucket.setCorsConfiguration([
|
||||
{
|
||||
origin: ['http://localhost:5173', 'https://map-jurnal.web.app', 'https://map-jurnal.firebaseapp.com'],
|
||||
method: ['GET', 'HEAD', 'PUT', 'POST', 'DELETE'],
|
||||
maxAgeSeconds: 3600,
|
||||
},
|
||||
]);
|
||||
console.log('CORS configured!');
|
||||
}
|
||||
Reference in New Issue
Block a user