mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-28 11:41:18 +00:00
Merge pull request #6877 from haiwen/share-link-org-logo
show org logo on share link page
This commit is contained in:
commit
24405a6600
@ -1457,3 +1457,33 @@ ASCII_RE = re.compile(r'[^\x00-\x7f]')
|
|||||||
def is_valid_password(password):
|
def is_valid_password(password):
|
||||||
|
|
||||||
return False if ASCII_RE.search(password) else True
|
return False if ASCII_RE.search(password) else True
|
||||||
|
|
||||||
|
|
||||||
|
def get_logo_path_by_user(username):
|
||||||
|
|
||||||
|
logo_path = LOGO_PATH
|
||||||
|
|
||||||
|
# custom logo
|
||||||
|
custom_logo_file = os.path.join(MEDIA_ROOT, CUSTOM_LOGO_PATH)
|
||||||
|
if os.path.exists(custom_logo_file):
|
||||||
|
logo_path = CUSTOM_LOGO_PATH
|
||||||
|
|
||||||
|
# org custom logo
|
||||||
|
orgs = ccnet_api.get_orgs_by_user(username)
|
||||||
|
if orgs:
|
||||||
|
|
||||||
|
from seahub.organizations.settings import ORG_ENABLE_ADMIN_CUSTOM_LOGO
|
||||||
|
if ORG_ENABLE_ADMIN_CUSTOM_LOGO:
|
||||||
|
|
||||||
|
org = orgs[0]
|
||||||
|
from seahub.organizations.models import OrgAdminSettings
|
||||||
|
org_logo_url = OrgAdminSettings.objects.get_org_logo_url(org.org_id)
|
||||||
|
|
||||||
|
if org_logo_url:
|
||||||
|
logo_path = org_logo_url
|
||||||
|
|
||||||
|
from seahub.avatar.settings import AVATAR_FILE_STORAGE
|
||||||
|
if AVATAR_FILE_STORAGE == 'seahub.base.database_storage.DatabaseStorage':
|
||||||
|
logo_path = "/image-view/" + logo_path
|
||||||
|
|
||||||
|
return logo_path
|
||||||
|
@ -1326,7 +1326,6 @@ def view_shared_file(request, fileshare):
|
|||||||
|
|
||||||
permissions = fileshare.get_permissions()
|
permissions = fileshare.get_permissions()
|
||||||
|
|
||||||
#template = 'shared_file_view.html'
|
|
||||||
template = 'shared_file_view_react.html'
|
template = 'shared_file_view_react.html'
|
||||||
|
|
||||||
file_share_link = request.path
|
file_share_link = request.path
|
||||||
@ -1367,8 +1366,13 @@ def view_shared_file(request, fileshare):
|
|||||||
data['can_edit_file'] = ret_dict['can_edit_file']
|
data['can_edit_file'] = ret_dict['can_edit_file']
|
||||||
data['file_perm'] = ret_dict['file_perm']
|
data['file_perm'] = ret_dict['file_perm']
|
||||||
|
|
||||||
|
if not request.user.is_authenticated:
|
||||||
|
from seahub.utils import get_logo_path_by_user
|
||||||
|
data['logo_path'] = get_logo_path_by_user(shared_by)
|
||||||
|
|
||||||
return render(request, template, data)
|
return render(request, template, data)
|
||||||
|
|
||||||
|
|
||||||
@share_link_audit
|
@share_link_audit
|
||||||
@share_link_login_required
|
@share_link_login_required
|
||||||
def view_file_via_shared_dir(request, fileshare):
|
def view_file_via_shared_dir(request, fileshare):
|
||||||
@ -1626,6 +1630,10 @@ def view_file_via_shared_dir(request, fileshare):
|
|||||||
data['can_edit_file'] = ret_dict['can_edit_file']
|
data['can_edit_file'] = ret_dict['can_edit_file']
|
||||||
data['file_perm'] = ret_dict['file_perm']
|
data['file_perm'] = ret_dict['file_perm']
|
||||||
|
|
||||||
|
if not request.user.is_authenticated:
|
||||||
|
from seahub.utils import get_logo_path_by_user
|
||||||
|
data['logo_path'] = get_logo_path_by_user(shared_by)
|
||||||
|
|
||||||
return render(request, template, data)
|
return render(request, template, data)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@ -349,7 +349,7 @@ def view_shared_dir(request, fileshare):
|
|||||||
dir_share_link = request.path
|
dir_share_link = request.path
|
||||||
desc_for_ogp = _('Share link for %s.') % dir_name
|
desc_for_ogp = _('Share link for %s.') % dir_name
|
||||||
|
|
||||||
return render(request, template, {
|
data = {
|
||||||
'repo': repo,
|
'repo': repo,
|
||||||
'token': token,
|
'token': token,
|
||||||
'path': req_path,
|
'path': req_path,
|
||||||
@ -370,7 +370,13 @@ def view_shared_dir(request, fileshare):
|
|||||||
'enable_share_link_report_abuse': ENABLE_SHARE_LINK_REPORT_ABUSE,
|
'enable_share_link_report_abuse': ENABLE_SHARE_LINK_REPORT_ABUSE,
|
||||||
'enable_video_thumbnail': ENABLE_VIDEO_THUMBNAIL,
|
'enable_video_thumbnail': ENABLE_VIDEO_THUMBNAIL,
|
||||||
'enable_pdf_thumbnail': ENABLE_PDF_THUMBNAIL,
|
'enable_pdf_thumbnail': ENABLE_PDF_THUMBNAIL,
|
||||||
})
|
}
|
||||||
|
|
||||||
|
if not request.user.is_authenticated:
|
||||||
|
from seahub.utils import get_logo_path_by_user
|
||||||
|
data['logo_path'] = get_logo_path_by_user(fileshare.username)
|
||||||
|
|
||||||
|
return render(request, template, data)
|
||||||
|
|
||||||
|
|
||||||
@share_link_audit
|
@share_link_audit
|
||||||
@ -416,7 +422,7 @@ def view_shared_upload_link(request, uploadlink):
|
|||||||
logger.error(e)
|
logger.error(e)
|
||||||
max_upload_file_size = -1
|
max_upload_file_size = -1
|
||||||
|
|
||||||
return render(request, 'view_shared_upload_link_react.html', {
|
data = {
|
||||||
'repo': repo,
|
'repo': repo,
|
||||||
'path': path,
|
'path': path,
|
||||||
'username': username,
|
'username': username,
|
||||||
@ -427,4 +433,10 @@ def view_shared_upload_link(request, uploadlink):
|
|||||||
'enable_upload_folder': ENABLE_UPLOAD_FOLDER,
|
'enable_upload_folder': ENABLE_UPLOAD_FOLDER,
|
||||||
'enable_resumable_fileupload': ENABLE_RESUMABLE_FILEUPLOAD,
|
'enable_resumable_fileupload': ENABLE_RESUMABLE_FILEUPLOAD,
|
||||||
'max_number_of_files_for_fileupload': MAX_NUMBER_OF_FILES_FOR_FILEUPLOAD,
|
'max_number_of_files_for_fileupload': MAX_NUMBER_OF_FILES_FOR_FILEUPLOAD,
|
||||||
})
|
}
|
||||||
|
|
||||||
|
if not request.user.is_authenticated:
|
||||||
|
from seahub.utils import get_logo_path_by_user
|
||||||
|
data['logo_path'] = get_logo_path_by_user(uploadlink.username)
|
||||||
|
|
||||||
|
return render(request, 'view_shared_upload_link_react.html', data)
|
||||||
|
Loading…
Reference in New Issue
Block a user