Skip to content

Commit

Permalink
try to link to onlyoffice
Browse files Browse the repository at this point in the history
  • Loading branch information
lovehunter9 committed Nov 8, 2024
1 parent af8899c commit 69fb15e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
4 changes: 2 additions & 2 deletions seahub/onlyoffice/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from seahub.base.templatetags.seahub_tags import email2nickname, email2contact_email
from seahub.utils import get_file_type_and_ext, gen_file_get_url, \
get_site_scheme_and_netloc
get_site_scheme_and_netloc_onlyoffice

from seahub.onlyoffice.models import OnlyOfficeDocKey

Expand Down Expand Up @@ -137,7 +137,7 @@ def get_onlyoffice_dict(request, username, repo_id, file_path, file_id='',
file_name = os.path.basename(file_path.rstrip('/'))
doc_url = gen_file_get_url(dl_token, file_name)

base_url = get_site_scheme_and_netloc()
base_url = get_site_scheme_and_netloc_onlyoffice()
logger.info(f"base_url={base_url}")
onlyoffice_editor_callback_url = reverse('onlyoffice_editor_callback')
logger.info(f"onlyoffice_editor_callback_url={onlyoffice_editor_callback_url}")
Expand Down
6 changes: 4 additions & 2 deletions seahub/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@

DEBUG = False

SERVICE_URL = 'https://files.wangrongxiang2.myterminus.com/seahub/' # '/'
FILE_SERVER_ROOT = 'https://files.wangrongxiang2.myterminus.com/seafhttp/' # '/seafhttp'
SERVICE_URL = '/'
FILE_SERVER_ROOT = '/seafhttp'
ONLYOFFICE_SERVICE_URL = 'https://files.wangrongxiang2.myterminus.com/seahub/'
ONLYOFFICE_FILE_SERVER_ROOT = 'https://files.wangrongxiang2.myterminus.com/seafhttp/'
# FILE_SERVER_ROOT = 'http://127.0.0.1:' + FILE_SERVER_PORT

CLOUD_MODE = False
Expand Down
17 changes: 17 additions & 0 deletions seahub/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,11 @@ def get_service_url():
"""
return config.SERVICE_URL

def get_service_url_onlyoffice():
"""Get service url from seaserv.
"""
return config.ONLYOFFICE_SERVICE_URL

def get_webdav_url():
"""Get webdav url.
"""
Expand Down Expand Up @@ -1003,6 +1008,18 @@ def get_site_scheme_and_netloc():
parse_result = urlparse(get_service_url())
return "%s://%s" % (parse_result.scheme, parse_result.netloc)

def get_site_scheme_and_netloc_onlyoffice():
"""Return a string contains site scheme and network location part from
service url.
For example:
>>> get_site_scheme_and_netloc("https://example.com:8000/seafile/")
https://example.com:8000
"""
parse_result = urlparse(get_service_url_onlyoffice())
return "%s://%s" % (parse_result.scheme, parse_result.netloc)

def get_site_name():
"""Return site name from settings.
"""
Expand Down

0 comments on commit 69fb15e

Please sign in to comment.