forked from extern/FakeRelay
Rename things once again
This commit is contained in:
parent
0ca3dea9f6
commit
e716cf63fc
22
README.md
22
README.md
@ -56,7 +56,7 @@ version: '2'
|
|||||||
services:
|
services:
|
||||||
fakerelay:
|
fakerelay:
|
||||||
image: 'ghcr.io/g3rv4/fakerelay:latest'
|
image: 'ghcr.io/g3rv4/fakerelay:latest'
|
||||||
command: 'web'
|
command: web
|
||||||
hostname: fakerelay
|
hostname: fakerelay
|
||||||
environment:
|
environment:
|
||||||
- ASPNETCORE_ENVIRONMENT=Production
|
- ASPNETCORE_ENVIRONMENT=Production
|
||||||
@ -92,42 +92,42 @@ If you want requests to the homepage to redirect visitors somewhere, you can add
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### List authorized hosts
|
### List authorized instances
|
||||||
```
|
```
|
||||||
g3rv4@s1:~/docker/FakeRelay$ docker-compose run --rm cli list-instances
|
g3rv4@s1:~/docker/FakeRelay$ docker-compose run --rm cli list-instances
|
||||||
┌─────────────────┬──────────────────────────────────────────────────────────────────────────────────────────┐
|
┌─────────────────┬──────────────────────────────────────────────────────────────────────────────────────────┐
|
||||||
│ Host │ Key │
|
│ Instance │ Key │
|
||||||
├─────────────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
|
├─────────────────┼──────────────────────────────────────────────────────────────────────────────────────────┤
|
||||||
│ m2.g3rv4.com │ KlYKnm9GJcM0B1p8K98vw8FSpWzWOimZ7/3C9kTdWGUmK3xmFEJJwTZ1wqERVTugLH/9alYILFehqu9Ns2MEAw== │
|
│ m2.g3rv4.com │ KlYKnm9GJcM0B1p8K98vw8FSpWzWOimZ7/3C9kTdWGUmK3xmFEJJwTZ1wqERVTugLH/9alYILFehqu9Ns2MEAw== │
|
||||||
│ mastodon.social │ 1TxL6m1Esx6tnv4EPxscvAmdQN7qSn0nKeyoM7LD8b9mz+GNfrKaHiWgiT3QcNMUA+dWLyWD8qyl1MuKJ+4uHA== │
|
│ mastodon.social │ 1TxL6m1Esx6tnv4EPxscvAmdQN7qSn0nKeyoM7LD8b9mz+GNfrKaHiWgiT3QcNMUA+dWLyWD8qyl1MuKJ+4uHA== │
|
||||||
└─────────────────┴──────────────────────────────────────────────────────────────────────────────────────────┘
|
└─────────────────┴──────────────────────────────────────────────────────────────────────────────────────────┘
|
||||||
```
|
```
|
||||||
|
|
||||||
### Add authorized hosts
|
### Add authorized instance
|
||||||
|
|
||||||
You can add hosts, and that will generate their tokens using the `add-host` command. That will output the key:
|
When you add an instance, the system will generate a token to index stuff on it and return that:
|
||||||
|
|
||||||
```
|
```
|
||||||
g3rv4@s1:~/docker/FakeRelay$ docker-compose run --rm cli host add mastodon.social
|
g3rv4@s1:~/docker/FakeRelay$ docker-compose run --rm cli instance add mastodon.social
|
||||||
Key generated for mastodon.social
|
Key generated for mastodon.social
|
||||||
vti7J0MDDw1O5EPRwfuUafJJjpErhXTwECGEvuw/G4UVWgLXtnrnmPIRRsOcvMD0juwSlvUnchIzgla030AIRw==
|
vti7J0MDDw1O5EPRwfuUafJJjpErhXTwECGEvuw/G4UVWgLXtnrnmPIRRsOcvMD0juwSlvUnchIzgla030AIRw==
|
||||||
```
|
```
|
||||||
|
|
||||||
### Rotate a key
|
### Rotate a key
|
||||||
|
|
||||||
You can use `update-host` to rotate a hosts' key:
|
You can use `instance update` to rotate a instance's key:
|
||||||
|
|
||||||
```
|
```
|
||||||
g3rv4@s1:~/docker/FakeRelay$ docker-compose run --rm cli host update mastodon.social
|
g3rv4@s1:~/docker/FakeRelay$ docker-compose run --rm cli instance update mastodon.social
|
||||||
Key generated for mastodon.social
|
Key generated for mastodon.social
|
||||||
wpSX9xpPgX0gjgAxO0Jc+GLSOXubVgv73FOvAihR2EmgK/AfDHz21sF72uqrLnVGzcq2BDXosMeKdFR76q6fpg==
|
wpSX9xpPgX0gjgAxO0Jc+GLSOXubVgv73FOvAihR2EmgK/AfDHz21sF72uqrLnVGzcq2BDXosMeKdFR76q6fpg==
|
||||||
```
|
```
|
||||||
|
|
||||||
### Remove a host
|
### Remove an instance
|
||||||
|
|
||||||
If you want to revoke a host's key, you can use `delete-host`:
|
If you want to revoke a instance's key, you can use `instance delete`:
|
||||||
|
|
||||||
```
|
```
|
||||||
g3rv4@s1:~/docker/FakeRelay$ docker-compose run --rm cli host delete mastodon.social
|
g3rv4@s1:~/docker/FakeRelay$ docker-compose run --rm cli instance delete mastodon.social
|
||||||
Key deleted for mastodon.social
|
Key deleted for mastodon.social
|
||||||
```
|
```
|
@ -5,9 +5,9 @@ using Spectre.Console.Cli;
|
|||||||
|
|
||||||
namespace FakeRelay.Cli.Commands;
|
namespace FakeRelay.Cli.Commands;
|
||||||
|
|
||||||
public class AddHostCommand : ConfigEnabledAsyncCommand<HostSettings>
|
public class AddInstanceCommand : ConfigEnabledAsyncCommand<InstanceSettings>
|
||||||
{
|
{
|
||||||
public override async Task<int> ExecuteAsync(CommandContext context, HostSettings settings)
|
public override async Task<int> ExecuteAsync(CommandContext context, InstanceSettings settings)
|
||||||
{
|
{
|
||||||
var token = await ApiKeysHelper.AddTokenForHostAsync(settings.Host);
|
var token = await ApiKeysHelper.AddTokenForHostAsync(settings.Host);
|
||||||
AnsiConsole.Markup($"[green]Key generated for {settings.Host}[/]\n");
|
AnsiConsole.Markup($"[green]Key generated for {settings.Host}[/]\n");
|
@ -5,9 +5,9 @@ using Spectre.Console.Cli;
|
|||||||
|
|
||||||
namespace FakeRelay.Cli.Commands;
|
namespace FakeRelay.Cli.Commands;
|
||||||
|
|
||||||
public class DeleteHostCommand : ConfigEnabledAsyncCommand<HostSettings>
|
public class DeleteInstanceCommand : ConfigEnabledAsyncCommand<InstanceSettings>
|
||||||
{
|
{
|
||||||
public override async Task<int> ExecuteAsync(CommandContext context, HostSettings settings)
|
public override async Task<int> ExecuteAsync(CommandContext context, InstanceSettings settings)
|
||||||
{
|
{
|
||||||
await ApiKeysHelper.DeleteTokenForHostAsync(settings.Host);
|
await ApiKeysHelper.DeleteTokenForHostAsync(settings.Host);
|
||||||
AnsiConsole.Markup($"[green]Key deleted for {settings.Host}[/]\n");
|
AnsiConsole.Markup($"[green]Key deleted for {settings.Host}[/]\n");
|
@ -14,7 +14,7 @@ public class ListInstancesCommand : ConfigEnabledAsyncCommand<EmptyCommandSettin
|
|||||||
// Create a table
|
// Create a table
|
||||||
var table = new Table();
|
var table = new Table();
|
||||||
|
|
||||||
table.AddColumn("Host");
|
table.AddColumn("Instance");
|
||||||
table.AddColumn("Key");
|
table.AddColumn("Key");
|
||||||
|
|
||||||
foreach (var group in hostToKeys)
|
foreach (var group in hostToKeys)
|
||||||
|
@ -5,9 +5,9 @@ using Spectre.Console.Cli;
|
|||||||
|
|
||||||
namespace FakeRelay.Cli.Commands;
|
namespace FakeRelay.Cli.Commands;
|
||||||
|
|
||||||
public class UpdateHostCommand : ConfigEnabledAsyncCommand<HostSettings>
|
public class UpdateInstanceCommand : ConfigEnabledAsyncCommand<InstanceSettings>
|
||||||
{
|
{
|
||||||
public override async Task<int> ExecuteAsync(CommandContext context, HostSettings settings)
|
public override async Task<int> ExecuteAsync(CommandContext context, InstanceSettings settings)
|
||||||
{
|
{
|
||||||
var token = await ApiKeysHelper.UpdateTokenForHostAsync(settings.Host);
|
var token = await ApiKeysHelper.UpdateTokenForHostAsync(settings.Host);
|
||||||
AnsiConsole.Markup($"[green]Key generated for {settings.Host}[/]\n");
|
AnsiConsole.Markup($"[green]Key generated for {settings.Host}[/]\n");
|
@ -5,14 +5,14 @@ using Spectre.Console.Cli;
|
|||||||
var app = new CommandApp();
|
var app = new CommandApp();
|
||||||
app.Configure(config =>
|
app.Configure(config =>
|
||||||
{
|
{
|
||||||
config.AddBranch<EmptyBaseSettings>("host", host =>
|
config.AddBranch<EmptyBaseSettings>("instance", instance =>
|
||||||
{
|
{
|
||||||
host.AddCommand<AddHostCommand>("add")
|
instance.AddCommand<AddInstanceCommand>("add")
|
||||||
.WithDescription("Adds a host to the relay and generates a key.");
|
.WithDescription("Adds an instance to the relay and generates a key.");
|
||||||
host.AddCommand<UpdateHostCommand>("update")
|
instance.AddCommand<UpdateInstanceCommand>("update")
|
||||||
.WithDescription("Generates a new key for the host. The old one can't be used anymore.");
|
.WithDescription("Generates a new key for the instance. The old one can't be used anymore.");
|
||||||
host.AddCommand<DeleteHostCommand>("delete")
|
instance.AddCommand<DeleteInstanceCommand>("delete")
|
||||||
.WithDescription("Deletes the existing keys for the host. They can't use FakeRelay anymore.");
|
.WithDescription("Deletes the existing keys for the instance. They can't use FakeRelay anymore.");
|
||||||
});
|
});
|
||||||
|
|
||||||
config.AddCommand<ListInstancesCommand>("list-instances")
|
config.AddCommand<ListInstancesCommand>("list-instances")
|
||||||
|
@ -3,7 +3,7 @@ using Spectre.Console.Cli;
|
|||||||
|
|
||||||
namespace FakeRelay.Cli.Settings;
|
namespace FakeRelay.Cli.Settings;
|
||||||
|
|
||||||
public class HostSettings : EmptyBaseSettings
|
public class InstanceSettings : EmptyBaseSettings
|
||||||
{
|
{
|
||||||
[Description("The instance that connects to this FakeRelay.")]
|
[Description("The instance that connects to this FakeRelay.")]
|
||||||
[CommandArgument(0, "<INSTANCE_HOST>")]
|
[CommandArgument(0, "<INSTANCE_HOST>")]
|
Loading…
Reference in New Issue
Block a user