Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
lucky12651 committed Nov 22, 2023
1 parent d5841db commit 9c20baf
Show file tree
Hide file tree
Showing 34 changed files with 21,023 additions and 20,896 deletions.
Binary file added .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Welcome to 8Bit Online Compiler, a simple and user-friendly web-based compiler t

## Demo

Check out the live demo of the 8Bit Online Compiler [here](https://compiler81.netlify.app).
Check out the live demo of the 8Bit Online Compiler [here](https://myuniqueflaskapp.azurewebsites.net/).

## Future Enhancements

Expand Down
39 changes: 39 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
from flask import Flask, render_template, request, jsonify
import subprocess
from flask_socketio import SocketIO, join_room, leave_room, emit, os


app = Flask(__name__)
app.config['SECRET_KEY'] = os.urandom(5)
socketio = SocketIO(app)

# A set to store active users
active_users = set()

@app.route('/')
def index():
Expand Down Expand Up @@ -183,6 +190,38 @@ def compile_and_execute_java(code, input_data):
@app.route('/login')
def login():
return render_template('login.html')
@app.route('/admin')
def admin():
return render_template('admin.html')


@socketio.on('connect')
def on_connect():
# Add the current user's ID to the active_users set
active_users.add(request.sid)
emit('update_users', list(active_users), broadcast=True)

@socketio.on('disconnect')
def on_disconnect():
# Remove the current user's ID from the active_users set
active_users.discard(request.sid)
emit('update_users', list(active_users), broadcast=True)







@app.route('/signup')
def signup():
return render_template('signup.html')
@app.route('/restricted')
def restricted():
return render_template('restricted.html')
@app.errorhandler(404)
def page_not_found(error):
return render_template('404.html'), 404

# Add more routes and view functions for other HTML pages as needed

Expand Down
15 changes: 15 additions & 0 deletions h.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@app.route('/c')
def c():
return render_template('c.html')

@app.route('/cpp')
def cpp():
return render_template('cpp.html')

@app.route('/java')
def java():
return render_template('java.html')

@app.route('/login')
def login():
return render_template('login.html')
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Flask==2.3.2
flask-socketio==6.1.1
Binary file added static/.DS_Store
Binary file not shown.
Loading

0 comments on commit 9c20baf

Please sign in to comment.