Removed @locl dependency for translations

Added CommonModule to fix intellisense

Added ability to load json assets by name, and an http call to update youtubedl-material
This commit is contained in:
Isaac Grynsztein
2020-04-01 19:44:22 -04:00
parent c40513ba4a
commit 458e4b45f8
4 changed files with 13 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
import { BrowserModule } from '@angular/platform-browser';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import { NgModule, LOCALE_ID } from '@angular/core';
import { registerLocaleData } from '@angular/common';
import { registerLocaleData, CommonModule } from '@angular/common';
import { MatButtonModule } from '@angular/material/button';
import { MatButtonToggleModule } from '@angular/material/button-toggle';
import { MatCardModule } from '@angular/material/card';
@@ -37,7 +37,6 @@ import { PlayerComponent } from './player/player.component';
import {VgCoreModule, VgControlsModule, VgOverlayPlayModule, VgBufferingModule} from 'ngx-videogular';
import { InputDialogComponent } from './input-dialog/input-dialog.component';
import { LazyLoadImageModule, IsVisibleProps } from 'ng-lazyload-image';
import { NgxContentLoadingModule } from 'ngx-content-loading';
import { audioFilesMouseHovering, videoFilesMouseHovering, audioFilesOpened, videoFilesOpened } from './main/main.component';
import { CreatePlaylistComponent } from './create-playlist/create-playlist.component';
import { DownloadItemComponent } from './download-item/download-item.component';
@@ -81,6 +80,7 @@ export function isVisible({ event, element, scrollContainer, offset }: IsVisible
HighlightPipe
],
imports: [
CommonModule,
BrowserModule,
BrowserAnimationsModule,
MatNativeDateModule,
@@ -116,7 +116,6 @@ export function isVisible({ event, element, scrollContainer, offset }: IsVisible
VgOverlayPlayModule,
VgBufferingModule,
LazyLoadImageModule.forRoot({ isVisible }),
NgxContentLoadingModule,
RouterModule,
AppRoutingModule,
],

View File

@@ -10,9 +10,7 @@
<div *ngIf="!image_errored && thumbnailURL" class="img-div">
<img class="image" (error) ="onImgError($event)" [id]="type" [lazyLoad]="thumbnailURL" [customObservable]="scrollAndLoad" (onLoad)="imageLoaded($event)" alt="Thumbnail">
<span *ngIf="!image_loaded">
<ngx-content-loading [width]="500" [height]="360">
<svg:g ngx-rect width="500" height="360" y="0" x="0" rx="4" ry="4"></svg:g>
</ngx-content-loading>
</span>
</div>
</div>

View File

@@ -94,6 +94,10 @@ export class PostsService {
}
}
loadAsset(name) {
return this.http.get(`./assets/${name}`);
}
setConfig(config) {
return this.http.post(this.path + 'setConfig', {new_config_file: config});
}
@@ -180,6 +184,11 @@ export class PostsService {
return this.http.post(this.path + 'getAllSubscriptions', {});
}
// updates the server to the latest version
updateServer() {
return this.http.post(this.path + 'updateServer', {});
}
// gets tag of the latest version of youtubedl-material
getLatestGithubRelease() {
return this.http.get('https://api.github.com/repos/tzahi12345/youtubedl-material/releases/latest');

View File

@@ -6,7 +6,6 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { environment } from './environments/environment';
import { loadTranslations } from '@angular/localize';
import { getTranslations, ParsedTranslationBundle } from '@locl/core';
if (environment.production) {
enableProdMode();
@@ -17,8 +16,7 @@ if (!locale) {
localStorage.setItem('locale', 'en');
}
if (locale && locale !== 'en') {
getTranslations(`./assets/i18n/messages.${locale}.json`).then(
(data: ParsedTranslationBundle) => {
fetch(`./assets/i18n/messages.${locale}.json`).then(res => res.json()).then((data) => {
loadTranslations(data as any);
import('./app/app.module').then(module => {
platformBrowserDynamic()