Compare commits

..

No commits in common. "2274c34f076fe78a792f16f6ea0b6b246a0d5312" and "fd0300fccb43198c931fa3d6cb31202956d4c214" have entirely different histories.

40 changed files with 120 additions and 136 deletions

View file

@ -42,7 +42,7 @@ namespace Neighbourhood.omg.lol
string str = await response.Content.ReadAsStringAsync(); string str = await response.Content.ReadAsStringAsync();
try { try {
OmgLolResponse<T>? responseObj = await response.Content.ReadFromJsonAsync<OmgLolResponse<T>>(_serializerOptions, cancellationToken: cancellationToken); OmgLolResponse<T>? responseObj = await response.Content.ReadFromJsonAsync<OmgLolResponse<T>>(_serializerOptions, cancellationToken: cancellationToken);
if (responseObj?.Request?.Success ?? false) { if (responseObj != null && responseObj.Request.Success) {
responseData = responseObj.Response; responseData = responseObj.Response;
} }
} }
@ -66,7 +66,7 @@ namespace Neighbourhood.omg.lol
string str = await response.Content.ReadAsStringAsync(); string str = await response.Content.ReadAsStringAsync();
if (response.IsSuccessStatusCode) { if (response.IsSuccessStatusCode) {
OmgLolResponse<TResponse>? responseObj = await response.Content.ReadFromJsonAsync<OmgLolResponse<TResponse>>(_serializerOptions, cancellationToken: cancellationToken); OmgLolResponse<TResponse>? responseObj = await response.Content.ReadFromJsonAsync<OmgLolResponse<TResponse>>(_serializerOptions, cancellationToken: cancellationToken);
if (responseObj?.Request?.Success ?? false) { if (responseObj != null && responseObj.Request.Success) {
responseData = responseObj.Response; responseData = responseObj.Response;
} }
} }
@ -87,7 +87,7 @@ namespace Neighbourhood.omg.lol
HttpResponseMessage response = await _client.SendAsync(request, cancellationToken: cancellationToken); HttpResponseMessage response = await _client.SendAsync(request, cancellationToken: cancellationToken);
if (response.IsSuccessStatusCode) { if (response.IsSuccessStatusCode) {
OmgLolResponse<TResponse>? responseObj = await response.Content.ReadFromJsonAsync<OmgLolResponse<TResponse>>(_serializerOptions, cancellationToken: cancellationToken); OmgLolResponse<TResponse>? responseObj = await response.Content.ReadFromJsonAsync<OmgLolResponse<TResponse>>(_serializerOptions, cancellationToken: cancellationToken);
if (responseObj?.Request?.Success ?? false) { if (responseObj != null && responseObj.Request.Success) {
responseData = responseObj.Response; responseData = responseObj.Response;
} }
} }
@ -106,7 +106,7 @@ namespace Neighbourhood.omg.lol
string str = await response.Content.ReadAsStringAsync(); string str = await response.Content.ReadAsStringAsync();
if (response.IsSuccessStatusCode) { if (response.IsSuccessStatusCode) {
OmgLolResponse<TResponse>? responseObj = await response.Content.ReadFromJsonAsync<OmgLolResponse<TResponse>>(_serializerOptions, cancellationToken: cancellationToken); OmgLolResponse<TResponse>? responseObj = await response.Content.ReadFromJsonAsync<OmgLolResponse<TResponse>>(_serializerOptions, cancellationToken: cancellationToken);
if (responseObj?.Request?.Success ?? false) { if (responseObj != null && responseObj.Request.Success) {
responseData = responseObj.Response; responseData = responseObj.Response;
} }
} }
@ -126,7 +126,7 @@ namespace Neighbourhood.omg.lol
string str = await response.Content.ReadAsStringAsync(); string str = await response.Content.ReadAsStringAsync();
try { try {
OmgLolResponse<T>? responseObj = await response.Content.ReadFromJsonAsync<OmgLolResponse<T>>(_serializerOptions, cancellationToken: cancellationToken); OmgLolResponse<T>? responseObj = await response.Content.ReadFromJsonAsync<OmgLolResponse<T>>(_serializerOptions, cancellationToken: cancellationToken);
if (responseObj?.Request?.Success ?? false) { if (responseObj != null && responseObj.Request.Success) {
responseData = responseObj.Response; responseData = responseObj.Response;
} }
} }
@ -194,7 +194,7 @@ namespace Neighbourhood.omg.lol
public async Task<PutPicResponseData?> PutPic(string address, byte[] bytes) => public async Task<PutPicResponseData?> PutPic(string address, byte[] bytes) =>
await PutPic(address, Convert.ToBase64String(bytes)); await PutPic(address, Convert.ToBase64String(bytes));
public async Task<PutPicResponseData?> PostPicDescription(string address, string id, string? description) => public async Task<PutPicResponseData?> PostPicDescription(string address, string id, string description) =>
(await Post<PutPicResponseData, PostPic>($"/address/{address}/pics/{id}", new PostPic { Description = description })); (await Post<PutPicResponseData, PostPic>($"/address/{address}/pics/{id}", new PostPic { Description = description }));
public async Task<BasicResponseData?> DeletePic(string address, string id) => public async Task<BasicResponseData?> DeletePic(string address, string id) =>
(await Delete<BasicResponseData>($"/address/{address}/pics/{id}")); (await Delete<BasicResponseData>($"/address/{address}/pics/{id}"));

