mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 04:15:25 +00:00
refac: granular onedrive integration types
This commit is contained in:
parent
76d358bd6c
commit
e1e3009a30
3 changed files with 47 additions and 20 deletions
|
|
@ -730,6 +730,7 @@ def load_oauth_providers():
|
||||||
}
|
}
|
||||||
|
|
||||||
if FEISHU_CLIENT_ID.value and FEISHU_CLIENT_SECRET.value:
|
if FEISHU_CLIENT_ID.value and FEISHU_CLIENT_SECRET.value:
|
||||||
|
|
||||||
def feishu_oauth_register(client: OAuth):
|
def feishu_oauth_register(client: OAuth):
|
||||||
client.register(
|
client.register(
|
||||||
name="feishu",
|
name="feishu",
|
||||||
|
|
@ -2167,6 +2168,12 @@ ENABLE_ONEDRIVE_INTEGRATION = PersistentConfig(
|
||||||
"onedrive.enable",
|
"onedrive.enable",
|
||||||
os.getenv("ENABLE_ONEDRIVE_INTEGRATION", "False").lower() == "true",
|
os.getenv("ENABLE_ONEDRIVE_INTEGRATION", "False").lower() == "true",
|
||||||
)
|
)
|
||||||
|
ENABLE_ONEDRIVE_PERSONAL = (
|
||||||
|
os.environ.get("ENABLE_ONEDRIVE_PERSONAL", "True").lower() == "true"
|
||||||
|
)
|
||||||
|
ENABLE_ONEDRIVE_BUSINESS = (
|
||||||
|
os.environ.get("ENABLE_ONEDRIVE_BUSINESS", "True").lower() == "true"
|
||||||
|
)
|
||||||
|
|
||||||
ONEDRIVE_CLIENT_ID = PersistentConfig(
|
ONEDRIVE_CLIENT_ID = PersistentConfig(
|
||||||
"ONEDRIVE_CLIENT_ID",
|
"ONEDRIVE_CLIENT_ID",
|
||||||
|
|
|
||||||
|
|
@ -1730,6 +1730,14 @@ async def get_app_config(request: Request):
|
||||||
"enable_admin_chat_access": ENABLE_ADMIN_CHAT_ACCESS,
|
"enable_admin_chat_access": ENABLE_ADMIN_CHAT_ACCESS,
|
||||||
"enable_google_drive_integration": app.state.config.ENABLE_GOOGLE_DRIVE_INTEGRATION,
|
"enable_google_drive_integration": app.state.config.ENABLE_GOOGLE_DRIVE_INTEGRATION,
|
||||||
"enable_onedrive_integration": app.state.config.ENABLE_ONEDRIVE_INTEGRATION,
|
"enable_onedrive_integration": app.state.config.ENABLE_ONEDRIVE_INTEGRATION,
|
||||||
|
**(
|
||||||
|
{
|
||||||
|
"enable_onedrive_personal": app.state.config.ENABLE_ONEDRIVE_PERSONAL,
|
||||||
|
"enable_onedrive_business": app.state.config.ENABLE_ONEDRIVE_BUSINESS,
|
||||||
|
}
|
||||||
|
if app.state.config.ENABLE_ONEDRIVE_INTEGRATION
|
||||||
|
else {}
|
||||||
|
),
|
||||||
}
|
}
|
||||||
if user is not None
|
if user is not None
|
||||||
else {}
|
else {}
|
||||||
|
|
|
||||||
|
|
@ -298,7 +298,7 @@
|
||||||
</DropdownMenu.Item>
|
</DropdownMenu.Item>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if $config?.features?.enable_onedrive_integration}
|
{#if $config?.features?.enable_onedrive_integration && ($config?.features?.enable_onedrive_personal || $config?.features?.enable_onedrive_business)}
|
||||||
<DropdownMenu.Sub>
|
<DropdownMenu.Sub>
|
||||||
<DropdownMenu.SubTrigger
|
<DropdownMenu.SubTrigger
|
||||||
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl w-full"
|
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl w-full"
|
||||||
|
|
@ -396,25 +396,37 @@
|
||||||
sideOffset={$mobile ? 5 : 0}
|
sideOffset={$mobile ? 5 : 0}
|
||||||
alignOffset={$mobile ? 0 : -8}
|
alignOffset={$mobile ? 0 : -8}
|
||||||
>
|
>
|
||||||
<DropdownMenu.Item
|
{#if $config?.features?.enable_onedrive_personal}
|
||||||
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl"
|
<DropdownMenu.Item
|
||||||
on:click={() => {
|
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl"
|
||||||
uploadOneDriveHandler('personal');
|
on:click={() => {
|
||||||
}}
|
uploadOneDriveHandler('personal');
|
||||||
>
|
}}
|
||||||
<div class="line-clamp-1">{$i18n.t('Microsoft OneDrive (personal)')}</div>
|
>
|
||||||
</DropdownMenu.Item>
|
<div class="flex flex-col">
|
||||||
<DropdownMenu.Item
|
<div class="line-clamp-1">{$i18n.t('Microsoft OneDrive (personal)')}</div>
|
||||||
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl"
|
<div class="text-xs text-gray-500">
|
||||||
on:click={() => {
|
{$i18n.t('Includes OneDrive Consumer')}
|
||||||
uploadOneDriveHandler('organizations');
|
</div>
|
||||||
}}
|
</div>
|
||||||
>
|
</DropdownMenu.Item>
|
||||||
<div class="flex flex-col">
|
{/if}
|
||||||
<div class="line-clamp-1">{$i18n.t('Microsoft OneDrive (work/school)')}</div>
|
|
||||||
<div class="text-xs text-gray-500">{$i18n.t('Includes SharePoint')}</div>
|
{#if $config?.features?.enable_onedrive_business}
|
||||||
</div>
|
<DropdownMenu.Item
|
||||||
</DropdownMenu.Item>
|
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl"
|
||||||
|
on:click={() => {
|
||||||
|
uploadOneDriveHandler('organizations');
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div class="flex flex-col">
|
||||||
|
<div class="line-clamp-1">
|
||||||
|
{$i18n.t('Microsoft OneDrive (work/school)')}
|
||||||
|
</div>
|
||||||
|
<div class="text-xs text-gray-500">{$i18n.t('Includes SharePoint')}</div>
|
||||||
|
</div>
|
||||||
|
</DropdownMenu.Item>
|
||||||
|
{/if}
|
||||||
</DropdownMenu.SubContent>
|
</DropdownMenu.SubContent>
|
||||||
</DropdownMenu.Sub>
|
</DropdownMenu.Sub>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue