v0.04: fix hamburger menu position + clear stale Roundcube cookie
- Hamburger menu: calculate explicit QPoint position (right-aligned below toolbar) instead of relying on Qt overflow logic with bottomRight() anchor. sizeHint() used for width with 360px fallback. - Roundcube login: clear mail.jgitta.com session cookie from Chrome's SQLite Cookies DB on every startup so autologin always fires cleanly instead of showing 'session is invalid or expired'.
This commit is contained in:
+26
-5
@@ -5,7 +5,7 @@ Navigation: ◀ ▶ ⌂ icon buttons + ☰ hamburger menu for bookmarks.
|
|||||||
Chrome is controlled via Chrome DevTools Protocol (CDP) over WebSocket.
|
Chrome is controlled via Chrome DevTools Protocol (CDP) over WebSocket.
|
||||||
"""
|
"""
|
||||||
import sys, json, os, subprocess, time, threading, urllib.request
|
import sys, json, os, subprocess, time, threading, urllib.request
|
||||||
from PyQt5.QtCore import Qt, QTimer
|
from PyQt5.QtCore import Qt, QTimer, QPoint
|
||||||
from PyQt5.QtGui import QFont, QColor, QPalette
|
from PyQt5.QtGui import QFont, QColor, QPalette
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QApplication, QWidget, QHBoxLayout, QVBoxLayout,
|
QApplication, QWidget, QHBoxLayout, QVBoxLayout,
|
||||||
@@ -418,10 +418,14 @@ class KioskOverlay(QWidget):
|
|||||||
mgr_act = QAction(" ⚙ Manage Bookmarks…", menu)
|
mgr_act = QAction(" ⚙ Manage Bookmarks…", menu)
|
||||||
mgr_act.triggered.connect(self.open_manager)
|
mgr_act.triggered.connect(self.open_manager)
|
||||||
menu.addAction(mgr_act)
|
menu.addAction(mgr_act)
|
||||||
# Show menu below the hamburger button, anchored to right edge so
|
# Explicitly position menu just below the toolbar, right-aligned.
|
||||||
# Qt's overflow logic flips it leftward (avoids clipping off-screen).
|
# sizeHint() gives the menu's preferred width before it is painted;
|
||||||
menu.exec_(self.burger_btn.mapToGlobal(
|
# fall back to 360px if it hasn't been computed yet.
|
||||||
self.burger_btn.rect().bottomRight()))
|
mw = menu.sizeHint().width()
|
||||||
|
if mw < 100:
|
||||||
|
mw = 360
|
||||||
|
x = max(0, SCREEN_W - mw - 6)
|
||||||
|
menu.exec_(QPoint(x, TOOLBAR_H))
|
||||||
|
|
||||||
def _build_menu(self, items):
|
def _build_menu(self, items):
|
||||||
menu = QMenu()
|
menu = QMenu()
|
||||||
@@ -496,6 +500,23 @@ def launch_chrome():
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# Clear the stale Roundcube session cookie so the autologin plugin always
|
||||||
|
# fires cleanly. Without this, Chrome sends the old cookie after a reboot,
|
||||||
|
# the PHP session in MariaDB has expired, and Roundcube shows
|
||||||
|
# "session is invalid or expired" instead of auto-logging in.
|
||||||
|
cookies_db = profile_dir / "Default" / "Cookies"
|
||||||
|
if cookies_db.exists():
|
||||||
|
try:
|
||||||
|
import sqlite3
|
||||||
|
conn = sqlite3.connect(str(cookies_db))
|
||||||
|
conn.execute(
|
||||||
|
"DELETE FROM cookies WHERE host_key LIKE '%mail.jgitta.com%'")
|
||||||
|
conn.commit()
|
||||||
|
conn.close()
|
||||||
|
print("Cleared stale Roundcube session cookie")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Cookie clear warning: {e}")
|
||||||
|
|
||||||
chrome_h = SCREEN_H - TOP_H
|
chrome_h = SCREEN_H - TOP_H
|
||||||
cmd = [
|
cmd = [
|
||||||
"google-chrome",
|
"google-chrome",
|
||||||
|
|||||||
Reference in New Issue
Block a user