Skip to content

Commit

Permalink
Changing license to AGPL-3.0-or-later
Browse files Browse the repository at this point in the history
More confusions with licensing. It seems that the code was, after all, licensed under Affero General Public License 1. That's way too old, so I'm moving it to GNU Affero General Public License 3 or later, which is essentially the same license, and allows future-proof licensing, too.
I'm not too happy about the licensing terms (too copyleft for my tastes, I prefer MIT or 3-clause BSD) , but, alas, what can I do?...
  • Loading branch information
GwynethLlewelyn committed Dec 12, 2021
1 parent ad4cd88 commit 1f96e1b
Show file tree
Hide file tree
Showing 12 changed files with 1,893 additions and 1,727 deletions.
249 changes: 205 additions & 44 deletions LICENSE.md

Large diffs are not rendered by default.

35 changes: 25 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,29 +59,41 @@ dotnet msbuild

Optionally, you may wish to run `dotnet msbuild -m` to get the Microsoft compiler to use several cores in parallel (by default, everything is compiled sequentially).

Once compiled, the new executable should be generated under `testbot-bin/net6.0`, `RESTbot`.
There will be quite a lot of warnings, mostly due to the lack of XML comments on the (many) functions. This is a work-in-progress — these days, it seems that it's almost 'mandatory' to have all functions properly documented, so that an automatic documentation file (`RESTbot.xml`) is generated. This is a Good Thing, but, remember, this code was written mostly a decade ago, when good practices such as documenting code were not _enforced_, so it means going back through all those old functions and figuring out what each of them does... thus the warnings.

