Skip to content

Commit

Permalink
Merge pull request #80 from Thorfusion/dev
Browse files Browse the repository at this point in the history
Update to 1.4.0
  • Loading branch information
maggi373 authored Aug 10, 2024
2 parents 8a15caa + bfbec83 commit 0aef104
Show file tree
Hide file tree
Showing 12 changed files with 737 additions and 648 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/deploy_docker_dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Docker Image CI

on:
push:
branches:
- dev

jobs:
push_to_registry:
name: push docker image to hub
runs-on: ubuntu-latest
steps:
- name: check repository
uses: actions/checkout@v4

- name: login to docker registry
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_TOKEN}}

- name: build and push docker image to registry
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: thorfusion/solderpy:dev
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: Docker Image CI

on:
push:
branches: [ "main" ]
branches:
- main
schedule:
- cron: '0 12 * * 2'

Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/deploy_docker_tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Docker Image CI

on:
push:
tags:
- 1.*

jobs:
push_to_registry:
name: push docker image to hub
runs-on: ubuntu-latest
steps:
- name: check repository
uses: actions/checkout@v4

- name: login to docker registry
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_TOKEN}}

- name: build and push docker image to registry
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: thorfusion/solderpy:${{ github.ref_name }}
36 changes: 36 additions & 0 deletions alogin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from flask import Blueprint, redirect, render_template, request, session, url_for

from models.session import Session
from models.user import User

alogin = Blueprint("alogin", __name__)

@alogin.route("/login", methods=["GET"])
def login_page():
if "key" in session and Session.verify_session(session["token"], request.remote_addr):
# Already logged in
return redirect(url_for('asite.index'))

return render_template("login.html", failed=False)


@alogin.route("/login", methods=["POST"])
def login():
if "key" in session and Session.verify_session(session["token"], request.remote_addr):
# Already logged in
print("already logged in")
return redirect(url_for('asite.index'))

user = User.get_by_username(request.form["username"])
if user is None:
print("login failed")
return render_template("login.html", failed=True)
else:
if user.verify_password(request.form["password"]):
# if new_user:
# return render_template("login.html", failed=True)
session["token"] = Session.new_session(request.remote_addr)
print("login success")
return redirect(url_for('asite.index'))
else:
return render_template("login.html", failed=True)
9 changes: 2 additions & 7 deletions api.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
import os

from dotenv import load_dotenv
from flask import Blueprint, jsonify, request
from models.key import Key
from models.mod import Mod
from models.modpack import Modpack
from models.globals import solderpy_version, mirror_url

api = Blueprint("api", __name__)

load_dotenv(".env")
mirror_url = os.getenv("SOLDER_MIRROR_URL")


@api.route("/api/")
def api_info():
return jsonify({"api": "solder.py", "version": "v1.3.4", "stream": "DEV"})
return jsonify({"api": "solder.py", "version": "v" + solderpy_version, "stream": "DEV"})


@api.route("/api/verify")
Expand Down
Loading

0 comments on commit 0aef104

Please sign in to comment.