mirror of
https://github.com/NohamR/AM-Exporter.git
synced 2026-05-24 19:58:34 +00:00
push
This commit is contained in:
13
back/Dockerfile
Normal file
13
back/Dockerfile
Normal file
@@ -0,0 +1,13 @@
|
||||
FROM python:3.10-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
EXPOSE 3005
|
||||
|
||||
RUN pip install gunicorn
|
||||
|
||||
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:3005", "--chdir", "/app", "app:app"]
|
||||
1
back/requirements.txt
Normal file
1
back/requirements.txt
Normal file
@@ -0,0 +1 @@
|
||||
Flask==3.0.2
|
||||
30
back/server.py
Normal file
30
back/server.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from flask import Flask, request, jsonify
|
||||
from flask_cors import CORS
|
||||
import json
|
||||
|
||||
app = Flask(__name__)
|
||||
CORS(app, resources={r"/music/*": {"origins": "http://*"}})
|
||||
|
||||
with open('.users', 'r') as file:
|
||||
users = json.load(file)
|
||||
|
||||
print(users)
|
||||
|
||||
@app.route('/music/set', methods=['POST'])
|
||||
def set_content():
|
||||
global cache
|
||||
cache = request.get_json()
|
||||
if cache['user'] in users and users[cache['user']] == cache['password']:
|
||||
for key in ['user', 'password']:
|
||||
if key in cache:
|
||||
del cache[key]
|
||||
return jsonify({'message': 'Content set successfully.'})
|
||||
else:
|
||||
return jsonify({'message': 'Invalid user or password.'})
|
||||
|
||||
@app.route('/music/get', methods=['GET'])
|
||||
def display_content():
|
||||
return jsonify(cache)
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True)
|
||||
63
back/server.yaml
Normal file
63
back/server.yaml
Normal file
@@ -0,0 +1,63 @@
|
||||
name: applemusicexporter
|
||||
services:
|
||||
app:
|
||||
cpu_shares: 90
|
||||
command: []
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 7943M
|
||||
environment:
|
||||
- PGID=1000
|
||||
- PUID=1000
|
||||
- TZ=Europe/Paris
|
||||
image: applemusicexporter
|
||||
labels:
|
||||
icon: https://noh.am/static/assets/music.png
|
||||
ports:
|
||||
- target: 3005
|
||||
published: "3005"
|
||||
protocol: tcp
|
||||
restart: unless-stopped
|
||||
# volumes:
|
||||
# - type: bind
|
||||
# source: /DATA/AppData/applemusicexporter
|
||||
# target: /hard
|
||||
x-casaos:
|
||||
envs:
|
||||
- container: PUID
|
||||
description:
|
||||
en_us: for UserID
|
||||
- container: PGID
|
||||
description:
|
||||
en_us: for GroupID
|
||||
- container: TZ
|
||||
description:
|
||||
en_us: specify a timezone to use, see this list.
|
||||
devices: []
|
||||
cap_add: []
|
||||
networks:
|
||||
- default
|
||||
privileged: false
|
||||
container_name: ""
|
||||
networks:
|
||||
default:
|
||||
name: applemusicexporter
|
||||
x-casaos:
|
||||
architectures:
|
||||
- amd64
|
||||
- arm64
|
||||
author: self
|
||||
category: self
|
||||
hostname: ""
|
||||
icon: https://noh.am/static/assets/music.png
|
||||
index: /
|
||||
main: app
|
||||
port_map: "3005"
|
||||
scheme: http
|
||||
store_app_id: applemusicexporter
|
||||
tagline:
|
||||
en_us: applemusicexporter
|
||||
title:
|
||||
custom: applemusicexporter
|
||||
en_us: applemusicexporter
|
||||
Reference in New Issue
Block a user