6.0.0 • Published 2 months ago

rel-payment v6.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
2 months ago

rel-payment

Discover rel="payment" donation URIs given a URL for a page which may contain them.

Usage

import relPayment from 'rel-payment';

// The url parameter may also be a WHATWG URL object.
relPayment('https://qubyte.codes').then(
  paymentUris => console.log(paymentUris),
  err => console.error(err)
);

where paymentUris looks like:

{
  fromLinkHeaders: [], // Array of objects distilled from link headers.
  fromAnchors: [],     // Array of objects distilled from anchors tags.
  fromLinks: []        // Array of objects distilled from link tags.
}

and where each object looks like:

{
  url: new URL('https://example.com/payment'), // Absolute WHATWG URL object for payments.
  title: 'Some info about the payment.'
}

The title field is populated by the title attribute of the tag.

HTTP

Be default HTTP pages are not searched for payment links, since it's trivial to rewrite pages and add link headers. However, if you want to enable this behaviour you may pass { allowHttp: true } as the second argument to relPayment.

HTTPS

Pages with valid certificates will be searched as expected. Pages without a valid certificate will cause the call to relPayment to throw an error.

6.0.0

2 months ago

5.0.0

1 year ago

4.1.0

2 years ago

4.0.0

2 years ago

4.1.2

2 years ago

4.1.1

2 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.0.0

3 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago