mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-11 20:05:19 +00:00
Merge pull request #15483 from headwAI-GmbH/support-deactivate-update-check
feat: Support deactivate update check without OFFLINE_MODE
This commit is contained in:
commit
ed6bbddf6e
8 changed files with 44 additions and 35 deletions
|
|
@ -529,11 +529,14 @@ else:
|
||||||
# OFFLINE_MODE
|
# OFFLINE_MODE
|
||||||
####################################
|
####################################
|
||||||
|
|
||||||
|
ENABLE_VERSION_UPDATE_CHECK = (
|
||||||
|
os.environ.get("ENABLE_VERSION_UPDATE_CHECK", "true").lower() == "true"
|
||||||
|
)
|
||||||
OFFLINE_MODE = os.environ.get("OFFLINE_MODE", "false").lower() == "true"
|
OFFLINE_MODE = os.environ.get("OFFLINE_MODE", "false").lower() == "true"
|
||||||
|
|
||||||
if OFFLINE_MODE:
|
if OFFLINE_MODE:
|
||||||
os.environ["HF_HUB_OFFLINE"] = "1"
|
os.environ["HF_HUB_OFFLINE"] = "1"
|
||||||
|
ENABLE_VERSION_UPDATE_CHECK = False
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
# AUDIT LOGGING
|
# AUDIT LOGGING
|
||||||
|
|
|
||||||
|
|
@ -418,7 +418,7 @@ from open_webui.env import (
|
||||||
ENABLE_WEBSOCKET_SUPPORT,
|
ENABLE_WEBSOCKET_SUPPORT,
|
||||||
BYPASS_MODEL_ACCESS_CONTROL,
|
BYPASS_MODEL_ACCESS_CONTROL,
|
||||||
RESET_CONFIG_ON_START,
|
RESET_CONFIG_ON_START,
|
||||||
OFFLINE_MODE,
|
ENABLE_VERSION_UPDATE_CHECK,
|
||||||
ENABLE_OTEL,
|
ENABLE_OTEL,
|
||||||
EXTERNAL_PWA_MANIFEST_URL,
|
EXTERNAL_PWA_MANIFEST_URL,
|
||||||
AIOHTTP_CLIENT_SESSION_SSL,
|
AIOHTTP_CLIENT_SESSION_SSL,
|
||||||
|
|
@ -1546,7 +1546,6 @@ async def get_app_config(request: Request):
|
||||||
"name": app.state.WEBUI_NAME,
|
"name": app.state.WEBUI_NAME,
|
||||||
"version": VERSION,
|
"version": VERSION,
|
||||||
"default_locale": str(DEFAULT_LOCALE),
|
"default_locale": str(DEFAULT_LOCALE),
|
||||||
"offline_mode": OFFLINE_MODE,
|
|
||||||
"oauth": {
|
"oauth": {
|
||||||
"providers": {
|
"providers": {
|
||||||
name: config.get("name", name)
|
name: config.get("name", name)
|
||||||
|
|
@ -1561,6 +1560,7 @@ async def get_app_config(request: Request):
|
||||||
"enable_signup": app.state.config.ENABLE_SIGNUP,
|
"enable_signup": app.state.config.ENABLE_SIGNUP,
|
||||||
"enable_login_form": app.state.config.ENABLE_LOGIN_FORM,
|
"enable_login_form": app.state.config.ENABLE_LOGIN_FORM,
|
||||||
"enable_websocket": ENABLE_WEBSOCKET_SUPPORT,
|
"enable_websocket": ENABLE_WEBSOCKET_SUPPORT,
|
||||||
|
"enable_version_update_check": ENABLE_VERSION_UPDATE_CHECK,
|
||||||
**(
|
**(
|
||||||
{
|
{
|
||||||
"enable_direct_connections": app.state.config.ENABLE_DIRECT_CONNECTIONS,
|
"enable_direct_connections": app.state.config.ENABLE_DIRECT_CONNECTIONS,
|
||||||
|
|
@ -1666,9 +1666,9 @@ async def get_app_version():
|
||||||
|
|
||||||
@app.get("/api/version/updates")
|
@app.get("/api/version/updates")
|
||||||
async def get_app_latest_release_version(user=Depends(get_verified_user)):
|
async def get_app_latest_release_version(user=Depends(get_verified_user)):
|
||||||
if OFFLINE_MODE:
|
if not ENABLE_VERSION_UPDATE_CHECK:
|
||||||
log.debug(
|
log.debug(
|
||||||
f"Offline mode is enabled, returning current version as latest version"
|
f"Version update check is disabled, returning current version as latest version"
|
||||||
)
|
)
|
||||||
return {"current": VERSION, "latest": VERSION}
|
return {"current": VERSION, "latest": VERSION}
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
// On page load or when changing themes, best to add inline in `head` to avoid FOUC
|
// On page load or when changing themes, best to add inline in `head` to avoid FOUC
|
||||||
(() => {
|
(() => {
|
||||||
const metaThemeColorTag = document.querySelector('meta[name="theme-color"]');
|
const metaThemeColorTag = document.querySelector('meta[name="theme-color"]');
|
||||||
|
|
@ -82,10 +81,11 @@
|
||||||
|
|
||||||
const logo = document.createElement('img');
|
const logo = document.createElement('img');
|
||||||
logo.id = 'logo';
|
logo.id = 'logo';
|
||||||
logo.style = "position: absolute; width: auto; height: 6rem; top: 44%; left: 50%; transform: translateX(-50%); display:block;";
|
logo.style =
|
||||||
|
'position: absolute; width: auto; height: 6rem; top: 44%; left: 50%; transform: translateX(-50%); display:block;';
|
||||||
logo.src = isDarkMode ? '/static/splash-dark.png' : '/static/splash.png';
|
logo.src = isDarkMode ? '/static/splash-dark.png' : '/static/splash.png';
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
const splash = document.getElementById('splash-screen');
|
const splash = document.getElementById('splash-screen');
|
||||||
if (splash) splash.prepend(logo);
|
if (splash) splash.prepend(logo);
|
||||||
});
|
});
|
||||||
|
|
@ -110,7 +110,6 @@
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
style="
|
style="
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
if (!$config?.offline_mode) {
|
if ($config?.features?.enable_version_update_check) {
|
||||||
checkForVersionUpdates();
|
checkForVersionUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -139,16 +139,18 @@
|
||||||
v{WEBUI_VERSION}
|
v{WEBUI_VERSION}
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|
||||||
<a
|
{#if $config?.features?.enable_version_update_check}
|
||||||
href="https://github.com/open-webui/open-webui/releases/tag/v{version.latest}"
|
<a
|
||||||
target="_blank"
|
href="https://github.com/open-webui/open-webui/releases/tag/v{version.latest}"
|
||||||
>
|
target="_blank"
|
||||||
{updateAvailable === null
|
>
|
||||||
? $i18n.t('Checking for updates...')
|
{updateAvailable === null
|
||||||
: updateAvailable
|
? $i18n.t('Checking for updates...')
|
||||||
? `(v${version.latest} ${$i18n.t('available!')})`
|
: updateAvailable
|
||||||
: $i18n.t('(latest)')}
|
? `(v${version.latest} ${$i18n.t('available!')})`
|
||||||
</a>
|
: $i18n.t('(latest)')}
|
||||||
|
</a>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|
@ -162,7 +164,7 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if !$config?.offline_mode}
|
{#if $config?.features?.enable_version_update_check}
|
||||||
<button
|
<button
|
||||||
class=" text-xs px-3 py-1.5 bg-gray-50 hover:bg-gray-100 dark:bg-gray-850 dark:hover:bg-gray-800 transition rounded-lg font-medium"
|
class=" text-xs px-3 py-1.5 bg-gray-50 hover:bg-gray-100 dark:bg-gray-850 dark:hover:bg-gray-800 transition rounded-lg font-medium"
|
||||||
type="button"
|
type="button"
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,9 @@
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
aria-hidden={models.length <= 1}
|
aria-hidden={models.length <= 1}
|
||||||
aria-label={$i18n.t('Get information on {{name}} in the UI', { name: models[modelIdx]?.name})}
|
aria-label={$i18n.t('Get information on {{name}} in the UI', {
|
||||||
|
name: models[modelIdx]?.name
|
||||||
|
})}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
selectedModelIdx = modelIdx;
|
selectedModelIdx = modelIdx;
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
return '';
|
return '';
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!$config?.offline_mode) {
|
if ($config?.features?.enable_version_update_check) {
|
||||||
checkForVersionUpdates();
|
checkForVersionUpdates();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -60,16 +60,18 @@
|
||||||
v{WEBUI_VERSION}
|
v{WEBUI_VERSION}
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|
||||||
<a
|
{#if $config?.features?.enable_version_update_check}
|
||||||
href="https://github.com/open-webui/open-webui/releases/tag/v{version.latest}"
|
<a
|
||||||
target="_blank"
|
href="https://github.com/open-webui/open-webui/releases/tag/v{version.latest}"
|
||||||
>
|
target="_blank"
|
||||||
{updateAvailable === null
|
>
|
||||||
? $i18n.t('Checking for updates...')
|
{updateAvailable === null
|
||||||
: updateAvailable
|
? $i18n.t('Checking for updates...')
|
||||||
? `(v${version.latest} ${$i18n.t('available!')})`
|
: updateAvailable
|
||||||
: $i18n.t('(latest)')}
|
? `(v${version.latest} ${$i18n.t('available!')})`
|
||||||
</a>
|
: $i18n.t('(latest)')}
|
||||||
|
</a>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|
@ -82,7 +84,7 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if $config?.offline_mode}
|
{#if $config?.features?.enable_version_update_check}
|
||||||
<button
|
<button
|
||||||
class=" text-xs px-3 py-1.5 bg-gray-100 hover:bg-gray-200 dark:bg-gray-850 dark:hover:bg-gray-800 transition rounded-lg font-medium"
|
class=" text-xs px-3 py-1.5 bg-gray-100 hover:bg-gray-200 dark:bg-gray-850 dark:hover:bg-gray-800 transition rounded-lg font-medium"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
|
|
|
||||||
|
|
@ -255,6 +255,7 @@ type Config = {
|
||||||
enable_community_sharing: boolean;
|
enable_community_sharing: boolean;
|
||||||
enable_autocomplete_generation: boolean;
|
enable_autocomplete_generation: boolean;
|
||||||
enable_direct_connections: boolean;
|
enable_direct_connections: boolean;
|
||||||
|
enable_version_update_check: boolean;
|
||||||
};
|
};
|
||||||
oauth: {
|
oauth: {
|
||||||
providers: {
|
providers: {
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for version updates
|
// Check for version updates
|
||||||
if ($user?.role === 'admin' && !$config?.offline_mode) {
|
if ($user?.role === 'admin' && $config?.features?.enable_version_update_check) {
|
||||||
// Check if the user has dismissed the update toast in the last 24 hours
|
// Check if the user has dismissed the update toast in the last 24 hours
|
||||||
if (localStorage.dismissedUpdateToast) {
|
if (localStorage.dismissedUpdateToast) {
|
||||||
const dismissedUpdateToast = new Date(Number(localStorage.dismissedUpdateToast));
|
const dismissedUpdateToast = new Date(Number(localStorage.dismissedUpdateToast));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue