This commit is contained in:
sdarbinyan
2026-05-07 00:51:09 +04:00
parent cdb9760033
commit 976eb33492
6 changed files with 63 additions and 14 deletions

View File

@@ -47,7 +47,9 @@
"modal_paid_title": "Paid", "modal_paid_title": "Paid",
"modal_paid_sub": "fastCHECK successfully accepted.", "modal_paid_sub": "fastCHECK successfully accepted.",
"share_email": "Send by email", "share_email": "Send by email",
"share_tg": "Send via Telegram" "share_tg": "Send via Telegram",
"modal_loggedin_title": "Signed in",
"modal_loggedin_sub": "You are now signed in to fastCHECK."
}, },
"create": { "create": {
"title": "New", "title": "New",

View File

@@ -47,7 +47,9 @@
"modal_paid_title": "Վճարված է", "modal_paid_title": "Վճարված է",
"modal_paid_sub": "fastCHECK-ը հաջողությամբ ընդունված է:", "modal_paid_sub": "fastCHECK-ը հաջողությամբ ընդունված է:",
"share_email": "Ուղարկել էլ. նամակով", "share_email": "Ուղարկել էլ. նամակով",
"share_tg": "Ուղարկել Telegram-ով" "share_tg": "Ուղարկել Telegram-ով",
"modal_loggedin_title": "Մուտք գործել",
"modal_loggedin_sub": "Դուք մուտք գործել եք fastCHECK:"
}, },
"create": { "create": {
"title": "Նոր", "title": "Նոր",

View File

@@ -47,7 +47,9 @@
"modal_paid_title": "Оплачено", "modal_paid_title": "Оплачено",
"modal_paid_sub": "fastCHECK успешно принят.", "modal_paid_sub": "fastCHECK успешно принят.",
"share_email": "Отправить на почту", "share_email": "Отправить на почту",
"share_tg": "Отправить в Telegram" "share_tg": "Отправить в Telegram",
"modal_loggedin_title": "Вы вошли",
"modal_loggedin_sub": "Вы авторизованы в fastCHECK."
}, },
"create": { "create": {
"title": "Новый", "title": "Новый",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 KiB

After

Width:  |  Height:  |  Size: 123 KiB

View File

@@ -133,11 +133,16 @@
stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"> stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<path d="M20 6L9 17l-5-5" /> <path d="M20 6L9 17l-5-5" />
</svg> </svg>
@if (loginOnly()) {
<h2 class="modal__title">{{ 'fastcheck.modal_loggedin_title' | translate }}</h2>
<p class="modal__sub">{{ 'fastcheck.modal_loggedin_sub' | translate }}</p>
} @else {
<h2 class="modal__title">{{ 'fastcheck.modal_paid_title' | translate }}</h2> <h2 class="modal__title">{{ 'fastcheck.modal_paid_title' | translate }}</h2>
<p class="modal__sub"> <p class="modal__sub">
<span class="brand"><span class="brand__fast">fast</span><span class="brand__check">CHECK</span></span> <span class="brand"><span class="brand__fast">fast</span><span class="brand__check">CHECK</span></span>
{{ 'fastcheck.modal_paid_sub' | translate }} {{ 'fastcheck.modal_paid_sub' | translate }}
</p> </p>
}
</div> </div>
} @else { } @else {
<img class="brand-logo brand-logo--small" src="/logo_small.png" <img class="brand-logo brand-logo--small" src="/logo_small.png"

View File

@@ -56,6 +56,8 @@ export class FastcheckPage {
popupError = signal<string>(''); popupError = signal<string>('');
webSessionId = signal<string>(''); webSessionId = signal<string>('');
paid = signal<boolean>(false); paid = signal<boolean>(false);
loginOnly = signal<boolean>(false);
sessionToken = signal<string>(localStorage.getItem('fc_session') ?? '');
private pollHandle: ReturnType<typeof setInterval> | null = null; private pollHandle: ReturnType<typeof setInterval> | null = null;
private lastLookedUpNumber = ''; private lastLookedUpNumber = '';
@@ -113,6 +115,7 @@ export class FastcheckPage {
return; return;
} }
this.error.set(''); this.error.set('');
this.loginOnly.set(false);
this.openPopup(); this.openPopup();
} }
@@ -122,6 +125,32 @@ export class FastcheckPage {
this.paid.set(false); this.paid.set(false);
this.popupLoading.set(true); this.popupLoading.set(true);
const existing = this.sessionToken();
if (existing) {
this.http.get<WebSessionResponse>(`${FASTCHECK_API}/websession/${existing}`).subscribe({
next: (res) => {
if (res?.Status) {
this.popupLoading.set(false);
this.webSessionId.set(existing);
if (this.loginOnly()) {
this.paid.set(true);
} else {
this.acceptFastcheck(existing);
}
} else {
this.sessionToken.set('');
this.createNewSession();
}
},
error: () => { this.sessionToken.set(''); this.createNewSession(); }
});
return;
}
this.createNewSession();
}
private createNewSession(): void {
this.http.get<WebSessionResponse>(`${FASTCHECK_API}/websession`).subscribe({ this.http.get<WebSessionResponse>(`${FASTCHECK_API}/websession`).subscribe({
next: (res) => { next: (res) => {
this.popupLoading.set(false); this.popupLoading.set(false);
@@ -142,13 +171,20 @@ export class FastcheckPage {
closePopup(): void { closePopup(): void {
this.popupOpen.set(false); this.popupOpen.set(false);
this.stopPolling(); this.stopPolling();
if (this.webSessionId()) { if (this.loginOnly() && this.paid()) {
// Keep session alive — user is logged in, preserve token for next action.
const tok = this.webSessionId();
localStorage.setItem('fc_session', tok);
this.sessionToken.set(tok);
} else if (this.webSessionId()) {
// Best-effort logout; ignore errors. // Best-effort logout; ignore errors.
this.http this.http
.request('DELETE', `${FASTCHECK_API}/websession/${this.webSessionId()}`, { .request('DELETE', `${FASTCHECK_API}/websession/${this.webSessionId()}`, {
body: { sessionId: this.webSessionId() } body: { sessionId: this.webSessionId() }
}) })
.subscribe({ error: () => undefined }); .subscribe({ error: () => undefined });
localStorage.removeItem('fc_session');
this.sessionToken.set('');
} }
this.webSessionId.set(''); this.webSessionId.set('');
} }
@@ -162,8 +198,12 @@ export class FastcheckPage {
next: (res) => { next: (res) => {
if (res?.Status) { if (res?.Status) {
this.stopPolling(); this.stopPolling();
if (this.loginOnly()) {
this.paid.set(true);
} else {
this.acceptFastcheck(sessionId); this.acceptFastcheck(sessionId);
} }
}
}, },
error: () => undefined error: () => undefined
}); });
@@ -285,9 +325,7 @@ export class FastcheckPage {
} }
shareByTelegram(): void { shareByTelegram(): void {
const num = this.fastcheckNumber(); this.loginOnly.set(true);
const amount = this.fastcheckAmount(); this.openPopup();
const text = encodeURIComponent(`fastCHECK: ${num}${amount}`);
window.open(`https://t.me/share/url?url=https%3A%2F%2Fqr.vitanova.network%2F&text=${text}`, '_blank');
} }
} }