mirror of
https://github.com/HeyPuter/puter.git
synced 2026-02-14 18:49:01 -06:00
clean: remove logs (obvious cases)
This commit removes debug logs that meet these criteria: - used console.log instead of the log service - were left in the source tree accidentally - show up at boot or during stat/readdir operations This is not a comprehensrve removal; this is a first pass to get a few of the trivial cases.
This commit is contained in:
@@ -22,5 +22,5 @@ extension.get('/example-onefile-get', (req, res) => {
|
||||
});
|
||||
|
||||
extension.on('install', ({ services }) => {
|
||||
console.log('install was called');
|
||||
// console.log('install was called');
|
||||
})
|
||||
|
||||
@@ -22,5 +22,5 @@ extension.get('/example-mod-get', (req, res) => {
|
||||
});
|
||||
|
||||
extension.on('install', ({ services }) => {
|
||||
console.log('install was called');
|
||||
// console.log('install was called');
|
||||
})
|
||||
|
||||
@@ -43,7 +43,6 @@ async function is_empty(dir_uuid){
|
||||
|
||||
if ( typeof dir_uuid === 'object' ) {
|
||||
if ( typeof dir_uuid.path === 'string' && dir_uuid.path !== '' ) {
|
||||
console.log('it is the path branch');
|
||||
rows = await db.read(
|
||||
`SELECT EXISTS(SELECT 1 FROM fsentries WHERE path LIKE ${db.case({
|
||||
sqlite: `? || '%'`,
|
||||
@@ -55,7 +54,6 @@ async function is_empty(dir_uuid){
|
||||
}
|
||||
|
||||
if ( typeof dir_uuid === 'string' ) {
|
||||
console.log('it is the uuid branchj');
|
||||
rows = await db.read(
|
||||
`SELECT EXISTS(SELECT 1 FROM fsentries WHERE parent_uid = ? LIMIT 1) AS not_empty`,
|
||||
[dir_uuid]
|
||||
|
||||
@@ -31,27 +31,12 @@ const CaptchaService = require('./services/CaptchaService');
|
||||
*/
|
||||
class CaptchaModule extends AdvancedBase {
|
||||
async install(context) {
|
||||
console.log('DIAGNOSTIC: CaptchaModule.install - Start of method');
|
||||
|
||||
// Get services from context
|
||||
const services = context.get('services');
|
||||
if (!services) {
|
||||
throw new Error('Services not available in context');
|
||||
}
|
||||
|
||||
// Register the captcha service
|
||||
console.log('DIAGNOSTIC: CaptchaModule.install - Before service registration');
|
||||
services.registerService('captcha', CaptchaService);
|
||||
console.log('DIAGNOSTIC: CaptchaModule.install - After service registration');
|
||||
|
||||
// Log the captcha service status
|
||||
try {
|
||||
const captchaService = services.get('captcha');
|
||||
console.log(`Captcha service registered and ${captchaService.enabled ? 'enabled' : 'disabled'}`);
|
||||
console.log('TOKENS_TRACKING: Retrieved CaptchaService instance with ID:', captchaService.serviceId);
|
||||
} catch (error) {
|
||||
console.error('Failed to get captcha service after registration:', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,8 +34,6 @@ class CaptchaService extends BaseService {
|
||||
* Initializes the captcha service with configuration and storage
|
||||
*/
|
||||
async _construct() {
|
||||
console.log('DIAGNOSTIC: CaptchaService._construct called');
|
||||
|
||||
// Load dependencies
|
||||
this.crypto = require('crypto');
|
||||
this.svgCaptcha = require('svg-captcha');
|
||||
@@ -47,22 +45,12 @@ class CaptchaService extends BaseService {
|
||||
this.serviceId = Math.random().toString(36).substring(2, 10);
|
||||
this.requestCounter = 0;
|
||||
|
||||
console.log('TOKENS_TRACKING: CaptchaService instance created with ID:', this.serviceId);
|
||||
console.log('TOKENS_TRACKING: Process ID:', process.pid);
|
||||
|
||||
// Get configuration from service config
|
||||
this.enabled = this.config.enabled === true;
|
||||
this.expirationTime = this.config.expirationTime || (10 * 60 * 1000); // 10 minutes default
|
||||
this.difficulty = this.config.difficulty || 'medium';
|
||||
this.testMode = this.config.testMode === true;
|
||||
|
||||
console.log('CAPTCHA DIAGNOSTIC: Service initialized with config:', {
|
||||
enabled: this.enabled,
|
||||
expirationTime: this.expirationTime,
|
||||
difficulty: this.difficulty,
|
||||
testMode: this.testMode
|
||||
});
|
||||
|
||||
// Add a static test token for diagnostic purposes
|
||||
this.captchaTokens.set('test-static-token', {
|
||||
text: 'testanswer',
|
||||
@@ -82,8 +70,6 @@ class CaptchaService extends BaseService {
|
||||
* Sets up API endpoints and cleanup tasks
|
||||
*/
|
||||
async _init() {
|
||||
console.log('TOKENS_TRACKING: CaptchaService._init called. Service ID:', this.serviceId);
|
||||
|
||||
if (!this.enabled) {
|
||||
this.log.info('Captcha service is disabled');
|
||||
return;
|
||||
@@ -298,9 +284,6 @@ class CaptchaService extends BaseService {
|
||||
// Test endpoint to validate token lifecycle
|
||||
app.get('/api/captcha/test-lifecycle', (req, res) => {
|
||||
try {
|
||||
console.log('TOKENS_TRACKING: Running token lifecycle test. Service ID:', this.serviceId);
|
||||
console.log('TOKENS_TRACKING: Initial token count:', this.captchaTokens.size);
|
||||
|
||||
// Create a test captcha
|
||||
const testText = 'test123';
|
||||
const testToken = 'lifecycle-' + this.crypto.randomBytes(16).toString('hex');
|
||||
@@ -311,19 +294,12 @@ class CaptchaService extends BaseService {
|
||||
expiresAt: Date.now() + this.expirationTime
|
||||
});
|
||||
|
||||
console.log('TOKENS_TRACKING: Test token stored. New token count:', this.captchaTokens.size);
|
||||
|
||||
// Verify the token exists
|
||||
const tokenExists = this.captchaTokens.has(testToken);
|
||||
console.log('TOKENS_TRACKING: Test token exists in map:', tokenExists);
|
||||
|
||||
// Try to verify with correct answer
|
||||
const correctVerification = this.verifyCaptcha(testToken, testText);
|
||||
console.log('TOKENS_TRACKING: Verification with correct answer result:', correctVerification);
|
||||
|
||||
// Check if token was deleted after verification
|
||||
const tokenAfterVerification = this.captchaTokens.has(testToken);
|
||||
console.log('TOKENS_TRACKING: Token exists after verification:', tokenAfterVerification);
|
||||
|
||||
// Create another test token
|
||||
const testToken2 = 'lifecycle2-' + this.crypto.randomBytes(16).toString('hex');
|
||||
@@ -334,8 +310,6 @@ class CaptchaService extends BaseService {
|
||||
expiresAt: Date.now() + this.expirationTime
|
||||
});
|
||||
|
||||
console.log('TOKENS_TRACKING: Second test token stored. Token count:', this.captchaTokens.size);
|
||||
|
||||
res.json({
|
||||
message: 'Token lifecycle test completed',
|
||||
serviceId: this.serviceId,
|
||||
|
||||
@@ -55,7 +55,6 @@ class TogetherAIService extends BaseService {
|
||||
this.kvkey = this.modules.uuidv4();
|
||||
|
||||
const svc_aiChat = this.services.get('ai-chat');
|
||||
console.log('registering provider', this.service_name);
|
||||
svc_aiChat.register_provider({
|
||||
service_name: this.service_name,
|
||||
alias: true,
|
||||
|
||||
@@ -54,7 +54,6 @@ class ValidationES extends BaseES {
|
||||
? await (await extra.old_entity.clone()).apply(entity)
|
||||
: entity
|
||||
;
|
||||
console.log('VALID ENT', valid_entity)
|
||||
await this.validate_(
|
||||
valid_entity,
|
||||
extra.old_entity ? entity : undefined
|
||||
|
||||
@@ -46,7 +46,6 @@ module.exports = {
|
||||
return value.toLowerCase();
|
||||
},
|
||||
async validate (value) {
|
||||
console.log('VALIDATIOB IS RUN', config.reserved_words, value);
|
||||
if ( config.reserved_words.includes(value) ) {
|
||||
return APIError.create('subdomain_reserved', null, {
|
||||
subdomain: value,
|
||||
|
||||
@@ -179,7 +179,6 @@ module.exports = {
|
||||
if ( ! value ) return null;
|
||||
if ( value instanceof Entity ) return value;
|
||||
const svc = Context.get().get('services').get(descriptor.service);
|
||||
console.log('VALUE BEING READ', value);
|
||||
const entity = await svc.read(value);
|
||||
return entity;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,6 @@ module.exports = async (req, res) => {
|
||||
// and adding them to the retobj array
|
||||
result.recent = [];
|
||||
for ( const { app_uid: uid } of apps ) {
|
||||
console.log('\x1B[36;1m -------- UID -------- \x1B[0m', uid);
|
||||
const app = await get_app({ uid });
|
||||
if ( ! app ) continue
|
||||
|
||||
|
||||
@@ -67,7 +67,6 @@ class HostDiskUsageService extends BaseService {
|
||||
// TODO: Implement for windows systems
|
||||
}
|
||||
|
||||
console.log('free_space:', free_space);
|
||||
config.available_device_storage = free_space;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,6 @@ const { Readable } = require("stream");
|
||||
|
||||
class MemoryStorageService extends BaseService {
|
||||
async _init () {
|
||||
console.log('MemoryStorageService._init');
|
||||
|
||||
const svc_mountpoint = this.services.get('mountpoint');
|
||||
svc_mountpoint.set_storage(MemoryFSProvider.name, this);
|
||||
}
|
||||
|
||||
@@ -100,7 +100,6 @@ class StreamReducer {
|
||||
class EWMA extends StreamReducer {
|
||||
constructor ({ initial, alpha }) {
|
||||
super(initial ?? 0);
|
||||
console.log('VALL', this.value)
|
||||
this.alpha = Getter.adapt(alpha);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user