Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
Hubs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ar-noc
Hubs
Commits
cf62ed95
Commit
cf62ed95
authored
6 years ago
by
netpro2k
Browse files
Options
Downloads
Patches
Plain Diff
Use the correct reticulum host for media lookcup
parent
ac4a11f0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/utils/media-utils.js
+7
-1
7 additions, 1 deletion
src/utils/media-utils.js
with
7 additions
and
1 deletion
src/utils/media-utils.js
+
7
−
1
View file @
cf62ed95
const
whitelistedHosts
=
[
/^.*
\.
reticulum
\.
io$/
,
/^.*hubs
\.
mozilla
\.
com$/
,
/^hubs
\.
local$/
];
const
whitelistedHosts
=
[
/^.*
\.
reticulum
\.
io$/
,
/^.*hubs
\.
mozilla
\.
com$/
,
/^hubs
\.
local$/
];
const
isHostWhitelisted
=
hostname
=>
!!
whitelistedHosts
.
filter
(
r
=>
r
.
test
(
hostname
)).
length
;
const
isHostWhitelisted
=
hostname
=>
!!
whitelistedHosts
.
filter
(
r
=>
r
.
test
(
hostname
)).
length
;
let
resolveMediaUrl
=
"
/api/v1/media
"
;
if
(
process
.
env
.
NODE_ENV
===
"
development
"
)
{
resolveMediaUrl
=
`https://
${
process
.
env
.
DEV_RETICULUM_SERVER
}${
resolveMediaUrl
}
`
;
}
export
const
resolveFarsparkUrl
=
async
url
=>
{
export
const
resolveFarsparkUrl
=
async
url
=>
{
const
parsedUrl
=
new
URL
(
url
);
const
parsedUrl
=
new
URL
(
url
);
if
((
parsedUrl
.
protocol
!==
"
http:
"
&&
parsedUrl
.
protocol
!==
"
https:
"
)
||
isHostWhitelisted
(
parsedUrl
.
hostname
))
if
((
parsedUrl
.
protocol
!==
"
http:
"
&&
parsedUrl
.
protocol
!==
"
https:
"
)
||
isHostWhitelisted
(
parsedUrl
.
hostname
))
return
url
;
return
url
;
return
(
await
fetch
(
"
https://dev.reticulum.io/api/v1/m
edia
"
,
{
return
(
await
fetch
(
resolveM
edia
Url
,
{
method
:
"
POST
"
,
method
:
"
POST
"
,
headers
:
{
"
Content-Type
"
:
"
application/json
"
},
headers
:
{
"
Content-Type
"
:
"
application/json
"
},
body
:
JSON
.
stringify
({
media
:
{
url
}
})
body
:
JSON
.
stringify
({
media
:
{
url
}
})
...
...
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