View file

@ -52,11 +52,10 @@
public string? Description { get; set; } public string? Description { get; set; }
private bool loading = false; private bool loading = false;
[Parameter] [Parameter]
public string? id { get; set; } public string id { get; set; }
private bool confirmDelete { get; set; } private bool confirmDelete { get; set; }
protected override async Task OnInitializedAsync() { protected override async Task OnInitializedAsync() {
await base.OnInitializedAsync();
Description = Pic?.Description; Description = Pic?.Description;
} }
@ -71,7 +70,7 @@
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);
if (!string.IsNullOrEmpty(Pic?.Id)) { if (!string.IsNullOrEmpty(Pic?.Id)) {
await api.DeletePic(State.SelectedAddressName!, Pic.Id); await api.DeletePic(State.SelectedAddressName, Pic.Id);
await State.RefreshPics(); await State.RefreshPics();
State.SendRefresh(); State.SendRefresh();
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);
@ -92,7 +91,7 @@
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);
if(!string.IsNullOrEmpty(Pic?.Id)) { if(!string.IsNullOrEmpty(Pic?.Id)) {
await api.PostPicDescription(State.SelectedAddressName!, Pic.Id, Description); await api.PostPicDescription(State.SelectedAddressName, Pic.Id, Description);
await State.RefreshPics(); await State.RefreshPics();
State.SendRefresh(); State.SendRefresh();
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);

View file

@ -70,11 +70,10 @@
public string? Emoji { get; set; } public string? Emoji { get; set; }
private bool loading = false; private bool loading = false;
[Parameter] [Parameter]
public string? id { get; set; } public string id { get; set; }
private bool confirmDelete { get; set; } private bool confirmDelete { get; set; }
protected override async Task OnInitializedAsync() { protected override async Task OnInitializedAsync() {
await base.OnInitializedAsync();
Content = Status?.Content; Content = Status?.Content;
Emoji = Status?.Emoji; Emoji = Status?.Emoji;
} }
@ -90,7 +89,7 @@
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);
if (!string.IsNullOrEmpty(Status?.Id)) { if (!string.IsNullOrEmpty(Status?.Id)) {
await api.DeleteStatus(State.SelectedAddressName!, Status.Id); await api.DeleteStatus(State.SelectedAddressName, Status.Id);
await State.RefreshStatuses(); await State.RefreshStatuses();
State.SendRefresh(); State.SendRefresh();
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);
@ -112,7 +111,7 @@
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);
if (!string.IsNullOrEmpty(Status?.Id)) { if (!string.IsNullOrEmpty(Status?.Id)) {
await api.PatchStatus(State.SelectedAddressName!, Status.Id, Content ?? String.Empty, Emoji); await api.PatchStatus(State.SelectedAddressName, Status.Id, Content, Emoji);
await State.RefreshStatuses(); await State.RefreshStatuses();
State.SendRefresh(); State.SendRefresh();
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);

View file

@ -7,9 +7,9 @@
@code { @code {
[Parameter] [Parameter]
public string? Url { get; set; } public string Url { get; set; }
[Parameter] [Parameter]
public string? id { get; set; } public string id { get; set; }
public MarkupString? Html { get; set; } public MarkupString? Html { get; set; }
protected override async Task OnAfterRenderAsync(bool firstRender) { protected override async Task OnAfterRenderAsync(bool firstRender) {
@ -19,13 +19,13 @@
} }
public async Task Reload() { public async Task Reload() {
if (Url != null){ // if (Html == null){
Html = await api.GetHtml(Url); Html = await api.GetHtml(Url);
string? HtmlString = Html?.ToString(); string? HtmlString = Html?.ToString();
HtmlString = HtmlString?.Replace("</head>", "<base target='_blank'></head>"); HtmlString = HtmlString?.Replace("</head>", "<base target='_blank'></head>");
HtmlString = HtmlString?.Replace("</body>", "<script src='https://cdn.jsdelivr.net/npm/@iframe-resizer/child'></script></body>"); HtmlString = HtmlString?.Replace("</body>", "<script src='https://cdn.jsdelivr.net/npm/@iframe-resizer/child'></script></body>");
Html = (MarkupString)(HtmlString ?? string.Empty); Html = (MarkupString)HtmlString;
} // }
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);
} }
} }

