2024-06-18 06:23:03 +00:00
|
|
|
@page "/sharetext"
|
2024-06-18 01:58:51 +00:00
|
|
|
@inject NavigationManager navigationManager
|
|
|
|
@inject AuthenticationStateProvider AuthStateProvider
|
2024-06-18 06:23:03 +00:00
|
|
|
@inject State State
|
2024-06-14 07:20:04 +00:00
|
|
|
|
2024-06-18 01:58:51 +00:00
|
|
|
<PageHeading title="Status.lol" icon="fa-solid fa-message-smile">
|
|
|
|
<Description>Share a post to <a href="https://status.lol">status.lol</a></Description>
|
|
|
|
</PageHeading>
|
2024-06-14 07:20:04 +00:00
|
|
|
|
2024-06-18 01:58:51 +00:00
|
|
|
<AuthorizeView>
|
|
|
|
<Authorized>
|
|
|
|
<button class="fab circle extra large-elevate" data-ui="#post-modal">
|
|
|
|
<i class="fa-solid fa-pen-to-square"></i>
|
|
|
|
</button>
|
|
|
|
<NewStatusDialog id="post-modal" Active="true" Content="@Text"></NewStatusDialog>
|
|
|
|
</Authorized>
|
|
|
|
</AuthorizeView>
|
2024-06-14 07:20:04 +00:00
|
|
|
|
|
|
|
@code {
|
2024-06-18 06:23:03 +00:00
|
|
|
public string? Text { get; set; }
|
2024-06-18 01:58:51 +00:00
|
|
|
|
|
|
|
protected override async Task OnInitializedAsync() {
|
|
|
|
await checkLogin();
|
|
|
|
|
2024-06-18 06:23:03 +00:00
|
|
|
Text = State.ShareString;
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(State.ShareStringSubject)) {
|
|
|
|
Text = $"{State.ShareStringSubject}\n\n{State.ShareString}";
|
|
|
|
}
|
|
|
|
|
|
|
|
State.ShareStringSubject = null;
|
|
|
|
State.ShareString = null;
|
|
|
|
}
|
2024-06-18 01:58:51 +00:00
|
|
|
|
|
|
|
private async Task<bool> checkLogin() {
|
|
|
|
var authState = await AuthStateProvider.GetAuthenticationStateAsync();
|
|
|
|
var user = authState.User;
|
|
|
|
|
|
|
|
if (user.Identity is not null && user.Identity.IsAuthenticated) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
navigationManager.NavigateTo("/login");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2024-06-14 07:20:04 +00:00
|
|
|
}
|