File tree 7 files changed +32
-12
lines changed
7 files changed +32
-12
lines changed Original file line number Diff line number Diff line change @@ -237,6 +237,7 @@ certificates-development:
237
237
DEPLOY_HOST : $DEPLOY_HOST_DEV
238
238
DEPLOY_KEY : $DEPLOY_KEY_DEV
239
239
SERVER_NAME : " api.open-platform.zensoft.io"
240
+ WIDGET_HOST : " https://api.open-platform.zensoft.io"
240
241
before_script : *prepare_key
241
242
script : *update_certificates
242
243
only :
@@ -250,6 +251,7 @@ certificates-production:
250
251
DEPLOY_HOST : $DEPLOY_HOST_PROD
251
252
DEPLOY_KEY : $DEPLOY_KEY_PROD
252
253
SERVER_NAME : " api.openfuture.io"
254
+ WIDGET_HOST : " https://api.openfuture.io"
253
255
before_script : *prepare_key
254
256
script : *update_certificates
255
257
only :
Original file line number Diff line number Diff line change
1
+ package io.openfuture.api.config.propety
2
+
3
+ import org.springframework.boot.context.properties.ConfigurationProperties
4
+ import org.springframework.stereotype.Component
5
+ import org.springframework.validation.annotation.Validated
6
+ import javax.validation.constraints.NotBlank
7
+
8
+ @ConfigurationProperties(prefix = " widget" )
9
+ @Validated
10
+ @Component
11
+ class WidgetProperties (
12
+ @field:NotBlank var host : String? = null
13
+ )
Original file line number Diff line number Diff line change 1
1
package io.openfuture.api.controller.base
2
2
3
3
import io.openfuture.api.config.propety.AuthorizationProperties
4
+ import io.openfuture.api.config.propety.WidgetProperties
4
5
import org.springframework.stereotype.Controller
5
- import org.springframework.web.bind.annotation.CrossOrigin
6
+ import org.springframework.ui.ModelMap
6
7
import org.springframework.web.bind.annotation.GetMapping
7
8
import org.springframework.web.bind.annotation.PathVariable
8
- import org.springframework.web.servlet.ModelAndView
9
9
import javax.servlet.http.Cookie
10
10
import javax.servlet.http.HttpServletResponse
11
11
12
12
@Controller
13
13
class MainController (
14
- private val properties : AuthorizationProperties
14
+ private val properties : AuthorizationProperties ,
15
+ private val widgetProperties : WidgetProperties
15
16
) {
16
17
17
18
@GetMapping(" /logout" )
@@ -25,8 +26,9 @@ class MainController(
25
26
fun frontend () = " frontend"
26
27
27
28
@GetMapping(" /widget/{address}" )
28
- fun widget (@PathVariable address : String , modelAndView : ModelAndView ): String {
29
- modelAndView.modelMap.addAttribute(" address" , address)
29
+ fun widget (@PathVariable address : String , model : ModelMap ): String {
30
+ model[" address" ] = address
31
+ model[" host" ] = widgetProperties.host
30
32
return " widget"
31
33
}
32
34
Original file line number Diff line number Diff line change @@ -18,4 +18,7 @@ ethereum.open-token-address=${OPEN_TOKEN_ADDRESS}
18
18
ethereum.event-subscription =${EVENT_SUBSCRIPTION}
19
19
20
20
# AUTH
21
- auth.cookie-name =open_key
21
+ auth.cookie-name =open_key
22
+
23
+ # WIDGET
24
+ widget.host =${WIDGET_HOST}
Original file line number Diff line number Diff line change 7
7
< meta http-equiv ="X-UA-Compatible " content ="ie=edge ">
8
8
< title > </ title >
9
9
</ head >
10
- < body data-address ="${address} ">
11
- < script src ="/js/open-widget.js "> </ script >
10
+ < body data-address ="${address} " data-host =" ${host} " >
11
+ < script src ="${host}/static /js/open-widget.js "> </ script >
12
12
</ body >
13
13
</ html >
Original file line number Diff line number Diff line change 1
1
import * as internalWeb3 from 'web3' ;
2
- import * as style from './style.css' ;
3
2
4
- const _web3 = new internalWeb3 ( internalWeb3 . givenProvider || 'http://localhost:8545' ) ;
3
+ const _web3 = new internalWeb3 ( internalWeb3 . givenProvider ) ;
5
4
let windgetData ;
6
5
let userInputData = [ ] ;
7
6
let currentNetwork ;
@@ -107,7 +106,8 @@ function validateForm(){
107
106
108
107
async function openWidget ( ) {
109
108
const scaffoldAddress = await document . body . dataset . address ;
110
- const OPEN_URL = `https://api.open-platform.zensoft.io/widget/scaffolds/${ scaffoldAddress } ` ;
109
+ const host = await document . body . dataset . host ;
110
+ const OPEN_URL = `${ host } /widget/scaffolds/${ scaffoldAddress } ` ;
111
111
windgetData = await getContractData ( OPEN_URL ) ;
112
112
113
113
let widgetEl = document . createElement ( 'div' ) ;
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ module.exports = {
7
7
entry : './src/index.js' ,
8
8
output : {
9
9
filename : 'open-widget.js' ,
10
- path : path . resolve ( `${ __dirname } ` , 'build/js' )
10
+ path : path . resolve ( `${ __dirname } ` , 'build/static/ js' )
11
11
} ,
12
12
performance : {
13
13
maxEntrypointSize : 512000 ,
You can’t perform that action at this time.
0 commit comments