@@ -7,23 +11,27 @@
the website does not run ads, paywall features, or collect your private data in any way. i have no intention to change that since I want to provide the best possible service to the osu! community.
still, hosting a (relatively) computationally expensive service has costs that are simply unavoidable. that's why I'd encourage people that find this website useful to contribute:
-
the money will be used to pay for the server hosting and development costs.
+
the money will be uniquely used to pay for the server hosting and development costs.
- | server hosting |
- ~220$/year |
+ server hosting (contabo - cloud vps 3) |
+ ~222$/year |
- | domain |
+ domain (namecheap - .moe renewal) |
~17$/year |
-
+
+
+
+ |
+
| total |
- ~237$/year |
+ ~239$/year |
diff --git a/nise-frontend/src/app/contribute/contribute.component.ts b/nise-frontend/src/app/contribute/contribute.component.ts
index 8ad5072..c4dbca4 100644
--- a/nise-frontend/src/app/contribute/contribute.component.ts
+++ b/nise-frontend/src/app/contribute/contribute.component.ts
@@ -1,6 +1,7 @@
-import { Component } from '@angular/core';
+import {Component} from '@angular/core';
import {CuteLoadingComponent} from "../../corelib/components/cute-loading/cute-loading.component";
import {DecimalPipe, NgForOf, NgIf} from "@angular/common";
+import {UserService} from "../../corelib/service/user.service";
@Component({
selector: 'app-contribute',
@@ -16,4 +17,10 @@ import {DecimalPipe, NgForOf, NgIf} from "@angular/common";
})
export class ContributeComponent {
+ constructor(public userService: UserService) { }
+
+ hideLink(): void {
+ this.userService.ephemeralUserInfo = { ...this.userService.ephemeralUserInfo, showContributions: false };
+ }
+
}
diff --git a/nise-frontend/src/corelib/service/user.service.ts b/nise-frontend/src/corelib/service/user.service.ts
index b8df8e5..f86dabd 100644
--- a/nise-frontend/src/corelib/service/user.service.ts
+++ b/nise-frontend/src/corelib/service/user.service.ts
@@ -1,12 +1,19 @@
-import {Injectable} from '@angular/core';
-import {HttpClient} from "@angular/common/http";
-import {environment} from "../../environments/environment";
+import { Injectable } from '@angular/core';
+import { HttpClient } from '@angular/common/http';
+import { environment } from '../../environments/environment';
interface UserInfo {
userId: number;
username: string;
}
+/**
+ * This stuff gets saved to localStorage ONLY.
+ */
+interface EphemeralUserInfo {
+ showContributions: boolean;
+}
+
@Injectable({
providedIn: 'root'
})
@@ -14,14 +21,28 @@ export class UserService {
currentUser: UserInfo | null = null;
+ private _ephemeralUserInfo: EphemeralUserInfo = {
+ showContributions: true
+ };
+
loginCallback: () => void = () => {};
constructor(private httpClient: HttpClient) {
this.currentUser = this.loadCurrentUserFromLocalStorage();
+ this._ephemeralUserInfo = this.loadEphemeralUserInfoFromLocalStorage();
this.updateUser()
.catch(reason => console.debug(reason));
}
+ get ephemeralUserInfo(): EphemeralUserInfo {
+ return this._ephemeralUserInfo;
+ }
+
+ set ephemeralUserInfo(value: EphemeralUserInfo) {
+ this._ephemeralUserInfo = value;
+ this.saveEphemeralUserInfoToLocalStorage(value);
+ }
+
isUserLoggedIn(): boolean {
return this.currentUser !== null;
}
@@ -48,11 +69,11 @@ export class UserService {
}
public getLoginUrl(): string {
- return `${environment.apiUrl}/oauth2/authorization/osu`
+ return `${environment.apiUrl}/oauth2/authorization/osu`;
}
public getLogoutUrl(): string {
- return `${environment.apiUrl}/logout`
+ return `${environment.apiUrl}/logout`;
}
saveCurrentUserToLocalStorage(user: UserInfo) {
@@ -69,4 +90,13 @@ export class UserService {
document.cookie = 'SESSION=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
}
+ saveEphemeralUserInfoToLocalStorage(info: EphemeralUserInfo) {
+ localStorage.setItem('ephemeralUserInfo', JSON.stringify(info));
+ }
+
+ loadEphemeralUserInfoFromLocalStorage(): EphemeralUserInfo {
+ const savedInfo = localStorage.getItem('ephemeralUserInfo');
+ return savedInfo ? JSON.parse(savedInfo) : { showContributions: true };
+ }
+
}