Coder Social home page Coder Social logo

prim-dns's Introduction

What is prim-dns?

prim-dns is a permanent, customizable SecondLife prim URL webservice.

Scripts in SecondLife can request URLs via llRequestURL or llRequestSecureURL, which allow them to receive and respond to HTTP requests from other scripts or even from outside of SecondLife. However, these URLs are temporary, and scripts need to request new URLs periodically, for example when the region the script is in restarts. prim-dns allows a prim to create a permanent URL which points to the temporary one, and then update it whenever it receives a new temporary URL. Other entities can use this permanent URL to obtain the current temporary one at any given time.

The prim-dns-server project provides a script which handles automatically obtaining a URL for a prim and registering it on the prim-dns webservice, and forwards requests to additional scripts via link messages to handle them. The API documentation below is only needed if you wish to create your own script from scratch or interact with the API via some other method.

API documentation

Alias

POST /alias

Create or update an alias for a SecondLife prim URL. A prim should make this request whenever it receives a new URL, such as when the script is restarted, the prim changes regions, or the region the prim is in restarts.

Headers

  • X-SecondLife-Object-Key The key of the requesting prim, used as the name of the alias if no custom name is provided.
  • Authorization The auth string is required to update an existing alias, but may be omitted when creating a new alias.

Request JSON

  • name A custom name for the alias. If omitted, the requesting prim's key (from the X-SecondLife-Object-Key header) is used as the name.
  • url The SecondLife prim URL that the alias is for.

Response JSON

  • name The name of the created alias.
  • auth The auth string that should be used in the Authorization header in order to update or delete the alias.
  • endpoint The full endpoint URL for the alias.
  • redirect A URL that can be used to send requests directly to the prim.

    Note: This cannot be used by scripts to make POST requests to the prim, as llHTTPRequest does not handle redirects for POST requests transparently.

Example

Creating a new alias
llHTTPRequest("https://annapuddles.com/prim-dns/alias", [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/json"], llList2Json(JSON_OBJECT, ["name", "example", "url", "https://google.com"]));
{
  "name": "example",
  "auth": "0ba171f25c8e8f8fd60dc58781239faf03ffe260",
  "endpoint": "https://annapuddles.com/prim-dns/alias/example",
  "redirect": "https://annapuddles.com/prim-dns/redirect/example"
}
Updating an existing alias
llHTTPRequest("https://annapuddles.com/prim-dns/alias", [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/json", HTTP_CUSTOM_HEADER, "Authorization", "0ba171f25c8e8f8fd60dc58781239faf03ffe260"], llList2Json(JSON_OBJECT, ["name", "example", "url", "https://google.com"]));
{
  "name": "example",
  "endpoint": "https://annapuddles.com/prim-dns/alias/example",
  "redirect": "https://annapuddles.com/prim-dns/redirect/example"
}

GET /alias/{name}

Get the current SecondLife prim URL for an alias.

Response JSON

  • url The prim URL that the alias is for.
  • expires The date and time at which the alias will expire if it has not been accessed again.

Example

llHTTPRequest("https://annapuddles.com/prim-dns/alias/example", [], "");
{
  "url": "https://google.com",
  "expires": "2023-02-08 16:40:43"
}

DELETE /alias/{name}

Delete an existing alias.

Headers

  • Authorization The auth string for the alias.

Example

llHTTPRequest("https://annapuddles.com/prim-dns/alias/example", [HTTP_METHOD, "DELETE", HTTP_CUSTOM_HEADER, "Authorization", "0ba171f25c8e8f8fd60dc58781239faf03ffe260"], "");

prim-dns's People

Contributors

annapuddles avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.