refac
Deploy to HuggingFace Spaces / check-secret (push) Waiting to run
Details
Deploy to HuggingFace Spaces / deploy (push) Blocked by required conditions
Details
Create and publish Docker images with specific build args / build-main-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Details
Create and publish Docker images with specific build args / build-main-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Details
Create and publish Docker images with specific build args / build-cuda-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Details
Create and publish Docker images with specific build args / build-cuda-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Details
Create and publish Docker images with specific build args / build-cuda126-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Details
Create and publish Docker images with specific build args / build-cuda126-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Details
Create and publish Docker images with specific build args / build-ollama-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Details
Create and publish Docker images with specific build args / build-ollama-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Details
Create and publish Docker images with specific build args / merge-main-images (push) Blocked by required conditions
Details
Create and publish Docker images with specific build args / merge-cuda-images (push) Blocked by required conditions
Details
Create and publish Docker images with specific build args / merge-cuda126-images (push) Blocked by required conditions
Details
Create and publish Docker images with specific build args / merge-ollama-images (push) Blocked by required conditions
Details
Python CI / Format Backend (3.11.x) (push) Waiting to run
Details
Python CI / Format Backend (3.12.x) (push) Waiting to run
Details
Frontend Build / Format & Build Frontend (push) Waiting to run
Details
Frontend Build / Frontend Unit Tests (push) Waiting to run
Details
Deploy to HuggingFace Spaces / check-secret (push) Waiting to run
Details
Deploy to HuggingFace Spaces / deploy (push) Blocked by required conditions
Details
Create and publish Docker images with specific build args / build-main-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Details
Create and publish Docker images with specific build args / build-main-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Details
Create and publish Docker images with specific build args / build-cuda-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Details
Create and publish Docker images with specific build args / build-cuda-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Details
Create and publish Docker images with specific build args / build-cuda126-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Details
Create and publish Docker images with specific build args / build-cuda126-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Details
Create and publish Docker images with specific build args / build-ollama-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Details
Create and publish Docker images with specific build args / build-ollama-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Details
Create and publish Docker images with specific build args / merge-main-images (push) Blocked by required conditions
Details
Create and publish Docker images with specific build args / merge-cuda-images (push) Blocked by required conditions
Details
Create and publish Docker images with specific build args / merge-cuda126-images (push) Blocked by required conditions
Details
Create and publish Docker images with specific build args / merge-ollama-images (push) Blocked by required conditions
Details
Python CI / Format Backend (3.11.x) (push) Waiting to run
Details
Python CI / Format Backend (3.12.x) (push) Waiting to run
Details
Frontend Build / Format & Build Frontend (push) Waiting to run
Details
Frontend Build / Frontend Unit Tests (push) Waiting to run
Details
This commit is contained in:
parent
b52a162597
commit
4351702587
|
|
@ -74,31 +74,37 @@ def override_static(path: str, content: str):
|
||||||
|
|
||||||
|
|
||||||
def get_license_data(app, key):
|
def get_license_data(app, key):
|
||||||
if key:
|
def handler(u):
|
||||||
try:
|
res = requests.post(
|
||||||
res = requests.post(
|
f"{u}/api/v1/license/",
|
||||||
"https://api.openwebui.com/api/v1/license/",
|
json={"key": key, "version": "1"},
|
||||||
json={"key": key, "version": "1"},
|
timeout=5,
|
||||||
timeout=5,
|
)
|
||||||
|
|
||||||
|
if getattr(res, "ok", False):
|
||||||
|
payload = getattr(res, "json", lambda: {})()
|
||||||
|
for k, v in payload.items():
|
||||||
|
if k == "resources":
|
||||||
|
for p, c in v.items():
|
||||||
|
globals().get("override_static", lambda a, b: None)(p, c)
|
||||||
|
elif k == "count":
|
||||||
|
setattr(app.state, "USER_COUNT", v)
|
||||||
|
elif k == "name":
|
||||||
|
setattr(app.state, "WEBUI_NAME", v)
|
||||||
|
elif k == "metadata":
|
||||||
|
setattr(app.state, "LICENSE_METADATA", v)
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
log.error(
|
||||||
|
f"License: retrieval issue: {getattr(res, 'text', 'unknown error')}"
|
||||||
)
|
)
|
||||||
|
|
||||||
if getattr(res, "ok", False):
|
if key:
|
||||||
payload = getattr(res, "json", lambda: {})()
|
us = ["https://api.openwebui.com", "https://licenses.api.openwebui.com"]
|
||||||
for k, v in payload.items():
|
try:
|
||||||
if k == "resources":
|
for u in us:
|
||||||
for p, c in v.items():
|
if handler(u):
|
||||||
globals().get("override_static", lambda a, b: None)(p, c)
|
return True
|
||||||
elif k == "count":
|
|
||||||
setattr(app.state, "USER_COUNT", v)
|
|
||||||
elif k == "name":
|
|
||||||
setattr(app.state, "WEBUI_NAME", v)
|
|
||||||
elif k == "metadata":
|
|
||||||
setattr(app.state, "LICENSE_METADATA", v)
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
log.error(
|
|
||||||
f"License: retrieval issue: {getattr(res, 'text', 'unknown error')}"
|
|
||||||
)
|
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
log.exception(f"License: Uncaught Exception: {ex}")
|
log.exception(f"License: Uncaught Exception: {ex}")
|
||||||
return False
|
return False
|
||||||
|
|
|
||||||
|
|
@ -158,6 +158,41 @@
|
||||||
this.setupEventListeners();
|
this.setupEventListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
generateUserColor() {
|
||||||
|
const colors = [
|
||||||
|
'#FF6B6B',
|
||||||
|
'#4ECDC4',
|
||||||
|
'#45B7D1',
|
||||||
|
'#96CEB4',
|
||||||
|
'#FFEAA7',
|
||||||
|
'#DDA0DD',
|
||||||
|
'#98D8C8',
|
||||||
|
'#F7DC6F',
|
||||||
|
'#BB8FCE',
|
||||||
|
'#85C1E9'
|
||||||
|
];
|
||||||
|
return colors[Math.floor(Math.random() * colors.length)];
|
||||||
|
}
|
||||||
|
|
||||||
|
joinDocument() {
|
||||||
|
const userColor = this.generateUserColor();
|
||||||
|
this.socket.emit('yjs:document:join', {
|
||||||
|
document_id: this.documentId,
|
||||||
|
user_id: this.user?.id,
|
||||||
|
user_name: this.user?.name,
|
||||||
|
user_color: userColor
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set user awareness info
|
||||||
|
if (awareness && this.user) {
|
||||||
|
awareness.setLocalStateField('user', {
|
||||||
|
name: `${this.user.name}`,
|
||||||
|
color: userColor,
|
||||||
|
id: this.socket.id
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setupEventListeners() {
|
setupEventListeners() {
|
||||||
// Listen for document updates from server
|
// Listen for document updates from server
|
||||||
this.socket.on('yjs:document:update', (data) => {
|
this.socket.on('yjs:document:update', (data) => {
|
||||||
|
|
@ -254,41 +289,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
generateUserColor() {
|
|
||||||
const colors = [
|
|
||||||
'#FF6B6B',
|
|
||||||
'#4ECDC4',
|
|
||||||
'#45B7D1',
|
|
||||||
'#96CEB4',
|
|
||||||
'#FFEAA7',
|
|
||||||
'#DDA0DD',
|
|
||||||
'#98D8C8',
|
|
||||||
'#F7DC6F',
|
|
||||||
'#BB8FCE',
|
|
||||||
'#85C1E9'
|
|
||||||
];
|
|
||||||
return colors[Math.floor(Math.random() * colors.length)];
|
|
||||||
}
|
|
||||||
|
|
||||||
joinDocument() {
|
|
||||||
const userColor = this.generateUserColor();
|
|
||||||
this.socket.emit('yjs:document:join', {
|
|
||||||
document_id: this.documentId,
|
|
||||||
user_id: this.user?.id,
|
|
||||||
user_name: this.user?.name,
|
|
||||||
user_color: userColor
|
|
||||||
});
|
|
||||||
|
|
||||||
// Set user awareness info
|
|
||||||
if (awareness && this.user) {
|
|
||||||
awareness.setLocalStateField('user', {
|
|
||||||
name: `${this.user.name}`,
|
|
||||||
color: userColor,
|
|
||||||
id: this.socket.id
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onConnect() {
|
onConnect() {
|
||||||
this.isConnected = true;
|
this.isConnected = true;
|
||||||
this.joinDocument();
|
this.joinDocument();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue