Compare commits

..

7 Commits

Author SHA1 Message Date
Oscar Krause
8aff954829 Merge branch 'python-josepy' into 'main'
Migrate from "python-jose" to an alternative

See merge request oscar.krause/fastapi-dls!52
2025-07-07 07:52:12 +02:00
Oscar Krause
c7186f46a1 Merge branch 'main' into python-josepy
# Conflicts:
#	requirements.txt
2025-07-07 07:51:46 +02:00
Oscar Krause
3314d6b95e fixed mr conflict 2025-07-07 07:40:24 +02:00
Oscar Krause
0c5368b863 styling 2025-07-04 10:12:26 +02:00
Oscar Krause
5c54f5171f styling 2025-07-04 10:12:07 +02:00
Oscar Krause
2afd3a4eb3 requirements.txt updated 2025-07-03 09:03:53 +02:00
Oscar Krause
b5e186a58e added vgpu 18.3 2025-07-03 08:55:00 +02:00
3 changed files with 38 additions and 15 deletions

View File

@ -9,8 +9,8 @@ Minimal Delegated License Service (DLS).
> Other combinations of FastAPI-DLS and Driver-Branches may work but are not tested. > Other combinations of FastAPI-DLS and Driver-Branches may work but are not tested.
> [!note] Compatibility > [!note] Compatibility
> Compatibility tested with official NLS 2.0.1, 2.1.0, 3.1.0, 3.3.1, 3.4.0. For Driver compatibility > Compatibility tested with official NLS 2.0.1, 2.1.0, 3.1.0, 3.3.1, 3.4.0. **For Driver compatibility
> see [compatibility matrix](#vgpu-software-compatibility-matrix). > see [compatibility matrix](#vgpu-software-compatibility-matrix)**.
This service can be used without internet connection. This service can be used without internet connection.
Only the clients need a connection to this service on configured port. Only the clients need a connection to this service on configured port.
@ -880,15 +880,14 @@ The error message can safely be ignored (since we have no license limitation :P)
# vGPU Software Compatibility Matrix # vGPU Software Compatibility Matrix
<details> <details>
<summary>Show Table</summary> <summary>Successfully tested with this package versions: Show Table</summary>
Successfully tested with this package versions.
| FastAPI-DLS Version | vGPU Suftware | Driver Branch | Linux vGPU Manager | Linux Driver | Windows Driver | Release Date | EOL Date | | FastAPI-DLS Version | vGPU Suftware | Driver Branch | Linux vGPU Manager | Linux Driver | Windows Driver | Release Date | EOL Date |
|---------------------|:-------------:|:-------------:|--------------------|--------------|----------------|--------------:|--------------:| |---------------------|:-------------:|:-------------:|--------------------|--------------|----------------|--------------:|--------------:|
| `2.x` | `18.2` | **R570** | `570.148.06` | `570.148.08` | `573.07` | May 2025 | March 2026 | | `2.x` | `18.3` | **R570** | `570.158.02` | `570.158.01` | `573.36` | June 2025 | March 2026 |
| | `18.1` | **R570** | `570.133.08` | `570.133.07` | `572.83` | April 2025 | March 2026 | | | `18.2` | **R570** | `570.148.06` | `570.148.08` | `573.07` | May 2025 | |
| | `18.0` | **R570** | `570.124.03` | `570.124.06` | `572.60` | March 2025 | March 2026 | | | `18.1` | **R570** | `570.133.08` | `570.133.07` | `572.83` | April 2025 | |
| | `18.0` | **R570** | `570.124.03` | `570.124.06` | `572.60` | March 2025 | |
| `1.x` & `2.x` | `17.6` | **R550** | `550.163.02` | `550.63.01` | `553.74` | April 2025 | June 2025 | | `1.x` & `2.x` | `17.6` | **R550** | `550.163.02` | `550.63.01` | `553.74` | April 2025 | June 2025 |
| | `17.5` | | `550.144.02` | `550.144.03` | `553.62` | January 2025 | | | | `17.5` | | `550.144.02` | `550.144.03` | `553.62` | January 2025 | |
| | `17.4` | | `550.127.06` | `550.127.05` | `553.24` | October 2024 | | | | `17.4` | | `550.127.06` | `550.127.05` | `553.24` | October 2024 | |

View File

@ -5,8 +5,8 @@ from contextlib import asynccontextmanager
from datetime import datetime, timedelta, UTC from datetime import datetime, timedelta, UTC
from hashlib import sha256 from hashlib import sha256
from json import loads as json_loads, dumps as json_dumps from json import loads as json_loads, dumps as json_dumps
from os import getenv as env from os import getenv as env, listdir
from os.path import join, dirname from os.path import join, dirname, isfile, isdir, exists
from textwrap import wrap from textwrap import wrap
from uuid import uuid4 from uuid import uuid4
@ -14,6 +14,7 @@ from dateutil.relativedelta import relativedelta
from dotenv import load_dotenv from dotenv import load_dotenv
from fastapi import FastAPI from fastapi import FastAPI
from fastapi.requests import Request from fastapi.requests import Request
from fastapi.staticfiles import StaticFiles
from fastapi.responses import Response, RedirectResponse, StreamingResponse from fastapi.responses import Response, RedirectResponse, StreamingResponse
import jwt import jwt
from sqlalchemy import create_engine from sqlalchemy import create_engine
@ -49,6 +50,7 @@ LEASE_RENEWAL_PERIOD = float(env('LEASE_RENEWAL_PERIOD', 0.15))
LEASE_RENEWAL_DELTA = timedelta(days=int(env('LEASE_EXPIRE_DAYS', 90)), hours=int(env('LEASE_EXPIRE_HOURS', 0))) LEASE_RENEWAL_DELTA = timedelta(days=int(env('LEASE_EXPIRE_DAYS', 90)), hours=int(env('LEASE_EXPIRE_HOURS', 0)))
CLIENT_TOKEN_EXPIRE_DELTA = relativedelta(years=12) CLIENT_TOKEN_EXPIRE_DELTA = relativedelta(years=12)
CORS_ORIGINS = str(env('CORS_ORIGINS', '')).split(',') if (env('CORS_ORIGINS')) else [f'https://{DLS_URL}'] CORS_ORIGINS = str(env('CORS_ORIGINS', '')).split(',') if (env('CORS_ORIGINS')) else [f'https://{DLS_URL}']
DRIVERS_DIR = env('DRIVERS_DIR', None)
DT_FORMAT = '%Y-%m-%dT%H:%M:%S.%fZ' DT_FORMAT = '%Y-%m-%dT%H:%M:%S.%fZ'
PRODUCT_MAPPING = ProductMapping(filename=join(dirname(__file__), 'static/product_mapping.json')) PRODUCT_MAPPING = ProductMapping(filename=join(dirname(__file__), 'static/product_mapping.json'))
@ -99,6 +101,9 @@ async def lifespan(_: FastAPI):
config = dict(openapi_url=None, docs_url=None, redoc_url=None) # dict(openapi_url='/-/openapi.json', docs_url='/-/docs', redoc_url='/-/redoc') config = dict(openapi_url=None, docs_url=None, redoc_url=None) # dict(openapi_url='/-/openapi.json', docs_url='/-/docs', redoc_url='/-/redoc')
app = FastAPI(title='FastAPI-DLS', description='Minimal Delegated License Service (DLS).', version=VERSION, lifespan=lifespan, **config) app = FastAPI(title='FastAPI-DLS', description='Minimal Delegated License Service (DLS).', version=VERSION, lifespan=lifespan, **config)
if DRIVERS_DIR is not None:
app.mount('/-/static-drivers', StaticFiles(directory=str(DRIVERS_DIR), html=False), name='drivers')
app.debug = DEBUG app.debug = DEBUG
app.add_middleware( app.add_middleware(
CORSMiddleware, CORSMiddleware,
@ -207,6 +212,25 @@ async def _manage(request: Request):
return Response(response, media_type='text/html', status_code=200) return Response(response, media_type='text/html', status_code=200)
@app.get('/-/drivers/{directory:path}', summary='* List drivers directory')
async def _drivers(request: Request, directory: str | None):
if DRIVERS_DIR is None:
return Response(status_code=404, content=f'Variable "DRIVERS_DIR" not set.')
path = join(DRIVERS_DIR, directory)
if not exists(path) and not isfile(path):
return Response(status_code=404, content=f'Resource "{path}" not found!')
content = [{
"type": "file" if isfile(f'{path}/{_}') else "folder" if isdir(f'{path}/{_}') else "unknown",
"name": _,
"link": f'/-/static-drivers/{directory}{_}',
} for _ in listdir(path)]
return Response(content=json_dumps({"directory": path, "content": content}), media_type='application/json', status_code=200)
@app.get('/-/origins', summary='* Origins') @app.get('/-/origins', summary='* Origins')
async def _origins(request: Request, leases: bool = False): async def _origins(request: Request, leases: bool = False):
session = sessionmaker(bind=db)() session = sessionmaker(bind=db)()

View File

@ -1,8 +1,8 @@
fastapi==0.115.12 fastapi==0.115.14
uvicorn[standard]==0.34.2 uvicorn[standard]==0.35.0
pyjwt==2.10.1 pyjwt==2.10.1
cryptography==44.0.3 cryptography==45.0.5
python-dateutil==2.9.0 python-dateutil==2.9.0
sqlalchemy==2.0.41 sqlalchemy==2.0.41
markdown==3.8 markdown==3.8.2
python-dotenv==1.1.0 python-dotenv==1.1.1