Add ability to disabled instances (#33)
This commit is contained in:
parent
b591bf746c
commit
bf5a3a95c4
|
@ -43,6 +43,10 @@ export interface Instance {
|
||||||
abbr : string
|
abbr : string
|
||||||
/** The client ID (assigned by the Mastodon server) */
|
/** The client ID (assigned by the Mastodon server) */
|
||||||
clientId : string
|
clientId : string
|
||||||
|
/** Whether this instance is enabled */
|
||||||
|
isEnabled : boolean
|
||||||
|
/** If disabled, the reason why it is disabled */
|
||||||
|
reason : string
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A job listing */
|
/** A job listing */
|
||||||
|
|
|
@ -5,7 +5,10 @@ article
|
||||||
template(v-else)
|
template(v-else)
|
||||||
p.text-center Please select your No Agenda-affiliated Mastodon instance
|
p.text-center Please select your No Agenda-affiliated Mastodon instance
|
||||||
p.text-center(v-for="it in instances" :key="it.abbr")
|
p.text-center(v-for="it in instances" :key="it.abbr")
|
||||||
|
template(v-if="it.isEnabled")
|
||||||
button.btn.btn-primary(@click.prevent="select(it.abbr)") {{it.name}}
|
button.btn.btn-primary(@click.prevent="select(it.abbr)") {{it.name}}
|
||||||
|
template(v-else).
|
||||||
|
#[button.btn.btn-secondary(disabled="disabled") {{it.name}}]#[br]#[em {{it.reason}}]
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|
|
@ -13,9 +13,10 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Markdig" Version="0.25.0" />
|
<PackageReference Include="Markdig" Version="0.30.2" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Options" Version="5.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
|
||||||
<PackageReference Include="NodaTime" Version="3.0.5" />
|
<PackageReference Include="NodaTime" Version="3.1.0" />
|
||||||
|
<PackageReference Update="FSharp.Core" Version="6.0.5" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -88,6 +88,10 @@ type MastodonInstance () =
|
||||||
member val ClientId = "" with get, set
|
member val ClientId = "" with get, set
|
||||||
/// The cryptographic secret (provided by the Mastodon server)
|
/// The cryptographic secret (provided by the Mastodon server)
|
||||||
member val Secret = "" with get, set
|
member val Secret = "" with get, set
|
||||||
|
/// Whether the instance is currently enabled
|
||||||
|
member val IsEnabled = true with get, set
|
||||||
|
/// If an instance is disabled, the reason for it being disabled
|
||||||
|
member val Reason = "" with get, set
|
||||||
|
|
||||||
|
|
||||||
/// The authorization options for Jobs, Jobs, Jobs
|
/// The authorization options for Jobs, Jobs, Jobs
|
||||||
|
@ -112,6 +116,10 @@ type Instance =
|
||||||
abbr : string
|
abbr : string
|
||||||
/// The client ID (assigned by the Mastodon server)
|
/// The client ID (assigned by the Mastodon server)
|
||||||
clientId : string
|
clientId : string
|
||||||
|
/// Whether this instance is currently enabled
|
||||||
|
isEnabled : bool
|
||||||
|
/// If not enabled, the reason the instance is disabled
|
||||||
|
reason : string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ let configureServices (svc : IServiceCollection) =
|
||||||
svc.Configure<AuthOptions> (cfg.GetSection "Auth") |> ignore
|
svc.Configure<AuthOptions> (cfg.GetSection "Auth") |> ignore
|
||||||
|
|
||||||
let dbCfg = cfg.GetSection "Rethink"
|
let dbCfg = cfg.GetSection "Rethink"
|
||||||
let log = svcs.GetRequiredService<ILoggerFactory>().CreateLogger (nameof Data.Startup)
|
let log = svcs.GetRequiredService<ILoggerFactory>().CreateLogger "JobsJobsJobs.Api.Data.Startup"
|
||||||
let conn = Data.Startup.createConnection dbCfg log
|
let conn = Data.Startup.createConnection dbCfg log
|
||||||
svc.AddSingleton conn |> ignore
|
svc.AddSingleton conn |> ignore
|
||||||
Data.Startup.establishEnvironment dbCfg log conn |> Data.awaitIgnore
|
Data.Startup.establishEnvironment dbCfg log conn |> Data.awaitIgnore
|
||||||
|
|
|
@ -186,6 +186,8 @@ module Instances =
|
||||||
url = inst.Url
|
url = inst.Url
|
||||||
abbr = inst.Abbr
|
abbr = inst.Abbr
|
||||||
clientId = inst.ClientId
|
clientId = inst.ClientId
|
||||||
|
isEnabled = inst.IsEnabled
|
||||||
|
reason = inst.Reason
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: /api/instances
|
// GET: /api/instances
|
||||||
|
|
|
@ -28,7 +28,9 @@
|
||||||
<PackageReference Include="NodaTime.Serialization.JsonNet" Version="3.0.0" />
|
<PackageReference Include="NodaTime.Serialization.JsonNet" Version="3.0.0" />
|
||||||
<PackageReference Include="Polly" Version="7.2.2" />
|
<PackageReference Include="Polly" Version="7.2.2" />
|
||||||
<PackageReference Include="RethinkDb.Driver" Version="2.3.150" />
|
<PackageReference Include="RethinkDb.Driver" Version="2.3.150" />
|
||||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.11.1" />
|
<PackageReference Include="RethinkDb.Driver.FSharp" Version="0.9.0-beta-05" />
|
||||||
|
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.21.0" />
|
||||||
|
<PackageReference Update="FSharp.Core" Version="6.0.5" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -5,17 +5,23 @@
|
||||||
"0": {
|
"0": {
|
||||||
"Name": "No Agenda Social",
|
"Name": "No Agenda Social",
|
||||||
"Url": "https://noagendasocial.com",
|
"Url": "https://noagendasocial.com",
|
||||||
"Abbr": "nas"
|
"Abbr": "nas",
|
||||||
|
"IsEnabled": true,
|
||||||
|
"Reason": ""
|
||||||
},
|
},
|
||||||
"1": {
|
"1": {
|
||||||
"Name": "ITM Slaves!",
|
"Name": "ITM Slaves!",
|
||||||
"Url": "https://itmslaves.com",
|
"Url": "https://itmslaves.com",
|
||||||
"Abbr": "itm"
|
"Abbr": "itm",
|
||||||
|
"IsEnabled": false,
|
||||||
|
"Reason": "This site has changed platforms, and its integration is not yet restored"
|
||||||
},
|
},
|
||||||
"2": {
|
"2": {
|
||||||
"Name": "Liberty Woof",
|
"Name": "Liberty Woof",
|
||||||
"Url": "https://libertywoof.com",
|
"Url": "https://libertywoof.com",
|
||||||
"Abbr": "lw"
|
"Abbr": "lw",
|
||||||
|
"IsEnabled": false,
|
||||||
|
"Reason": "This site may have gone away; it is currently inaccessible"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user