Skip to content

Commit

Permalink
misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
westsurname committed Jul 21, 2024
1 parent 9c19979 commit 1eee01d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
12 changes: 6 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,13 @@ services:
volumes:
- ./shared/tokens.json:/app/shared/tokens.json
ports:
- 8000:8000
- 8010:8000
env_file:
- .env
environment:
- SERVER_DOMAIN=${SERVER_DOMAIN}:8000
# environment:
# - SERVER_DOMAIN=${SERVER_DOMAIN}:8010
restart: unless-stopped
profiles: [plex_authentication, all]
profiles: [plex_authentication, watchlist, plex_request, all]

plex_request:
build:
Expand All @@ -178,7 +178,7 @@ services:
volumes:
- ./shared/tokens.json:/app/shared/tokens.json
ports:
- 8001:8000
- 8011:8000
env_file:
- .env
restart: unless-stopped
Expand All @@ -194,7 +194,7 @@ services:
volumes:
- ${PLEX_REQUEST_SSL_PATH:-/dev/null}:${PLEX_REQUEST_SSL_PATH:-/dev/null}:ro
ports:
- 8002:8000
- 8012:8000
env_file:
- .env
restart: unless-stopped
Expand Down
10 changes: 8 additions & 2 deletions plex_authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
from shared.plex import getServerToken
from werkzeug.serving import run_simple
from werkzeug.middleware.dispatcher import DispatcherMiddleware
from werkzeug.middleware.proxy_fix import ProxyFix

host = server['host']

# instantiate the app
app = Flask(__name__)
app.config.from_object(__name__)
app.config['SERVER_NAME'] = f"{host}"
# app.config['SERVER_NAME'] = f"{host}"


@app.route('/', methods=['GET'])
Expand Down Expand Up @@ -42,9 +43,13 @@ def setupComplete(pin):

with open(tokensFilename, 'r+') as tokensFile:
tokens = json.load(tokensFile)
token = tokens.get(user['id'], { 'etag': '' })
token = tokens.get(userId, { 'etag': '' })
token['token'] = authToken
token['serverToken'] = serverToken

if serverToken == authToken:
token['owner'] = True

tokens[userId] = token
tokensFile.seek(0)
json.dump(tokens, tokensFile)
Expand All @@ -55,6 +60,7 @@ def setupComplete(pin):
return jsonify('There was an error, please try again.')

# app.wsgi_app = DispatcherMiddleware(run_simple, {'/plexAuthentication': app.wsgi_app})
app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1, x_host=1, x_port=1, x_prefix=1)

if __name__ == '__main__':
app.run('127.0.0.1', 12598)
1 change: 1 addition & 0 deletions plex_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ def requestRatingKey(mediaType, mediaTypeNum, ratingKey, season=None):
# return response

# response = jsonify(json.loads(blankMediaContainer))
response = Response('', status=204)
response.headers.add('Access-Control-Allow-Origin', 'https://app.plex.tv')

return response
Expand Down

0 comments on commit 1eee01d

Please sign in to comment.