Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Whiteboard-Plugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Uni Oldenburg
Plugins
Whiteboard-Plugin
Commits
5c03543c
Commit
5c03543c
authored
May 16, 2023
by
Ann Yanich
Browse files
Options
Downloads
Patches
Plain Diff
Fix issue with loading excalidraw libraries on the private/shared whiteboard pages
parent
364c289c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
controllers/excalidraw.php
+25
-9
25 additions, 9 deletions
controllers/excalidraw.php
with
25 additions
and
9 deletions
controllers/excalidraw.php
+
25
−
9
View file @
5c03543c
...
...
@@ -11,18 +11,34 @@ class ExcalidrawController extends PluginController
// The base of the URL is statically configured when building the app.
// But we are building a plugin for Stud.IP which will be built once and run at many
// different universities. So the question is, what can we do?
// We must provide a base URL, so we provide the base URL '.' (the path of the current page).
// We provide CRA with the base URL '.', causing our app to use relative paths for resources.
// Then, we use before_filter to redirect the requests it makes to the correct URLs.
// There are two cases to handle:
// Case 1: The action which displays Excalidraw has been requested with an argument.
// This causes our app to make requests for resources which look like this:
// https://<studip-base-url>/plugins.php/excalidrawplugin/<current controller>/<current action>/static/media/<filename>.excalidrawlib
// We want them to look like this:
// Case 2: The action which displays Excalidraw has been requested without an argument.
// The requests our app makes will look slightly different:
// https://<studip-base-url>/plugins.php/excalidrawplugin/<current controller>/static/media/<filename>.excalidrawlib
// In both cases, we want to redirect the requests to the following URL:
// https://<studip-base-url>/plugins_packages/UOL/ExcalidrawPlugin/excalidraw-selfhosted/build/static/media/<filename>.excalidrawlib
// We provide a 302 redirect to the appropriate url.
if
(
count
(
$args
)
===
3
&&
$args
[
0
]
===
'static'
&&
$args
[
1
]
===
'media'
&&
str_ends_with
(
$_SERVER
[
'REQUEST_URI'
],
'excalidrawlib'
))
{
$url
=
$this
->
plugin
->
getPluginUrl
(
)
.
'/excalidraw-selfhosted/build/static/media/'
.
$args
[
2
]
.
'.excalidrawlib'
;
$isCase1
=
count
(
$args
)
===
3
&&
$args
[
0
]
===
'static'
&&
$args
[
1
]
===
'media'
&&
str_ends_with
(
$_SERVER
[
'REQUEST_URI'
],
'excalidrawlib'
);
$isCase2
=
$action
===
'static'
&&
count
(
$args
)
===
2
&&
$args
[
0
]
===
'media'
&&
str_ends_with
(
$_SERVER
[
'REQUEST_URI'
],
'excalidrawlib'
);
if
(
$isCase1
)
{
$url
=
$this
->
plugin
->
getPluginUrl
()
.
'/excalidraw-selfhosted/build/static/media/'
.
$args
[
2
]
.
'.excalidrawlib'
;
$this
->
redirect
(
$url
);
return
;
}
if
(
$isCase2
)
{
$url
=
$this
->
plugin
->
getPluginUrl
()
.
'/excalidraw-selfhosted/build/static/media/'
.
$args
[
1
]
.
'.excalidrawlib'
;
$this
->
redirect
(
$url
);
return
;
}
...
...
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