Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if monetization is enabled on a website #9

Merged
merged 2 commits into from
May 27, 2020

Conversation

sharon-wang
Copy link
Member

@sharon-wang sharon-wang commented May 24, 2020

Fixes: #5, fixes: #10

  • Check for monetization meta tag
  • Resolve specified payment pointer
  • Verify that resolved payment pointer is valid

Open up the console to check if the site is monetized, what the payment pointer is and what the resolved payment pointer is.

Note that the http request is currently synchronous, which is deprecated:

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.

Opened an issue: #10 to note that we should fix this. Ignoring for now since we have a backlog for the prototype.

- Check for monetization meta tag
- Resolve specified payment pointer
- Verify that resolved payment pointer is valid

Signed-off-by: sharon-wang <sharon-wang-cpsc@outlook.com>
@sharon-wang
Copy link
Member Author

To fix #10 in this PR, I will:

  1. Add an async init() function which contains a variable = await isMonetizationPresent()
  2. All functions except resolvePaymentPointer() will be async
  3. Add await to each async function as appropriate
  4. httpGet() will use fetch() API instead of the deprecated XMLHttpRequest()

Big thanks to @vezwork for referencing and explaining fetch and promises

@sharon-wang
Copy link
Member Author

@vezwork This PR is ready for review!

Added fetch API to handle async http, which fixes #10.

@sharon-wang
Copy link
Member Author

Just read over the SPSP Spec, I think I'm missing this:

Raw endpoint URL (Not recommended) https://example.com/spsp/alice. This SHOULD NOT be exposed to users, but SHOULD be supported by SPSP Clients.

This to me sounds like raw endpoint URLs (https://host.com/path) might be used in the monetization meta tag instead of a payment pointer ($host.com/path).

@vezwork What do you think?

Copy link
Member

@vezwork vezwork left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great

popup.js Outdated Show resolved Hide resolved
@vezwork
Copy link
Member

vezwork commented May 27, 2020

Just read over the SPSP Spec, I think I'm missing this:

Raw endpoint URL (Not recommended) https://example.com/spsp/alice. This SHOULD NOT be exposed to users, but SHOULD be supported by SPSP Clients.

This to me sounds like raw endpoint URLs (https://host.com/path) might be used in the monetization meta tag instead of a payment pointer ($host.com/path).

@vezwork What do you think?

Good to make note of, but I don't think it's worth worrying about unless we come across a problem caused by this. We could add an issue with a low priority tag for this?

@sharon-wang
Copy link
Member Author

sharon-wang commented May 27, 2020

Good to make note of, but I don't think it's worth worrying about unless we come across a problem caused by this. We could add an issue with a low priority tag for this?

Added #11 with a low priority tag so we can look into this later on :)

Signed-off-by: sharon-wang <sharon-wang-cpsc@outlook.com>
@sharon-wang
Copy link
Member Author

@vezwork fixed the typo and added a link to Interledger SPSP Endpoint Specification. Merging!

@sharon-wang sharon-wang merged commit ac6af61 into esse-dev:master May 27, 2020
@sharon-wang sharon-wang added the GftW x DEV Hackathon Part of our hackathon prototype label May 29, 2020
@sharon-wang sharon-wang deleted the checkForMonetization branch June 4, 2020 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GftW x DEV Hackathon Part of our hackathon prototype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make http request asynchronous Check for monetization meta tag on a webpage
2 participants