tester343 commited on
Commit
dce2b01
·
verified ·
1 Parent(s): c64b10f

Update app_enhanced.py

Browse files
Files changed (1) hide show
  1. app_enhanced.py +8 -3
app_enhanced.py CHANGED
@@ -60,7 +60,8 @@ except Exception as e:
60
 
61
  # --- FLASK APP SETUP ---
62
  app = Flask(__name__)
63
- app.secret_key = "REPLACE_THIS_WITH_A_SECRET_KEY_IN_PRODUCTION"
 
64
  BASE_USER_DIR = "userdata"
65
 
66
  # --- MERGED HTML: UPLOAD UI + EDITOR UI ---
@@ -173,7 +174,7 @@ INDEX_HTML = '''
173
  .speech-bubble.selected { outline: 2px dashed #4CAF50; }
174
  .speech-bubble textarea { position: absolute; top: 0; left: 0; width: 100%; height: 100%; box-sizing: border-box; border: 1px solid #4CAF50; background: rgba(255,255,255,0.95); font: inherit; text-align: center; resize: none; padding: 8px; z-index: 102; }
175
 
176
- /* --- SPEECH BUBBLE CSS (EXPORT SAFE - GRADIENT METHOD) --- */
177
  .speech-bubble.speech {
178
  --b: 3em; --h: 1.8em; --t: 0.6; --p: var(--tail-pos, 50%); --r: 1.2em;
179
  --c: var(--bubble-fill-color, #4ECDC4);
@@ -1009,7 +1010,11 @@ def index():
1009
 
1010
  @app.route('/uploader', methods=['POST'])
1011
  def upload_file():
1012
- if 'sid' not in session: return jsonify({'success': False, 'message': 'Session expired'}), 400
 
 
 
 
1013
  try:
1014
  f = request.files['file']
1015
  gen = EnhancedComicGenerator(session['sid'])
 
60
 
61
  # --- FLASK APP SETUP ---
62
  app = Flask(__name__)
63
+ # Constant secret key ensures sessions survive server restarts if browser keeps cookie
64
+ app.secret_key = "SUPER_SECRET_COMIC_KEY_123"
65
  BASE_USER_DIR = "userdata"
66
 
67
  # --- MERGED HTML: UPLOAD UI + EDITOR UI ---
 
174
  .speech-bubble.selected { outline: 2px dashed #4CAF50; }
175
  .speech-bubble textarea { position: absolute; top: 0; left: 0; width: 100%; height: 100%; box-sizing: border-box; border: 1px solid #4CAF50; background: rgba(255,255,255,0.95); font: inherit; text-align: center; resize: none; padding: 8px; z-index: 102; }
176
 
177
+ /* <<< SPEECH BUBBLE CSS (EXPORT SAFE - GRADIENT METHOD) >>> */
178
  .speech-bubble.speech {
179
  --b: 3em; --h: 1.8em; --t: 0.6; --p: var(--tail-pos, 50%); --r: 1.2em;
180
  --c: var(--bubble-fill-color, #4ECDC4);
 
1010
 
1011
  @app.route('/uploader', methods=['POST'])
1012
  def upload_file():
1013
+ # FIX: Auto-create session if missing due to restart
1014
+ if 'sid' not in session:
1015
+ session['sid'] = uuid.uuid4().hex
1016
+ print(f"⚠️ Session recreated: {session['sid']}")
1017
+
1018
  try:
1019
  f = request.files['file']
1020
  gen = EnhancedComicGenerator(session['sid'])