Skip to content

Commit

Permalink
Merge pull request #6 from asimonson1125/main
Browse files Browse the repository at this point in the history
Structural integrity updates + popping content
  • Loading branch information
esoccoli authored Oct 29, 2022
2 parents c33af97 + 3f830cb commit d4e8b95
Show file tree
Hide file tree
Showing 11 changed files with 423 additions and 240 deletions.
40 changes: 36 additions & 4 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,28 @@
games = [
{
"title":"Flappy Meatball",
"id":"flappy-meatball",
"desc":"Flappy Bird is a mobile game developed by Vietnamese video game artist and programmer Dong Nguyen, under his game development company .Gears. The game is a side-scroller where the player controls a bird, attempting to fly between columns of green pipes without hitting them. Nguyen created the game over the period of several days, using a bird protagonist that he had designed for a cancelled game in 2012.",
"author":"andrewe",

}, {
"title":"Brickbreaker",
"id":"brickbreakder",
"desc":"Brick Breaker is a video game, which was developed by Ali Asaria,[1] that came preloaded on the BlackBerry and is now available on App Store (iOS). ",
"author":"ella"
} ,{
"title":"Pong",
"id":"pong",
"desc":"Pong is a table tennis–themed twitch arcade sports video game, featuring simple two-dimensional graphics, manufactured by Atari and originally released in 1972. It was one of the earliest arcade video games; it was created by Allan Alcorn as a training exercise assigned to him by Atari co-founder Nolan Bushnell, but Bushnell and Atari co-founder Ted Dabney were surprised by the quality of Alcorn's work and decided to manufacture the game. Bushnell based the game's concept on an electronic ping-pong game included in the Magnavox Odyssey, the first home video game console. In response, Magnavox later sued Atari for patent infringement. ",
"author":"lyons"
},{
"title":"Spacewar!",
"id":"spacewar",
"desc":"Spacewar! is a space combat video game developed in 1962 by Steve Russell in collaboration with Martin Graetz, Wayne Wiitanen, Bob Saunders, Steve Piner, and others. It was written for the newly installed DEC PDP-1 minicomputer at the Massachusetts Institute of Technology. After its initial creation, Spacewar! was expanded further by other students and employees of universities in the area, including Dan Edwards and Peter Samson. It was also spread to many of the few dozen installations of the PDP-1 computer, making Spacewar! the first known video game to be played at multiple computer installations. ",
"author":"mcdade"
},{
"title":"Minecraft",
"id":"minecraft",
"desc":"Minecraft is a sandbox video game developed by Mojang Studios. The game was created by Markus 'Notch' Persson in the Java programming language. Following several early private testing versions, it was first made public in May 2009 before being fully released in November 2011, with Notch stepping down and Jens 'Jeb' Bergensten taking over development. Minecraft has since been ported to several other platforms and is the best-selling video game of all time, with over 238 million copies sold and nearly 140 million monthly active players as of 2021. ",
"author":"notch"
}
Expand Down Expand Up @@ -67,20 +72,37 @@ def aboutpage():
def catalogpage():
return flask.render_template('catalog.html', gamelist=games)

@app.route('/user/<uname>')
def userprofile(uname):
return flask.render_template('profile.html', savelist=saves[uname])
@app.route('/user')
def user():
if not current_user.is_authenticated:
return flask.redirect('/login')
return flask.render_template('profile.html', savelist=saves[current_user.id])

@app.route('/game/<id>')
def getgame(id):
for i in range(len(games)):
if games[i]['id'] == id:
break
else:
flask.render_template('404.html')
return flask.render_template('game.html', game=i, gamelist=games)

@app.route('/upload_game', methods = ['POST'])
@login_required
def uploadgame():
if flask.request.method == 'POST':
f = flask.request.files['file']
f.save(secure_filename(f.filename))
return '', 204

@app.route('/upload')
@login_required
def uploadpage():
return flask.render_template('upload.html', title='Devcade - Upload', gamelist=games)
usergames = []
for i in games:
if i['author'] == current_user.id:
usergames.append(i)
return flask.render_template('upload.html', title='Devcade - Upload', gamelist=usergames)

def upload(file, key):

Expand All @@ -89,5 +111,15 @@ def upload(file, key):
bucket.upload_file(Filename=file,
Key=key)

@app.errorhandler(Exception)
def page404(e):
eCode = 500
message = "An unknown error occured!"
try:
message = e.description
eCode = e.code
finally:
return flask.render_template('error.html', error=eCode, message=message)

if __name__ == '__main__':
app.run(host='localhost', debug=True)
Loading

0 comments on commit d4e8b95

Please sign in to comment.