Skip to content

Commit

Permalink
Merge branch 'develop' into hotfix/check-attestation-detils
Browse files Browse the repository at this point in the history
  • Loading branch information
akakou committed Oct 4, 2024
2 parents ab157e5 + e6e5bfa commit dc807d0
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 31 deletions.
16 changes: 7 additions & 9 deletions ta/example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/akakou/ra_webs/ta"
)

const REDIRECT_PATH = "/app/redirect/"
const POPUP_PATH = "/app/verification-status/"

func main() {
config, err := ta.DefaultConfig()
Expand All @@ -31,14 +31,12 @@ func main() {
Value: "true",
})

fmt.Fprintf(w, `
We will redirect verifier after 3 second....
<script>
setTimeout(() => {
location.href = '%v'
}, 3000)
</script>
`, config.Verifiers[0]+REDIRECT_PATH)
fmt.Fprintln(w, `We open verifier....<br/>`)
fmt.Fprint(w, `<script>`)
for _, v := range config.Verifiers {
fmt.Fprintf(w, `open('%v');`, v+POPUP_PATH)
}
fmt.Fprintln(w, `</script>`)
}

fmt.Fprintln(w, "Hello from TA running on TEE :)")
Expand Down
2 changes: 1 addition & 1 deletion verifier/serv/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (t *Template) Render(w io.Writer, name string, data interface{}, c echo.Con

func InjectSWHeader(next echo.HandlerFunc) echo.HandlerFunc {
return func(c echo.Context) error {
c.Response().Header().Set("Service-Worker-Allowed", "/app/redirect/")
c.Response().Header().Set("Service-Worker-Allowed", "/app/verification-status/")
return next(c)
}
}
Expand Down
2 changes: 1 addition & 1 deletion verifier/serv/static/js/notify.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const setupNotification = async (domain) => {

let subscription
try {
await navigator.serviceWorker.register('/static/js/sw/service-worker.js', {scope: "/app/redirect/"})
await navigator.serviceWorker.register('/static/js/sw/service-worker.js', {scope: "/app/verification-status/"})
const sw = await navigator.serviceWorker.ready;

subscription = await sw.pushManager.subscribe({
Expand Down
19 changes: 0 additions & 19 deletions verifier/serv/static/js/ui/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,6 @@ const App = () => {
setIsValid(v)
setMessage(message)

if (v) {
setTimeout(() => {
if (localStorage.stopAutoRedirect == 'true') {
setMessage(VALID_AND_STOP_MESSAGE)
return
}

window.location = document.referrer

}, 5000)
}
}, []);

return (
Expand All @@ -50,14 +39,6 @@ const App = () => {
<h3>Message: </h3>
<p>{message}</p>

<input
type="checkbox"
name="subscribe"
defaultChecked={localStorage.stopAutoRedirect == 'true'}
onChange={e => {
localStorage.stopAutoRedirect = e.target.checked
}}
/>
<label for="autoredirect">Do not redirect back automatically</label>


Expand Down
1 change: 0 additions & 1 deletion verifier/serv/static/js/ui/param.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const VALID_MESSAGE = "It will be back...after 5 sec..."
const VALID_AND_STOP_MESSAGE = (<div>Go <a href={document.referrer}>back</a></div>)
const INVALID_MESSAGE = "The verification is failed."

File renamed without changes.

0 comments on commit dc807d0

Please sign in to comment.