Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | 178x 8x 364x 364x 364x 364x 364x 364x 364x 364x 364x 364x 364x 364x 364x 364x 364x 364x 364x 364x 364x 364x 364x 364x 364x 364x 364x 364x 364x 364x 364x 364x 178x 2x 2x 2x 56x 29x 126x | import { HttpClient } from '@angular/common/http';
import { Injectable, isDevMode } from '@angular/core';
import { Router } from '@angular/router';
import { DateTime } from 'luxon';
import { tap } from 'rxjs/operators';
import { memo } from '../util/memo';
export function config(): ConfigService {
// @ts-ignore
return window.configService;
}
@Injectable({
providedIn: 'root',
})
export class ConfigService {
version = DateTime.now().toISO();
title = 'Jasper';
api = '//localhost:8081';
electron = /electron/i.test(navigator.userAgent);
logout = '';
login = '';
signup = '';
pwa = false;
scim = false;
websockets = true;
support = '+support';
allowedSchemes = ['http:', 'https:', 'ftp:', 'tel:', 'mailto:', 'magnet:'];
modSeals = ['seal', '+seal', 'seal', '_moderated'];
editorSeals = ['plugin/qc'];
maxPlugins = 1000;
maxTemplates = 1000;
maxExts = 1000;
maxOrigins = 1000;
maxEmbedNesting = 3;
fetchBatch = 50;
// Debug token
token = '';
/**
* Workaround for non-cookie based auth to scrape images before fetching.
*/
prefetch = isDevMode();
miniWidth = 380;
mobileWidth = 740;
tabletWidth = 948;
hugeWidth = 1500;
constructor(
private http: HttpClient,
private router: Router,
) {
// @ts-ignore
window.configService = this;
}
@memo
get base() {
return document.getElementsByTagName('base')[0].href;
}
get loginLink() {
return this.login + '?rd=' + encodeURIComponent(''+window.location);
}
get load$() {
return this.http.get(this.base + 'assets/config.json').pipe(
tap((result: any) => {
for (const k in this) {
this[k] = result[k] || this[k];
}
}),
);
}
get mini() {
return window.innerWidth <= this.miniWidth;
}
get mobile() {
return window.innerWidth <= this.mobileWidth;
}
get tablet() {
return window.innerWidth <= this.tabletWidth;
}
get huge() {
return window.innerWidth >= this.hugeWidth;
}
logIn() {
if (this.login) {
// @ts-ignore
window.location = this.loginLink;
}
}
ref(url: string) {
if (this.electron) {
this.router.navigate(['/ref', url]);
} else {
window.open(this.base + 'ref/' + url);
}
}
tag(tag: string) {
if (this.electron) {
this.router.navigate(['/tag', tag]);
} else {
window.open(this.base + 'tag/' + tag);
}
}
}
|