Before you launch it, you'll need to create a `configuration.xml` file with the parameters for your grid, and where the 'bot should start. Go ahead and jump to [the configuration](#configuration) section.
There are also a few warnings not related to documentation, basically some stricter checking on initialisation values. These will also be addressed over time; the main goal, for now, is to get it compiled and running.

Once compiled, the new executable should be generated under `testbot-bin/net6.0`, `RESTbot`. This is a standalone executable — actually, the runtime which will load `RESTbot.dll` (also compiled on the same directory). The amazing thing is that, these days, Microsoft doesn't even require people to _use_ Mono at all — they get their Roslyn compiler to generate native code wrapped around the DLL. What could be more amazing? (Note to self: grumble to the OpenSimulator guys to get them to do the same.) We truly live in interesting times.

Also note that if you managed to install the pre-requisites using Homebrew, you _should_ also be able to compile things for your brand new Apple Silicon CPU. Aye, Microsoft is _that_ nice with their latest-generation Roslyn compiler.

Before you launch RESTbot, you'll need to create a `configuration.xml` file with the parameters for your grid, and where the 'bot should start. Go ahead and jump to [the configuration](#configuration) section.

#### ... or you can just use Visual Studio for Mac!

You wouldn't believe the tools that Microsoft has come up with to persuade non-Windows users to surrender to their integrated environment. These days, you can get [Visual Studio for Mac](https://visualstudio.microsoft.com/vs/mac/)*not* the free and open-source Visual Studio *Code*, which is a humble code editor, albeit one with a megaton of features; but rather Microsoft's own full-blown IDE with all the bells and whistles, and which looks like the Windows equivalent, but with a more Apple-ish look.

In theory, all you need is to install it — please make sure you get a version which works with **.NET** _6.0_; currently, this is **Visual Studio 2022 for Mac Preview** but expect Microsoft to move on to a non-preview (i.e. *stable*) version soon. Earlier versions will *not* work.

If you want to do actual development, especially starting the project from scratch (to adapt it to different environments, for example, such as virtual machines, Docker containers, Azure or even AWS cloud services, whatever...) then I really recommend using Visual Studio for Mac. In fact, I wasn't able to generate all the required files manually, without recourse to Visual Studio; VS basically 'prepares' everything properly, starting from the included `.csproj` (which gets changed as new references get included and others are removed), to get you a 'working' project. Once that project _is_ generated properly, _then_ you can use the command-line tools.

#### The third way...

So you're not really fond of IDEs, much less Microsoft's? You're not alone. If you don't trust Homebrew, either — or are used to a different package management system (such as [MacPorts](https://www.macports.org/)) and don't want Homebrew to interfere with it — then Microsoft gives you a further choice: just [install `dotnet` directly from Microsoft](https://dotnet.microsoft.com/download). This can be done just for the current user (in which case everything will be installed under `~/.dotnet/`) or globally for all users.

Note that, as said before, _I_ could not figure out how to pre-generate all project files, with all correctly included and imported things, just via the command-line tools. But _once_ these are generated and in place (as they are when you download/clone this project), _then_ any set of command-line tools that support NET 6.0 ought to do a successful compilation.

### Under Linux:

It's basically the same as under macOS. These days, Homebrew also works under Linux, so the instructions would be the same; but possibly you will prefer to run your 'native' package manager, be it `apt` (Debian/Linux) or `yum` (Fedora, CentOS, RedHat) or whatever is fashionable these days. You'll have to check what versions of Mono are available; remember that you'll need a 'developer' edition, and don't forget to double-check that `msbuild` and `csc` (the Microsoft Roslyn C# compiler) comes as part of the package as well.
It's basically the same as using the command-line tools under macOS; you can follow those instructions if you wish. These days, Homebrew also works under Linux, so the instructions would be the same; but possibly you will prefer to run your 'native' package manager, be it `apt` (Debian/Linux) or `yum` (Fedora, CentOS, RedHat) or whatever is fashionable these days. You'll have to check what versions of Mono are available; remember that you'll need a 'developer' edition, and don't forget to double-check that `msbuild` and `csc` (the Microsoft Roslyn C# compiler) comes as part of the package as well.

Sadly, at the time of writing, there is no Visual Studio desktop IDE for Linux. You can, however, use many of Microsoft's tools being called from the command line and integrate those in Visual Studio *Code*, which *is* available for Linux as well.

Again, like under macOS, Microsoft's Roslyn compiler will generate a Linux-native executable which will be able to launch `RESTbot.dll`, without the need of using Mono (and that executable ought to be distro-agnostic and work under _all_ of them, naturally including Microsoft's own Linux distro). I've tested it within a x86 environment, but allegedly Microsoft also supports ARM. I _do_ have a Linux ARM box to do some testing with it as well, but I haven't gotten the time to do so.

# Configuration

The default configuration file is called `configuration.xml`and should be located in the same directory as the `RESTbot` executable; under `assets/configuration`, we've provided a `configuration.xml.sample` — make sure you copy this file to `configuration.xml` and change it to reflect your (real) data.
The default configuration file is called `configuration.xml`and should be located in the same directory as the `RESTbot` executable; under `assets/configuration`, I've provided a `configuration.xml.sample` — make sure you copy this file to `configuration.xml` and change it to reflect your (real) data.

The configuration file is very flexible... if a configuration element is not defined in the file, it will revert to its default instead of stopping... so a custom configuration file can either define every single variable, or only contain one variable definition. If you want to go ahead and play with a RESTbot server now, you can go ahead and skip ahead to [Running](#running-windows) (by default, the server listens to `localhost` connections on port 9080).

Expand All @@ -97,24 +109,25 @@ A note on how commands are passed to RESTbot for processing: server commands req

The following is a list of working server commands:

* `establish_session`: this starts up a RESTBot
* `exit`: this stops a RESTBot
* `establish_session`: this starts up a RESTbot
* `exit`: this stops a RESTbot

_Note: There are plenty more commands these days that are also fully functional (gwyneth 20211121)._
_Note: There are plenty more commands these days that are also fully functional (gwyneth 20211121); these are provided by so-called 'RESTbot plugins' and the Wiki holds some documentation on them,_

Server commands are defined in the URL and arguments are passed through POST.

The most important command you will use is `establish_session` so I will first introduce you to its parameters.

Lets say we have a hypothetical bot account whose name is `Restbot Resident` and uses the password `omgrestbot` to login. To log into this bot, we would issue this command in curl:
Let's say we have a hypothetical bot account whose name is `Restbot Resident` and uses the password `omgrestbot` to login. To log into this bot, we would issue this command in curl:

```bash
curl http://localhost:9080/establish_session/pass -d first=Restbot -d last=Resident -d pass=77e854984fd6a73ece3aedab7ee9e21c
```

Some things to note in this command... everything after `-d` is a **post field**. In reality, _all_ of the post fields are spliced together as a single string separated by &'s. Also, the password *must* be `md5`'d. Lastly, notice how the `establish_session` URL is formatted. http://localhost:9080 is the RESTbot server address (`localhost` on port 9080) and that is followed by a forward slash, the word `establish_session` (the command name), and the password (which is `pass` by default). If this is not formatted correctly, an argument
Some things to note in this command... everything after `-d` is a **post field**. In reality, _all_ of the post fields are spliced together as a single string separated by &'s. Also, the password **must** be `md5`'d. Lastly, notice how the `establish_session` URL is formatted. http://localhost:9080 is the RESTbot server address (`localhost` on port 9080) and that is followed by a forward slash, the word `establish_session` (the command name), and the password (which is `pass` by default). If this is not formatted correctly, an argument
error usually is returned.

`establish_session` takes a bit of time to process, as it makes sure the bot has been able to log in before it returns a session identification key. When it does, store this key somewhere. You use this session id as an argument for any bot-specific methods (defined in plugins.)
`establish_session` takes a bit of time to process, as it makes sure the bot has been able to log in before it returns a session identification key. When it does, store this key somewhere. You use this session id as an argument for any bot-specific methods (defined by RESTbot plugins).

`exit` runs the same, but takes `session` as an argument with the session_id as the value of the argument. This will return a success/failure response.

Expand All @@ -126,4 +139,6 @@ At the root of RESTbot lies a community-managed project, originally known as *li

You can read more about the history of *LibreMetaverse* on this project's [wiki](https://github.com/GwynethLlewelyn/restbot/wiki/History) (a work in progress...)

RESTbot is therefore just 'wrapper' code that launches a mini-webserver and exposes a RESTful API to selected LibreMetaverse commands.

_Original documentation written by an anonymous collaborator at Pleiades; several changes were been made by Gwyneth Llewelyn, but trying to keep the original, light-hearted style of explaining things (gwyneth 20211121)._
Loading

0 comments on commit 1f96e1b

Please sign in to comment.