View file

@ -19,5 +19,5 @@
@code { @code {
[Parameter] [Parameter]
public string? @class { get; set; } public string @class { get; set; }
} }

View file

@ -8,9 +8,9 @@
@code { @code {
[Parameter] [Parameter]
public string? id { get; set; } public string id { get; set; }
[Parameter] [Parameter]
public string? @class { get; set; } public string? @class { get; set; }
[Parameter] [Parameter]
public string? icon { get; set; } public string icon { get; set; }
} }

View file

@ -32,7 +32,7 @@
@code { @code {
[Parameter] [Parameter]
public string? id { get; set; } public string id { get; set; }
[Parameter] [Parameter]
public bool Active { get; set; } public bool Active { get; set; }
[Parameter] [Parameter]

View file

@ -55,7 +55,7 @@
[Parameter] [Parameter]
public string? Description { get; set; } public string? Description { get; set; }
[Parameter] [Parameter]
public string? id { get; set; } public string id { get; set; }
[Parameter] [Parameter]
public bool Active { get; set; } public bool Active { get; set; }
@ -74,9 +74,9 @@
loading = true; loading = true;
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);
PutPicResponseData? response = await api.PutPic(State.SelectedAddressName!, Base64File!); PutPicResponseData? response = await api.PutPic(State.SelectedAddressName, Base64File);
if(!string.IsNullOrEmpty(Description) && response != null && !string.IsNullOrEmpty(response.Id)) { if(!string.IsNullOrEmpty(Description) && response != null && !string.IsNullOrEmpty(response.Id)) {
await api.PostPicDescription(State.SelectedAddressName!, response.Id, Description); await api.PostPicDescription(State.SelectedAddressName, response.Id, Description);
await State.RefreshPics(); await State.RefreshPics();
State.SendRefresh(); State.SendRefresh();
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);
@ -116,17 +116,8 @@
} }
private async Task PopulateFileDetails() { private async Task PopulateFileDetails() {
if (File == null) FileContentType = File.ContentType;
{ FileSize = await Utilities.FileSize(File);
FileContentType = null; Base64File = await Utilities.Base64FromFile(File);
FileSize = null;
Base64File = null;
}
else
{
FileContentType = File.ContentType;
FileSize = await Utilities.FileSize(File);
Base64File = await Utilities.Base64FromFile(File);
}
} }
} }

View file

