Logo Decentralized Social Network

moeralib/universal-location

Constants

REDIRECTOR = "moera-page"

Host used as redirector in universal URLs.

Functions

parse(url)

Parse the location part (including query and fragment) of a universal URL.

Parameters:
urlstring | null – the URL to be parsed
Return value:
UniversalLocation – the parsed location

redirectToUrl(nodeName, url=null)

Build a universal Moera URL from the direct URL of a page on a node, adding the node name provided.

Parameters:
nodeNamestring | null – the node name
url?string | null – the direct URL
Return value:
string – the universal URL

redirectTo(nodeName, rootUrl, path=null, query=null, fragment=null)

Build a universal Moera URL from the node name, the Moera root URL of the node, virtual path and other components.

Parameters:
node_namestring | null – the node name
rootUrlstring | null – the Moera root URL of the node
path?string | null – virtual path at the node ('/', if set to null or empty)
query?string | null – query component of the URL
fragment?string | null – fragment identifier of the URL
Return value:
string – the universal URL

UniversalLocation

Represents location part of a universal Moera URL.

nodeName

string | null – The node name.

scheme

string – Scheme specifier of the node location.

authority

string | null – Authority (host name and optional port) of the node location.

path

string | null – Virtual path at the node.

location

string(read only) Universal Moera location (without query and fragment).

query

string | null – Query component of the URL.

fragment

string | null – Fragment identifier of the URL.

UniversalLocation(nodeName=null, scheme=null, authority=null, path=null, query=null, fragment=null)

Parameters:
nodeName?string | null – the node name
scheme?string | null – scheme specifier of the node location ('https', if set to null or empty)
authority?string | null – authority (host name and optional port) of the node location
path?string | null – virtual path at the node ('/', if set to null or empty)
query?string | null – query component of the URL (without ?)
fragment?string | null – fragment identifier of the URL (without #)