TheBug95 commited on
Commit
6cc9a99
·
1 Parent(s): 0377502

Remove image protection and beforeunload to fix page jumping

Browse files
Files changed (1) hide show
  1. interface/main.py +1 -22
interface/main.py CHANGED
@@ -15,7 +15,6 @@ from components.gallery import render_gallery
15
  from components.labeler import render_labeler
16
  from components.recorder import render_recorder
17
  from components.downloader import render_downloader
18
- from components.image_protection import inject_image_protection
19
  from services.auth_service import require_auth, do_logout
20
 
21
  # ── PAGE CONFIG ──────────────────────────────────────────────────────────────
@@ -28,9 +27,6 @@ st.set_page_config(
28
  if not require_auth():
29
  st.stop()
30
 
31
- # ── IMAGE PROTECTION (prevent download / right-click save) ───────────────────
32
- inject_image_protection()
33
-
34
  # ── UI LANGUAGE (initialize before anything renders) ─────────────────────────
35
  if "ui_language" not in st.session_state:
36
  st.session_state.ui_language = DEFAULT_LANGUAGE
@@ -248,24 +244,7 @@ with st.sidebar:
248
  # ── LOAD WHISPER MODEL ───────────────────────────────────────────────────────
249
  with st.spinner(t("loading_whisper", model=selected_model)):
250
  model = load_whisper_model(selected_model)
251
- # ── BROWSER CLOSE GUARD (beforeunload) ───────────────────────────────────
252
- # Warn the user when they try to close/reload the tab with data in session.
253
- # Uses st.html() — wrapper is hidden by the protection CSS.
254
- if sm.has_undownloaded_data() and not st.session_state.get("session_downloaded", False):
255
- st.html(
256
- """<script>
257
- (function(){
258
- var doc;
259
- try { doc = window.parent.document; } catch(e) { return; }
260
- if (doc.__beforeunload_set__) return;
261
- doc.__beforeunload_set__ = true;
262
- window.parent.addEventListener('beforeunload', function(e) {
263
- e.preventDefault();
264
- e.returnValue = '';
265
- });
266
- })();
267
- </script>"""
268
- )
269
  # ── MAIN CONTENT ─────────────────────────────────────────────────────────────
270
  st.title(f"{config.APP_ICON} {config.APP_TITLE}")
271
  st.caption(t("app_subtitle"))
 
15
  from components.labeler import render_labeler
16
  from components.recorder import render_recorder
17
  from components.downloader import render_downloader
 
18
  from services.auth_service import require_auth, do_logout
19
 
20
  # ── PAGE CONFIG ──────────────────────────────────────────────────────────────
 
27
  if not require_auth():
28
  st.stop()
29
 
 
 
 
30
  # ── UI LANGUAGE (initialize before anything renders) ─────────────────────────
31
  if "ui_language" not in st.session_state:
32
  st.session_state.ui_language = DEFAULT_LANGUAGE
 
244
  # ── LOAD WHISPER MODEL ───────────────────────────────────────────────────────
245
  with st.spinner(t("loading_whisper", model=selected_model)):
246
  model = load_whisper_model(selected_model)
247
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  # ── MAIN CONTENT ─────────────────────────────────────────────────────────────
249
  st.title(f"{config.APP_ICON} {config.APP_TITLE}")
250
  st.caption(t("app_subtitle"))