@ -52,7 +52,7 @@
@code { @code {
[Parameter] [Parameter]
public string? id { get; set; } public string id { get; set; }
[Parameter] [Parameter]
public bool Active { get; set; } public bool Active { get; set; }
[Parameter] [Parameter]

View file

@ -13,9 +13,9 @@
@code { @code {
[Parameter] [Parameter]
public string? icon { get; set; } public string icon { get; set; }
[Parameter] [Parameter]
public string? title { get; set; } public string title { get; set; }
[Parameter] [Parameter]
public RenderFragment? Description { get; set; } public RenderFragment Description { get; set; }
} }

View file

@ -30,22 +30,22 @@
</nav> </nav>
@code { @code {
private MarkdownEditor? Editor; private MarkdownEditor Editor;
private bool listed; private bool listed;
private string? markdownValue; private string markdownValue;
private bool loading = false; private bool loading = false;
protected override async Task OnInitializedAsync() { protected override async Task OnInitializedAsync() {
await base.OnInitializedAsync(); await base.OnInitializedAsync();
NowContentData? data = await api.GetNowPage(State.SelectedAddressName!); NowContentData? data = await api.GetNowPage(State.SelectedAddressName);
if (data != null) if (data != null)
{ {
listed = data.Listed == 1; listed = data.Listed == 1;
markdownValue = data.Content; markdownValue = data.Content;
await Editor!.SetValueAsync(markdownValue); await Editor.SetValueAsync(markdownValue);
} }
await InvokeAsync(StateHasChanged); InvokeAsync(StateHasChanged);
} }
Task OnMarkdownValueChanged(string value) { Task OnMarkdownValueChanged(string value) {
@ -55,7 +55,7 @@
public async Task Save() { public async Task Save() {
loading = true; loading = true;
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);
var result = await api.PostNowPage(State.SelectedAddressName!, markdownValue ?? string.Empty, listed); var result = await api.PostNowPage(State.SelectedAddressName, markdownValue, listed);
if (result != null) { if (result != null) {
await State.RefreshNow(); await State.RefreshNow();
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);

View file

@ -100,7 +100,7 @@
</div> </div>
@code { @code {
private string _address = string.Empty; private string _address;
[Parameter] [Parameter]
public string Address { public string Address {
get => _address; get => _address;
@ -121,8 +121,8 @@
public ExternalPageComponent? NowPage { get; set; } public ExternalPageComponent? NowPage { get; set; }
public ExternalPageComponent? ProfilePage { get; set; } public ExternalPageComponent? ProfilePage { get; set; }
private StatusList? StatusList { get; set; } private StatusList StatusList { get; set; }
private PicList? PicList { get; set; } private PicList PicList { get; set; }
private bool IsMe { private bool IsMe {
get => Address == State.SelectedAddressName; get => Address == State.SelectedAddressName;

View file

@ -17,7 +17,7 @@
</AuthorizeView> </AuthorizeView>
@code { @code {
public string? SharePhoto { get; set; } public string SharePhoto { get; set; }
public long? SharePhotoSize { get; set; } public long? SharePhotoSize { get; set; }
public string? SharePhotoContentType { get; set; } public string? SharePhotoContentType { get; set; }
public string? SharePhotoText { get; set; } public string? SharePhotoText { get; set; }

View file

@ -1,7 +1,7 @@
@inject IJSRuntime JS @inject IJSRuntime JS
<article class="no-padding"> <article class="no-padding">
<img src="@Pic!.Url" loading="lazy"> <img src="@Pic.Url" loading="lazy">
<div class="padding"> <div class="padding">
<nav> <nav>
<a class="author" href="/person/@Pic.Address#pics"> <a class="author" href="/person/@Pic.Address#pics">
@ -35,22 +35,22 @@
@code { @code {
[Parameter] [Parameter]
public Pic? Pic {get; set;} public Pic Pic {get; set;}
[Parameter] [Parameter]
public bool Editable { get; set; } = false; public bool Editable { get; set; } = false;
[Parameter] [Parameter]
public EditPicDialog? Dialog { get; set; } public EditPicDialog? Dialog { get; set; }
private async Task EditPic(EventArgs e){ private async Task EditPic(EventArgs e){
Dialog!.Pic = Pic; Dialog.Pic = Pic;
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);
await JS.InvokeVoidAsync("ui", "#" + Dialog?.id); await JS.InvokeVoidAsync("ui", "#" + Dialog?.id);
} }
public async Task ShareClick(EventArgs e){ public async Task ShareClick(EventArgs e){
await Share.Default.RequestAsync(new ShareTextRequest{ await Share.Default.RequestAsync(new ShareTextRequest{
Uri = Pic!.Url, Uri = Pic.Url,
Text = Pic!.Description, Text = Pic.Description,
Title = "I saw this on some.pics", Title = "I saw this on some.pics",
Subject = "I saw this on some.pics" Subject = "I saw this on some.pics"
}); });

View file

@ -14,7 +14,7 @@
@code { @code {
[Parameter] [Parameter]
public Func<bool, Task<List<Pic>?>>? PicsFunc { get; set; } public Func<bool, Task<List<Pic>?>> PicsFunc { get; set; }
[Parameter] [Parameter]
public bool Editable { get; set; } = false; public bool Editable { get; set; } = false;
@ -25,8 +25,6 @@
// TODO: There is a noticable rendering delay between the pics loading and the page rendering // TODO: There is a noticable rendering delay between the pics loading and the page rendering
protected override async Task OnInitializedAsync() { protected override async Task OnInitializedAsync() {
await base.OnInitializedAsync(); await base.OnInitializedAsync();
if (PicsFunc == null) return;
if (pics == null || pics.Count == 0) pics = await PicsFunc(false); if (pics == null || pics.Count == 0) pics = await PicsFunc(false);
State.PropertyChanged += StateChanged; State.PropertyChanged += StateChanged;
State.CanRefresh = true; State.CanRefresh = true;
@ -35,8 +33,6 @@
} }
private async void StateChanged(object? sender, PropertyChangedEventArgs e) { private async void StateChanged(object? sender, PropertyChangedEventArgs e) {
if (PicsFunc == null) return;
if (e.PropertyName == nameof(State.IsRefreshing) && State.IsRefreshing) { if (e.PropertyName == nameof(State.IsRefreshing) && State.IsRefreshing) {
using (State.GetRefreshToken()){ using (State.GetRefreshToken()){
pics = await PicsFunc(true); pics = await PicsFunc(true);

View file

@ -1,6 +1,6 @@
@inject IJSRuntime JS @inject IJSRuntime JS
<article class="status gray-9-fg" style="background-color:@(Status!.Background)"> <article class="status gray-9-fg" style="background-color:@(Status.Background)">
<div class="row"> <div class="row">
<div class="emoji" data-emoji="@Status.EmojiOrDefault">@Status.EmojiOrDefault</div> <div class="emoji" data-emoji="@Status.EmojiOrDefault">@Status.EmojiOrDefault</div>
<div class="max"> <div class="max">
@ -36,21 +36,21 @@
@code { @code {
[Parameter] [Parameter]
public Status? Status { get; set; } public Status Status { get; set; }
[Parameter] [Parameter]
public bool Editable { get; set; } = false; public bool Editable { get; set; } = false;
[Parameter] [Parameter]
public EditStatusDialog? Dialog { get; set; } public EditStatusDialog? Dialog { get; set; }
private async Task EditStatus(EventArgs e) { private async Task EditStatus(EventArgs e) {
Dialog!.Status = Status; Dialog.Status = Status;
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);
await JS.InvokeVoidAsync("ui", "#" + Dialog?.id); await JS.InvokeVoidAsync("ui", "#" + Dialog?.id);
} }
public async Task ShareClick(EventArgs e){ public async Task ShareClick(EventArgs e){
await Share.Default.RequestAsync(new ShareTextRequest{ await Share.Default.RequestAsync(new ShareTextRequest{
Text = $"{Status!.Content}\n- from [@{Status.Address}]({Status.Url})", Text = $"{Status.Content}\n- from [@{Status.Address}]({Status.Url})",
Title = "I saw this on status.lol", Title = "I saw this on status.lol",
Subject = "I saw this on status.lol" Subject = "I saw this on status.lol"
}); });

View file

@ -14,7 +14,7 @@
@code { @code {
[Parameter] [Parameter]
public Func<bool, Task<List<Status>?>>? StatusFunc { get; set; } public Func<bool, Task<List<Status>?>> StatusFunc { get; set; }
[Parameter] [Parameter]
public bool Editable { get; set; } = false; public bool Editable { get; set; } = false;
@ -24,8 +24,6 @@
protected override async Task OnInitializedAsync() { protected override async Task OnInitializedAsync() {
await base.OnInitializedAsync(); await base.OnInitializedAsync();
if (StatusFunc == null) return;
if (statuses == null || statuses.Count == 0) statuses = await StatusFunc(false); if (statuses == null || statuses.Count == 0) statuses = await StatusFunc(false);
State.PropertyChanged += StateChanged; State.PropertyChanged += StateChanged;
State.CanRefresh = true; State.CanRefresh = true;
@ -34,8 +32,6 @@
} }
private async void StateChanged(object? sender, PropertyChangedEventArgs e) { private async void StateChanged(object? sender, PropertyChangedEventArgs e) {
if (StatusFunc == null) return;
if (e.PropertyName == nameof(State.IsRefreshing) && State.IsRefreshing) { if (e.PropertyName == nameof(State.IsRefreshing) && State.IsRefreshing) {
using (State.GetRefreshToken()) { using (State.GetRefreshToken()) {
statuses = await StatusFunc(true); statuses = await StatusFunc(true);

View file

@ -1,9 +1,14 @@
namespace Neighbourhood.omg.lol.Models { using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Neighbourhood.omg.lol.Models {
public class AccountResponseData : IOmgLolResponseData { public class AccountResponseData : IOmgLolResponseData {
public string Message { get; set; } = string.Empty; public string Message { get; set; }
public string Email { get; set; } = string.Empty; public string Email { get; set; }
public string Name { get; set; } = string.Empty; public string Name { get; set; }
public TimeData Created { get; set; } = TimeData.Empty; // created, api_key and settings
//TODO: api_key and settings }
}
} }

View file

@ -6,10 +6,10 @@ using System.Threading.Tasks;
namespace Neighbourhood.omg.lol.Models { namespace Neighbourhood.omg.lol.Models {
public class AddressResponseData : IOmgLolResponseData { public class AddressResponseData : IOmgLolResponseData {
public string Address { get; set; } = string.Empty; public string Address { get; set; }
public string Message { get; set; } = string.Empty; public string Message { get; set; }
public RegistrationData? Registration { get; set; } public RegistrationData Registration { get; set; }
public ExpirationData? Expiration { get; set; } public ExpirationData Expiration { get; set; }
public PreferenceData? Preferences { get; set; } public PreferenceData? Preferences { get; set; }
public class RegistrationData : TimeData { public class RegistrationData : TimeData {

View file

@ -6,6 +6,6 @@ using System.Threading.Tasks;
namespace Neighbourhood.omg.lol.Models { namespace Neighbourhood.omg.lol.Models {
public class BasicResponseData : IOmgLolResponseData { public class BasicResponseData : IOmgLolResponseData {
public string Message { get; set; } = string.Empty; public string Message { get; set; }
} }
} }

View file

@ -6,8 +6,8 @@ using System.Threading.Tasks;
namespace Neighbourhood.omg.lol.Models { namespace Neighbourhood.omg.lol.Models {
public class DirectoryResponseData : IOmgLolResponseData { public class DirectoryResponseData : IOmgLolResponseData {
public string Message { get; set; } = string.Empty; public string Message { get; set; }
public string Url { get; set; } = string.Empty; public string Url { get; set; }
public List<string> Directory { get; set; } = new List<string>(); public List<string> Directory { get; set; }
} }
} }

View file

@ -6,6 +6,6 @@ using System.Threading.Tasks;
namespace Neighbourhood.omg.lol.Models { namespace Neighbourhood.omg.lol.Models {
public class EphemeralData { public class EphemeralData {
public string Content { get; set; } = string.Empty; public string Content { get; set; }
} }
} }

View file

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace Neighbourhood.omg.lol.Models { namespace Neighbourhood.omg.lol.Models {
public class EphemeralResponseData : IOmgLolResponseData { public class EphemeralResponseData : IOmgLolResponseData {
public string Message { get; set; } = string.Empty; public string Message { get; set; }
public List<string> Content { get; set; } = new List<string>(); public List<string> Content { get; set; }
} }
} }

View file

@ -1,9 +1,9 @@
namespace Neighbourhood.omg.lol.Models namespace Neighbourhood.omg.lol.Models
{ {
public class NowData { public class NowData {
public string Address { get; set; } = string.Empty; public string Address { get; set; }
public string Url { get; set; } = string.Empty; public string Url { get; set; }
public TimeData Updated { get; set; } = TimeData.Empty; public TimeData Updated { get; set; }
public string UpdatedRelative { public string UpdatedRelative {
get => Utilities.RelativeTimeFromUnix(Convert.ToInt64(Updated.UnixEpochTime)); get => Utilities.RelativeTimeFromUnix(Convert.ToInt64(Updated.UnixEpochTime));

View file

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace Neighbourhood.omg.lol.Models { namespace Neighbourhood.omg.lol.Models {
public class NowPageResponseData : IOmgLolResponseData { public class NowPageResponseData : IOmgLolResponseData {
public string Message { get; set; } = string.Empty; public string Message { get; set; }
public NowContentData? Now { get; set; } public NowContentData Now { get; set; }
} }
} }

View file

@ -6,8 +6,8 @@ using System.Threading.Tasks;
namespace Neighbourhood.omg.lol.Models { namespace Neighbourhood.omg.lol.Models {
public class NowResponseData : IOmgLolResponseData { public class NowResponseData : IOmgLolResponseData {
public string Message { get; set; } = string.Empty; public string Message { get; set; }
public long Count { get; set; } public long Count { get; set; }
public List<NowData> Garden { get; set; } = new List<NowData>(); public List<NowData> Garden { get; set; }
} }
} }

View file

@ -1,6 +1,6 @@
namespace Neighbourhood.omg.lol.Models { namespace Neighbourhood.omg.lol.Models {
public class OmgLolResponse<TResponseData> where TResponseData : IOmgLolResponseData { public class OmgLolResponse<TResponseData> where TResponseData : IOmgLolResponseData {
public OmgLolRequestData? Request { get; set; } public OmgLolRequestData Request { get; set; }
public TResponseData? Response { get; set; } public TResponseData Response { get; set; }
} }
} }

View file

@ -6,8 +6,8 @@ using System.Threading.Tasks;
namespace Neighbourhood.omg.lol.Models { namespace Neighbourhood.omg.lol.Models {
public class PatchStatus { public class PatchStatus {
public string Id { get; set; } = string.Empty; public string Id { get; set; }
public string Content { get; set; } = string.Empty; public string Content { get; set; }
public string? Emoji { get; set; } public string? Emoji { get; set; }
} }
} }

View file

@ -6,8 +6,8 @@ using System.Threading.Tasks;
namespace Neighbourhood.omg.lol.Models { namespace Neighbourhood.omg.lol.Models {
public class PatchStatusResponseData : IOmgLolResponseData { public class PatchStatusResponseData : IOmgLolResponseData {
public string Message { get; set; } = string.Empty; public string Message { get; set; }
public string Id { get; set; } = string.Empty; public string Id { get; set; }
public string Url { get; set; } = string.Empty; public string Url { get; set; }
} }
} }

View file

@ -6,6 +6,6 @@ using System.Threading.Tasks;
namespace Neighbourhood.omg.lol.Models { namespace Neighbourhood.omg.lol.Models {
public class PostPic { public class PostPic {
public string? Description { get; set; } public string Description { get; set; }
} }
} }

View file

@ -6,6 +6,6 @@ using System.Threading.Tasks;
namespace Neighbourhood.omg.lol.Models { namespace Neighbourhood.omg.lol.Models {
public class PutPic { public class PutPic {
public string Pic { get; set; } = string.Empty; public string Pic { get; set; }
} }
} }

View file

@ -6,10 +6,10 @@ using System.Threading.Tasks;
namespace Neighbourhood.omg.lol.Models { namespace Neighbourhood.omg.lol.Models {
public class PutPicResponseData : IOmgLolResponseData { public class PutPicResponseData : IOmgLolResponseData {
public string Message { get; set; } = string.Empty; public string Message { get; set; }
public string Id { get; set; } = string.Empty; public string Id { get; set; }
public long Size { get; set; } public long Size { get; set; }
public string Mime { get; set; } = string.Empty; public string Mime { get; set; }
public string Url { get; set; } = string.Empty; public string Url { get; set; }
} }
} }

View file

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace Neighbourhood.omg.lol.Models { namespace Neighbourhood.omg.lol.Models {
public class SomePicsResponseData : IOmgLolResponseData { public class SomePicsResponseData : IOmgLolResponseData {
public string Message { get; set; } = string.Empty; public string Message { get; set; }
public List<Pic>? Pics { get; set; } public List<Pic>? Pics { get; set; }
} }
} }

View file

@ -6,9 +6,9 @@ using System.Threading.Tasks;
namespace Neighbourhood.omg.lol.Models { namespace Neighbourhood.omg.lol.Models {
public class StatusBioResponseData : IOmgLolResponseData { public class StatusBioResponseData : IOmgLolResponseData {
public string Message { get; set; } = string.Empty; public string Message { get; set; }
public string Bio { get; set; } = string.Empty; public string Bio { get; set; }
public string Css { get; set; } = string.Empty; public string Css { get; set; }
public string Head { get; set; } = string.Empty; public string Head { get; set; }
} }
} }

View file

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace Neighbourhood.omg.lol.Models { namespace Neighbourhood.omg.lol.Models {
public class StatusResponseData : IOmgLolResponseData { public class StatusResponseData : IOmgLolResponseData {
public string Message { get; set; } = string.Empty; public string Message { get; set; }
public List<Status> Statuses { get; set; } = new List<Status>(); public List<Status> Statuses { get; set; }
} }
} }

View file

@ -1,7 +1,7 @@
namespace Neighbourhood.omg.lol.Models { namespace Neighbourhood.omg.lol.Models {
public class TokenResponseData { public class TokenResponseData {
public string AccessToken { get; set; } = string.Empty; public string AccessToken { get; set; }
public string TokenType { get; set; } = string.Empty; public string TokenType { get; set; }
public string Scope { get; set; } = string.Empty; public string Scope { get; set; }
} }
} }

View file

@ -4,13 +4,13 @@ using System.Text.Json.Serialization;
namespace Neighbourhood.omg.lol.Models namespace Neighbourhood.omg.lol.Models
{ {
public class Pic { public class Pic {
public string Id { get; set; } = string.Empty; public string Id { get; set; }
public string Url { get; set; } = string.Empty; public string Url { get; set; }
public string Address { get; set; } = string.Empty; public string Address { get; set; }
public long Created { get; set; } public long Created { get; set; }
public long Size { get; set; } public long Size { get; set; }
public string Mime { get; set; } = string.Empty; public string Mime { get; set; }
public string Description { get; set; } = string.Empty; public string Description { get; set; }
public string DescriptionHtml { get => Description == null ? string.Empty : Utilities.MdToHtml(Description); } public string DescriptionHtml { get => Description == null ? string.Empty : Utilities.MdToHtml(Description); }
public DateTimeOffset CreatedTime { get => DateTimeOffset.UnixEpoch.AddSeconds(Created); } public DateTimeOffset CreatedTime { get => DateTimeOffset.UnixEpoch.AddSeconds(Created); }

View file

@ -3,16 +3,16 @@
namespace Neighbourhood.omg.lol.Models namespace Neighbourhood.omg.lol.Models
{ {
public class Status { public class Status {
public string Id { get; set; } = string.Empty; public string Id { get; set; }
public string Address { get; set; } = string.Empty; public string Address { get; set; }
public string Created { get; set; } = string.Empty; public string Created { get; set; }
public string RelativeTime { get; set; } = string.Empty; public string RelativeTime { get; set; }
public string Emoji { get; set; } = string.Empty; public string Emoji { get; set; }
public string Background { get; set; } = string.Empty; public string Background { get; set; }
public string BackgroundColor { get => Background; set => Background = "#" + value; } public string BackgroundColor { get => Background; set => Background = "#" + value; }
public string Content { get; set; } = string.Empty; public string Content { get; set; }
public string RenderedMarkdown { get; set; } = string.Empty; public string RenderedMarkdown { get; set; }
public string ExternalUrl { get; set; } = string.Empty; public string ExternalUrl { get; set; }
public DateTimeOffset CreatedTime { get => DateTimeOffset.UnixEpoch.AddSeconds(Convert.ToInt64(Created)); } public DateTimeOffset CreatedTime { get => DateTimeOffset.UnixEpoch.AddSeconds(Convert.ToInt64(Created)); }

View file

@ -10,7 +10,5 @@ namespace Neighbourhood.omg.lol.Models {
public string? Iso8601Time { get; set; } public string? Iso8601Time { get; set; }
public string? Rfc2822Time { get; set; } public string? Rfc2822Time { get; set; }
public string? RelativeTime { get; set; } public string? RelativeTime { get; set; }
public static TimeData Empty { get => new TimeData(); }
} }
} }

View file

@ -49,7 +49,7 @@ public partial class LoginWebViewPage : ContentPage
string? token = await api.OAuth(code, client_id, client_secret, redirect_uri); string? token = await api.OAuth(code, client_id, client_secret, redirect_uri);
if (!string.IsNullOrEmpty(token)) { if (!string.IsNullOrEmpty(token)) {
await ((CustomAuthenticationStateProvider)this.AuthStateProvider).Login(token); await ((CustomAuthenticationStateProvider)this.AuthStateProvider).Login(token);
NavigatorService?.NavigationManager?.NavigateTo(NavigatorService.NavigationManager.Uri, forceLoad: true); NavigatorService.NavigationManager.NavigateTo(NavigatorService.NavigationManager.Uri, forceLoad: true);
await Shell.Current.GoToAsync(".."); await Shell.Current.GoToAsync("..");
} }
} }