Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
01ecf2e3
Commit
01ecf2e3
authored
Dec 29, 2020
by
aniket-engg
Committed by
Aniket
Jan 04, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
protocol based swarm gateway
parent
1d6ae33b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
compiler-imports.js
apps/remix-ide/src/app/compiler/compiler-imports.js
+2
-1
resolve.ts
libs/remix-url-resolver/src/resolve.ts
+4
-2
No files found.
apps/remix-ide/src/app/compiler/compiler-imports.js
View file @
01ecf2e3
...
...
@@ -21,7 +21,8 @@ module.exports = class CompilerImports extends Plugin {
this
.
fileManager
=
fileManager
// const token = await this.call('settings', 'getGithubAccessToken')
const
token
=
globalRegistry
.
get
(
'config'
).
api
.
get
(
'settings/gist-access-token'
)
// TODO replace with the plugin call above https://github.com/ethereum/remix-ide/issues/2288
this
.
urlResolver
=
new
RemixURLResolver
(
token
)
const
protocol
=
window
.
location
.
protocol
this
.
urlResolver
=
new
RemixURLResolver
(
token
,
protocol
)
this
.
previouslyHandled
=
{}
// cache import so we don't make the request at each compilation.
}
...
...
libs/remix-url-resolver/src/resolve.ts
View file @
01ecf2e3
...
...
@@ -25,10 +25,12 @@ interface HandlerResponse {
export
class
RemixURLResolver
{
private
previouslyHandled
:
PreviouslyHandledImports
gistAccessToken
:
string
protocol
:
string
constructor
(
gistToken
?:
string
)
{
constructor
(
gistToken
?:
string
,
protocol
=
'http:'
)
{
this
.
previouslyHandled
=
{}
this
.
gistAccessToken
=
gistToken
?
gistToken
:
''
this
.
protocol
=
protocol
}
/**
...
...
@@ -90,7 +92,7 @@ export class RemixURLResolver {
async
handleSwarm
(
url
:
string
,
cleanUrl
:
string
):
Promise
<
HandlerResponse
>
{
//eslint-disable-next-line no-useless-catch
try
{
const
bzz
=
new
Bzz
({
url
:
'http:
//swarm-gateways.net'
});
const
bzz
=
new
Bzz
({
url
:
this
.
protocol
+
'
//swarm-gateways.net'
});
const
url
=
bzz
.
getDownloadURL
(
cleanUrl
,
{
mode
:
'raw'
})
const
response
:
AxiosResponse
=
await
axios
.
get
(
url
)
return
{
content
:
response
.
data
,
cleanUrl
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment