Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Portal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Fachschaft
Portal
Commits
2b4bbb7e
Verified
Commit
2b4bbb7e
authored
8 months ago
by
Jakob Moser
Browse files
Options
Downloads
Patches
Plain Diff
Implement canAccess
parent
4689cc13
No related branches found
No related tags found
Loading
Pipeline
#6524
passed
8 months ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
portal/static/js/gitlab.mjs
+19
-1
19 additions, 1 deletion
portal/static/js/gitlab.mjs
with
19 additions
and
1 deletion
portal/static/js/gitlab.mjs
+
19
−
1
View file @
2b4bbb7e
...
...
@@ -34,7 +34,25 @@
* to determine if the user is logged in.
*/
async
function
canAccess
(
imageUrl
)
{}
/**
* Checks if the browser can access the image at the given URL. This must be a valid image, otherwise
* the check will always fail.
*
* @param {String} imageUrl A url to an image file (likely hosted on some other origin)
*/
async
function
canAccess
(
imageUrl
)
{
try
{
await
new
Promise
((
resolve
,
reject
)
=>
{
const
img
=
document
.
createElement
(
"
img
"
)
img
.
addEventListener
(
"
load
"
,
resolve
)
img
.
addEventListener
(
"
error
"
,
reject
)
img
.
src
=
imageUrl
})
return
true
}
catch
{
return
false
}
}
export
async
function
isLoggedIn
()
{}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment