From 458e4b45f8f317a340d47c7e96e3ced0a695c12d Mon Sep 17 00:00:00 2001 From: Isaac Grynsztein Date: Wed, 1 Apr 2020 19:44:22 -0400 Subject: [PATCH] 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 --- src/app/app.module.ts | 5 ++--- src/app/file-card/file-card.component.html | 4 +--- src/app/posts.services.ts | 9 +++++++++ src/main.ts | 4 +--- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 6ca713b..e7191a7 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -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, ], diff --git a/src/app/file-card/file-card.component.html b/src/app/file-card/file-card.component.html index ef79cf6..92116dc 100644 --- a/src/app/file-card/file-card.component.html +++ b/src/app/file-card/file-card.component.html @@ -10,9 +10,7 @@
Thumbnail - - - +
diff --git a/src/app/posts.services.ts b/src/app/posts.services.ts index 54e464d..9907ed9 100644 --- a/src/app/posts.services.ts +++ b/src/app/posts.services.ts @@ -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'); diff --git a/src/main.ts b/src/main.ts index 00f55c9..3617189 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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()