Update API to .NET 5, app to latest Vue 3

This commit is contained in:
Daniel J. Summers 2020-11-18 20:47:43 -05:00
parent 167b8b7bb4
commit d2b5ddf034
5 changed files with 19169 additions and 2081 deletions

View File

@ -24,16 +24,16 @@ open JWT.Exceptions
/// Verify a user's credentials with No Agenda Social
let verifyWithMastodon accessToken = async {
use client = new HttpClient ()
use req = new HttpRequestMessage (HttpMethod.Get, (sprintf "%saccounts/verify_credentials" config.auth.apiUrl))
req.Headers.Authorization <- AuthenticationHeaderValue <| sprintf "Bearer %s" accessToken
use req = new HttpRequestMessage (HttpMethod.Get, $"{config.auth.apiUrl}accounts/verify_credentials")
req.Headers.Authorization <- AuthenticationHeaderValue $"Bearer {accessToken}"
match! client.SendAsync req |> Async.AwaitTask with
| res when res.IsSuccessStatusCode ->
let! body = res.Content.ReadAsStringAsync ()
return
match Json.deserialize<ViewModels.Citizen.MastodonAccount> body with
| profile when profile.username = profile.acct -> Ok profile
| profile -> Error (sprintf "Profiles must be from noagendasocial.com; yours is %s" profile.acct)
| res -> return Error (sprintf "Could not retrieve credentials: %d ~ %s" (int res.StatusCode) res.ReasonPhrase)
| profile -> Error $"Profiles must be from noagendasocial.com; yours is {profile.acct}"
| res -> return Error $"Could not retrieve credentials: %d{int res.StatusCode} ~ {res.ReasonPhrase}"
}
/// Create a JWT for the given user

View File

@ -29,7 +29,7 @@ module ShortId =
match text.Length with
| 12 when validShortId.IsMatch text -> (ShortId >> Ok) text
| 12 -> Error "ShortId must be 12 characters [a-z,0-9,-, or _]"
| x -> Error (sprintf "ShortId must be 12 characters; %d provided" x)
| x -> Error $"ShortId must be 12 characters; %d{x} provided"
/// The ID for a citizen (user) record

View File

@ -3,7 +3,6 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>preview</LangVersion>
</PropertyGroup>
<ItemGroup>

File diff suppressed because it is too large Load Diff

View File

@ -14,18 +14,18 @@
"vue-router": "^4.0.0-0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^2.33.0",
"@typescript-eslint/parser": "^2.33.0",
"@typescript-eslint/eslint-plugin": "^4.8.0",
"@typescript-eslint/parser": "^4.8.0",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "^4.5.4",
"@vue/cli-plugin-typescript": "^4.5.4",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0-0",
"@vue/eslint-config-typescript": "^5.0.2",
"@vue/eslint-config-typescript": "^7.0.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint": "^6.0.0",
"eslint-plugin-vue": "^7.0.0-0",
"typescript": "~3.9.3"
"typescript": "~4.0.0"
}
}