refactor: clean up comments and unused code in various files

This commit is contained in:
bobbert committed 2026-04-14 19:05:22 +01:00
1 parent 9b20804f5a
commit bb6bd0f4b3
28 files changed
+14 -392

No files matched your search

-22
View File
@@ -1,21 +1,3 @@
// Google Photos Picker API Test
//
// Usage:
// node TEST/testGooglePhotosAPI.js <ACCESS_TOKEN>
// GOOGLE_ACCESS_TOKEN=ya29.xxx node TEST/testGooglePhotosAPI.js
//
// The token must have been granted the scope:
// https://www.googleapis.com/auth/photospicker.mediaitems.readonly
//
// Getting a token from OAuth Playground (https://developers.google.com/oauthplayground):
// 1. Click the gear icon → check "Use your own OAuth credentials"
// 2. Enter your Client ID and Client Secret from Google Cloud Console
// 3. In "Input your own scopes" enter:
// https://www.googleapis.com/auth/photospicker.mediaitems.readonly
// 4. Click "Authorize APIs" and sign in with your test Google account
// 5. Click "Exchange authorization code for tokens"
// 6. Copy the Access token (starts with ya29.) and pass it here
const PICKER_BASE = 'https://photospicker.googleapis.com/v1';
const USERINFO_URL = 'https://www.googleapis.com/oauth2/v2/userinfo';
@@ -37,7 +19,6 @@ async function main() {
console.log('\n--- Google Photos Picker API Test ---\n');
// Test 1 — User info
console.log('[1] Fetching user info...');
try {
const res = await fetch(USERINFO_URL, { headers });
@@ -51,7 +32,6 @@ async function main() {
console.log(` Failed: ${err.message}\n`);
}
// Test 2 — Create Picker session
console.log('[2] Creating Picker session...');
let sessionId = null;
try {
@@ -68,7 +48,6 @@ async function main() {
console.log(` Session created: ${sessionId}`);
console.log(` mediaItemsSet: ${session.mediaItemsSet}\n`);
// Wait for session to be ready
if (!session.mediaItemsSet) {
console.log(' Waiting for session to become ready...');
for (let i = 0; i < 10; i++) {
@@ -87,7 +66,6 @@ async function main() {
console.log(` Failed: ${err.message}\n`);
}
// Test 3 — List media items from session
if (sessionId) {
console.log('[3] Fetching media items from session...');
try {
-25
View File
@@ -1,31 +1,9 @@
/**
* NAS Backend API Test
*
* Usage:
* node TEST/testNASAPI.js
*
* Environment variables:
* BACKEND_URL (default http://localhost:3001)
* NAS_HOST e.g. 192.168.1.100
* NAS_PORT default 22
* NAS_USER SSH username
* NAS_PASS SSH password
* NAS_FOLDER default /home/user/photos
*
* Tests:
* 1. Backend health check
* 2. SFTP connect
* 3. List directory
* 4. Disconnect
*/
const BACKEND_URL = process.env.BACKEND_URL || 'http://localhost:3001';
async function main() {
console.log('\n--- NAS Backend API Test ---');
console.log(`Backend: ${BACKEND_URL}\n`);
// 1 — Health check
console.log('[1] Health check...');
try {
const res = await fetch(`${BACKEND_URL}/api/health`);
@@ -50,7 +28,6 @@ async function main() {
return;
}
// 2 — Connect
let connectionToken = null;
console.log(`[2] SFTP connect to ${host}:${port}...`);
try {
@@ -74,7 +51,6 @@ async function main() {
Authorization: `Bearer ${connectionToken}`,
};
// 3 — List directory
console.log(`[3] List directory "${folder}"...`);
try {
const res = await fetch(`${BACKEND_URL}/api/sftp/list`, {
@@ -93,7 +69,6 @@ async function main() {
console.log(` Failed: ${err.message}\n`);
}
// 4 — Disconnect
console.log('[4] Disconnect...');
try {
const res = await fetch(`${BACKEND_URL}/api/sftp/disconnect`, {