mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 22:06:05 +01:00
bug fix: screen shots
This commit is contained in:
@@ -152,32 +152,15 @@ class WebsiteManager:
|
|||||||
|
|
||||||
if ACLManager.checkOwnership(WPDelete.owner.domain, admin, currentACL) == 1:
|
if ACLManager.checkOwnership(WPDelete.owner.domain, admin, currentACL) == 1:
|
||||||
WPDelete.delete()
|
WPDelete.delete()
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
sites = []
|
sites = []
|
||||||
for site in data['wp']:
|
for site in data['wp']:
|
||||||
screenshot_path = f'/home/{site.owner.domain}/public_html/wp-content/cyberpanel-screenshots/{site.id}.png'
|
|
||||||
|
|
||||||
if not os.path.exists(screenshot_path) or (time.time() - os.path.getmtime(screenshot_path)) > 86400:
|
|
||||||
# Generate screenshot if it doesn't exist or is older than 24 hours
|
|
||||||
try:
|
|
||||||
screenshot_dir = os.path.dirname(screenshot_path)
|
|
||||||
if not os.path.exists(screenshot_dir):
|
|
||||||
ProcessUtilities.executioner(f'mkdir -p {screenshot_dir}')
|
|
||||||
|
|
||||||
command = f'wkhtmltoimage --quality 80 --width 800 {site.FinalURL} {screenshot_path}'
|
|
||||||
ProcessUtilities.executioner(command)
|
|
||||||
ProcessUtilities.executioner(f'chown {site.owner.externalApp}:{site.owner.externalApp} {screenshot_path}')
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
sites.append({
|
sites.append({
|
||||||
'id': site.id,
|
'id': site.id,
|
||||||
'title': site.title,
|
'title': site.title,
|
||||||
'url': site.FinalURL,
|
'url': site.FinalURL,
|
||||||
'screenshot': f'/wp-content/cyberpanel-screenshots/{site.id}.png' if os.path.exists(screenshot_path) else None,
|
|
||||||
'production_status': True
|
'production_status': True
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user