File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name : Check
2- env :
3- APP_HOST : ${{ secrets.APP_HOST }}
42on :
53 pull_request :
64 branches :
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ name: Build & Deploy
22env :
33 PROJECT_ID : ${{ secrets.GCP_PROJECT_ID }}
44 GCP_BUCKET : ${{ secrets.GCP_BUCKET }}
5- APP_HOST : ${{ secrets.APP_HOST }}
65on :
76 push :
87 branches :
Original file line number Diff line number Diff line change @@ -52,19 +52,8 @@ Read more about features and motivation here: https://tbt.qkation.com/projects/c
5252
53530 . Install WebAssembly target: ` rustup target add wasm32-unknown-unknown ` .
54541 . Install [ ` trunk ` ] ( https://github.com/thedodd/trunk ) . [ Additional guide] ( https://yew.rs/docs/next/getting-started/introduction#install-trunk ) .
55- 2 . Set up ` APP_HOST ` environment variable:
56- ``` bash
57- # Windows
58- set APP_HOST=< url>
59- # Linux
60- export APP_HOST=< url>
61- # example:
62- # export APP_HOST=https://crypto-helper.qkation.com
63- ```
64- This env variable is used for the URL generation when you click the * share by URL* button.
65-
66- 3 . Run ` trunk serve ` in your terminal.
67- 4 . Go to http://127.0.0.1:8080 in your browser.
55+ 2 . Run ` trunk serve ` in your terminal.
56+ 3 . Go to http://127.0.0.1:8080 in your browser.
6857
6958### Meta
7059
Original file line number Diff line number Diff line change 11use serde:: { Deserialize , Serialize } ;
2+ use web_sys:: window;
23
34use crate :: crypto_helper:: Algorithm ;
45use crate :: serde:: { deserialize_bytes, serialize_bytes} ;
56
6- const APP_HOST : & str = env ! ( "APP_HOST" ) ;
7+ fn origin ( ) -> String {
8+ window ( )
9+ . expect ( "windows object must present" )
10+ . location ( )
11+ . origin ( )
12+ . expect ( "page must have the origin string" )
13+ }
714
815pub fn generate_crypto_helper_link ( algorithm : & Algorithm ) -> String {
9- let mut link = APP_HOST . to_string ( ) ;
16+ let mut link = origin ( ) ;
1017
1118 link. push_str ( "/crypto-helper/?" ) ;
1219 link. push_str ( & serde_qs:: to_string ( algorithm) . unwrap ( ) ) ;
@@ -20,7 +27,7 @@ pub struct Jwt {
2027}
2128
2229pub fn generate_jwt_link ( jwt : String ) -> String {
23- let mut link = APP_HOST . to_string ( ) ;
30+ let mut link = origin ( ) ;
2431
2532 link. push_str ( "/jwt/?" ) ;
2633 link. push_str ( & serde_qs:: to_string ( & Jwt { jwt } ) . unwrap ( ) ) ;
@@ -35,7 +42,7 @@ pub struct Asn1 {
3542}
3643
3744pub fn generate_asn1_link ( asn1 : Vec < u8 > ) -> String {
38- let mut link = APP_HOST . to_string ( ) ;
45+ let mut link = origin ( ) ;
3946
4047 link. push_str ( "/asn1/?" ) ;
4148 link. push_str ( & serde_qs:: to_string ( & Asn1 { asn1 } ) . unwrap ( ) ) ;
You can’t perform that action at this time.
0 commit comments