@@ -52,11 +52,6 @@ <h1>VAPID verification</h1>
5252< div id ="result " class ="section ">
5353 < a name ="claims "> < h2 > Claims</ h2 > </ a >
5454 < p > Claims are the information a site uses to identify itself.
55- < div class ="row ">
56- < label for ="aud " title ="The full URL to your site. "> < b > Aud</ b > ience:</ label >
57- < p > The optional full URL to your site.</ p >
58- < input name ="aud " placeholder ="https://push.example.com ">
59- </ div >
6055 < div class ="row ">
6156 < label for ="sub " > < b > Sub</ b > scriber:</ label >
6257 < p > The required administrative email address that can be contacted if there's an issue</ p >
@@ -67,6 +62,17 @@ <h1>VAPID verification</h1>
6762 < p > Time in seconds for this claim to live. (Default/Max: 24 hours from now)</ p >
6863 < input name ="exp " id ="vapid_exp " placeholder ="Time in seconds ">
6964 </ div >
65+ < p > </ p >
66+ < p > < b > < i > Note</ i > </ b > : You can add more claims if you wish.
67+ These can include things
68+ like, the ID of the originating server (if you have several that may be
69+ publishing updates), a proxied customer ID or hash (for privacy reasons,
70+ you probably don't want to make this easily determinable), or any other
71+ value that may be useful between the Push Server Ops team and yours.
72+ Just make the values short so you don't run the risk of the server
73+ rejecting a request because the headers are too big.</ p >
74+ < p > For example:
75+ < code > {'ami_id':'e-1248296','cust_id':'a9afd519s919faio3'}</ code > </ p >
7076 < div class ="control ">
7177 < button id ="gen "> Generate VAPID</ button >
7278 </ div >
@@ -124,7 +130,7 @@ <h3>Claims JSON object:</h3>
124130}
125131
126132function success ( claims ) {
127- for ( let n of [ "aud" , " sub", "exp" ] ) {
133+ for ( let n of [ "sub" , "exp" ] ) {
128134 let item = document . getElementsByName ( n ) [ 0 ] ;
129135 item . value = claims [ n ] ;
130136 item . classList . add ( "updated" ) ;
@@ -171,15 +177,6 @@ <h3>Claims JSON object:</h3>
171177 reply [ item . name ] = item . value ;
172178 }
173179
174- // verify aud
175- if ( ! / ^ h t t p s ? : \/ \/ / . test ( reply [ 'aud' ] ) ) {
176- error ( null ,
177- `Invalid Audience: Use the full URL of your site e.g. "http://example.com"` ) ;
178- document . getElementsByName ( "aud" ) [ 0 ] . classList . add ( "err" ) ;
179- err = true ;
180- } else {
181- document . getElementsByName ( "aud" ) [ 0 ] . classList . remove ( "err" ) ;
182- }
183180 // verify sub
184181 if ( ! / ^ m a i l t o : .+ @ .+ / . test ( reply [ 'sub' ] ) ) {
185182 error ( null ,
@@ -227,7 +224,9 @@ <h3>Claims JSON object:</h3>
227224 }
228225 try {
229226 let rclaims = document . getElementById ( "raw_claims" ) ;
230- rclaims . innerHTML = JSON . stringify ( claims , null , " " ) ;
227+ let sc = JSON . stringify ( claims , null , 4 ) ;
228+ console . debug ( sc ) ;
229+ rclaims . innerHTML = sc ;
231230 rclaims . classList . add ( "updated" ) ;
232231 vapid . generate_keys ( ) . then ( x => {
233232 vapid . sign ( claims )
0 commit comments