Fix Tailwind CSS styling configuration

- Add tailwind.config.ts with proper content paths and theme config
- Add postcss.config.js for Tailwind and autoprefixer processing
- Downgrade tailwindcss to v3.4.17 and add missing PostCSS dependencies
- Update Dockerfile to clarify build process
- Fix UI styling issues in Docker environment
This commit is contained in:
mindesbunister
2025-07-12 23:29:42 +02:00
parent cf58d41444
commit a9bbcc7b5f
22 changed files with 3833 additions and 1020 deletions

View File

@@ -10,18 +10,29 @@ export interface ScreenshotConfig {
}
export class EnhancedScreenshotService {
private static readonly OPERATION_TIMEOUT = 120000 // 2 minutes timeout
async captureWithLogin(config: ScreenshotConfig): Promise<string[]> {
const screenshotFiles: string[] = []
try {
// Ensure screenshots directory exists
const screenshotsDir = path.join(process.cwd(), 'screenshots')
await fs.mkdir(screenshotsDir, { recursive: true })
console.log('Initializing TradingView automation for Docker container...')
return new Promise(async (resolve, reject) => {
// Set overall timeout for the operation
const timeoutId = setTimeout(() => {
reject(new Error('Screenshot capture operation timed out after 2 minutes'))
}, EnhancedScreenshotService.OPERATION_TIMEOUT)
// Initialize automation with Docker-optimized settings
await tradingViewAutomation.init()
try {
// Ensure screenshots directory exists
const screenshotsDir = path.join(process.cwd(), 'screenshots')
await fs.mkdir(screenshotsDir, { recursive: true })
console.log('Initializing TradingView automation for Docker container...')
// Ensure browser is healthy before operations
await tradingViewAutomation.ensureBrowserReady()
// Initialize automation with Docker-optimized settings
await tradingViewAutomation.init()
// Check if already logged in using session persistence
const alreadyLoggedIn = await tradingViewAutomation.isLoggedIn()
@@ -29,21 +40,27 @@ export class EnhancedScreenshotService {
if (!alreadyLoggedIn) {
console.log('No active session found...')
// Try to use session persistence first to avoid captcha
// Try to use enhanced session persistence first to avoid captcha
const sessionTest = await tradingViewAutomation.testSessionPersistence()
console.log('📊 Current session info:', sessionTest)
if (sessionTest.isValid) {
console.log('✅ Valid session found - avoiding captcha!')
if (sessionTest.isValid && sessionTest.cookiesCount > 0) {
console.log('✅ Saved session data found')
console.log(`🍪 Cookies: ${sessionTest.cookiesCount}`)
console.log(`💾 Storage: ${sessionTest.hasStorage ? 'Yes' : 'No'}`)
} else {
console.log('⚠️ No valid session - manual login may be required')
console.log('💡 Using smart login to handle captcha scenario...')
// Use smart login which prioritizes session persistence
const loginSuccess = await tradingViewAutomation.smartLogin(config.credentials)
if (!loginSuccess) {
throw new Error('Smart login failed - manual intervention may be required')
}
console.log('⚠️ Session data exists but appears to be expired')
}
// Always try smart login which handles session validation and human-like behavior
console.log('⚠️ No valid session - manual login may be required')
console.log('💡 Using smart login to handle captcha scenario...')
// Use smart login which prioritizes session persistence and anti-detection
const loginSuccess = await tradingViewAutomation.smartLogin(config.credentials)
if (!loginSuccess) {
throw new Error('Smart login failed - manual intervention may be required')
}
} else {
console.log('✅ Already logged in using saved session')
@@ -90,15 +107,17 @@ export class EnhancedScreenshotService {
}
console.log(`Successfully captured ${screenshotFiles.length} screenshot(s)`)
return screenshotFiles
clearTimeout(timeoutId)
resolve(screenshotFiles)
} catch (error) {
console.error('Enhanced screenshot capture failed:', error)
throw error
} finally {
// Always cleanup
await tradingViewAutomation.close()
clearTimeout(timeoutId)
reject(error)
}
// Note: Don't close browser here - keep it alive for subsequent operations
})
}
async captureQuick(symbol: string, timeframe: string, credentials: TradingViewCredentials): Promise<string | null> {
@@ -208,6 +227,13 @@ export class EnhancedScreenshotService {
throw error
}
}
/**
* Cleanup browser resources (can be called when shutting down the application)
*/
async cleanup(): Promise<void> {
await tradingViewAutomation.close()
}
}
export const enhancedScreenshotService = new EnhancedScreenshotService()

File diff suppressed because it is too large Load Diff

View File

@@ -196,7 +196,10 @@ export class TradingViewCapture {
if (emailButton.asElement()) {
console.log('Found email login button, clicking...')
await emailButton.asElement()?.click()
const elementHandle = emailButton.asElement() as any
if (elementHandle) {
await elementHandle.click()
}
await new Promise(res => setTimeout(res, 2000))
await this.debugScreenshot('login_04b_after_email_button', page)
@@ -233,7 +236,7 @@ export class TradingViewCapture {
const text = btn.textContent?.toLowerCase() || ''
return text.includes('sign in') || text.includes('login') || text.includes('submit')
})
}).then(handle => handle.asElement())
}).then(handle => handle.asElement()) as any
}
if (!signInButton) {