~johanvandegriff/games.johanv.xyz

56868d8a29174487dc2e2ae368b4905ee614d3e3 — Johan Vandegriff 6 months ago 666c614
added full trace to error print, viewport on upload page
2 files changed, 16 insertions(+), 4 deletions(-)

M boggle.py
M templates/boggle/lobby.html
M boggle.py => boggle.py +15 -3
@@ 1,5 1,5 @@
from flask import render_template
import sys, cgi, json, datetime, re, time, decimal, subprocess, random, threading, os, pymongo
import sys, cgi, json, datetime, re, time, decimal, subprocess, random, threading, os, pymongo, traceback
from functools import reduce

from nav import nav #file in same dir


@@ 561,8 561,11 @@ def request_data(form, files):
                    lettersGuessed, confidence = processImage(destination)
                    message += "; " + lettersGuessed
                    message += "; " + str(confidence)
                except BoggleError as e:
                    message += "; " + str(e)
                except Exception as e:
                    message += "; " + str(e) + "; " + repr(e) + "; " + traceback.format_exc()
                with open(destination+".txt", "w") as f:
                    print("Message saved to to:", destination+".txt")
                    f.write(message)
            else:
                message = "File type not supported, please use .png, .jpg, .jpeg, or .gif"
        else:


@@ 888,11 891,20 @@ def load_page(form, page=None, id=None):
    
    if page == "upload":
        return """
        <!DOCTYPE html><html lang="en">
        <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=2.0">
        </head>
        <body>
        <form method="POST" enctype="multipart/form-data" action="">
            <input type="hidden" name="request" value="upload">
            <input type="file" name="upload" accept="image/*"/>
            <br/><br/>
            <input type="submit" value="Upload">
        </form>
        </body>
        </html>
        """

    if page == "lobby":

M templates/boggle/lobby.html => templates/boggle/lobby.html +1 -1
@@ 74,7 74,7 @@
    <div class="rightCol">
        <h2 class="scale">Video Call</h2>
        <p><a target="_blank" href="https://drive.confuzer.cloud/index.php/call/wscgqe9r">Join the video chat!</a></p>
        <p><a href="?username={{ username}}&page=upload">process an image with BoggleCV</a></p>
        <p><a href="?username={{ username}}&page=upload">process an image with BoggleCV (beta)</a></p>
        <h2 class="scale" style="margin-bottom: 1em">Current Games</h2>

        <div v-for="game in games" class="grayBox" v-cloak>