2016-07-26 10:47:45 +08:00
|
|
|
# Copyright (c) 2012-2016 Seafile Ltd.
|
2016-05-07 11:45:47 +08:00
|
|
|
from seahub.api2.base import APIView
|
2020-12-24 21:45:59 +08:00
|
|
|
from seahub.api2.utils import json_response
|
2014-12-25 12:27:44 +09:00
|
|
|
from seahub import settings
|
2020-12-24 21:45:59 +08:00
|
|
|
from seahub.utils import HAS_OFFICE_CONVERTER, HAS_FILE_SEARCH, is_pro_version
|
2015-06-25 16:08:14 +08:00
|
|
|
|
2015-09-21 11:48:07 +08:00
|
|
|
from constance import config
|
2014-12-25 12:27:44 +09:00
|
|
|
|
|
|
|
class ServerInfoView(APIView):
|
|
|
|
"""
|
|
|
|
Returns the server info (version, supported features).
|
|
|
|
"""
|
|
|
|
@json_response
|
|
|
|
def get(self, request, format=None):
|
|
|
|
info = {
|
|
|
|
'version': settings.SEAFILE_VERSION,
|
2020-11-26 10:37:28 +08:00
|
|
|
'encrypted_library_version': settings.ENCRYPTED_LIBRARY_VERSION if settings.ENCRYPTED_LIBRARY_VERSION >= 3 else 2,
|
2014-12-25 12:27:44 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
features = ['seafile-basic']
|
|
|
|
|
2020-12-24 21:45:59 +08:00
|
|
|
if is_pro_version():
|
2014-12-25 12:27:44 +09:00
|
|
|
features.append('seafile-pro')
|
|
|
|
|
|
|
|
if HAS_OFFICE_CONVERTER:
|
|
|
|
features.append('office-preview')
|
|
|
|
|
|
|
|
if HAS_FILE_SEARCH:
|
|
|
|
features.append('file-search')
|
|
|
|
|
2015-09-21 11:48:07 +08:00
|
|
|
if config.DISABLE_SYNC_WITH_ANY_FOLDER:
|
2015-06-25 16:08:14 +08:00
|
|
|
features.append('disable-sync-with-any-folder')
|
2014-12-25 12:27:44 +09:00
|
|
|
|
2023-12-19 15:50:02 +08:00
|
|
|
if config.CLIENT_SSO_VIA_LOCAL_BROWSER:
|
|
|
|
features.append('client-sso-via-local-browser')
|
|
|
|
|
2015-09-15 10:09:58 +08:00
|
|
|
if hasattr(settings, 'DESKTOP_CUSTOM_LOGO'):
|
|
|
|
info['desktop-custom-logo'] = settings.MEDIA_URL + getattr(settings, 'DESKTOP_CUSTOM_LOGO')
|
|
|
|
|
|
|
|
if hasattr(settings, 'DESKTOP_CUSTOM_BRAND'):
|
|
|
|
info['desktop-custom-brand'] = getattr(settings, 'DESKTOP_CUSTOM_BRAND')
|
|
|
|
|
2015-06-25 16:08:14 +08:00
|
|
|
info['features'] = features
|
2014-12-25 12:27:44 +09:00
|
|
|
return info
|