mirror of
https://github.com/PhoenixTwoFive/karaoqueue.git
synced 2025-05-19 11:01:47 +02:00
Evrything is working.
Existing parts of frontend can access backend.
This commit is contained in:
parent
2c549c7c59
commit
ff8c113bfc
@ -7,7 +7,10 @@ import os
|
|||||||
import json
|
import json
|
||||||
from flask_basicauth import BasicAuth
|
from flask_basicauth import BasicAuth
|
||||||
from helpers import nocache
|
from helpers import nocache
|
||||||
|
from flask_cors import CORS
|
||||||
|
|
||||||
app = Flask(__name__, static_url_path='/static')
|
app = Flask(__name__, static_url_path='/static')
|
||||||
|
CORS(app)
|
||||||
|
|
||||||
basic_auth = BasicAuth(app)
|
basic_auth = BasicAuth(app)
|
||||||
accept_entries = True
|
accept_entries = True
|
||||||
|
@ -34,3 +34,4 @@ tomli==2.0.1
|
|||||||
typing_extensions==4.5.0
|
typing_extensions==4.5.0
|
||||||
urllib3==1.26.15
|
urllib3==1.26.15
|
||||||
Werkzeug==2.2.3
|
Werkzeug==2.2.3
|
||||||
|
flask_cors==4.0.0
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { RuntimeConfigLoaderService } from 'runtime-config-loader';
|
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -9,9 +8,9 @@ import { RuntimeConfigLoaderService } from 'runtime-config-loader';
|
|||||||
})
|
})
|
||||||
export class AppComponent implements OnInit{
|
export class AppComponent implements OnInit{
|
||||||
|
|
||||||
constructor(private configSvc: RuntimeConfigLoaderService) {}
|
constructor() {}
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
console.log("API at ",this.configSvc.getConfigObjectKey("api"));
|
|
||||||
}
|
}
|
||||||
title = 'KaraoQueue';
|
title = 'KaraoQueue';
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { BrowserModule, DomSanitizer } from '@angular/platform-browser';
|
import { BrowserModule, DomSanitizer } from '@angular/platform-browser';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RuntimeConfigLoaderModule } from 'runtime-config-loader';
|
|
||||||
|
|
||||||
import { AppRoutingModule } from './app-routing.module';
|
import { AppRoutingModule } from './app-routing.module';
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
@ -94,7 +93,6 @@ import { debounceTime, distinctUntilChanged } from "rxjs/operators";
|
|||||||
MatTooltipModule,
|
MatTooltipModule,
|
||||||
MatTreeModule,
|
MatTreeModule,
|
||||||
HttpClientModule,
|
HttpClientModule,
|
||||||
RuntimeConfigLoaderModule
|
|
||||||
],
|
],
|
||||||
providers: [],
|
providers: [],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
|
@ -4,9 +4,8 @@ import { Song } from './models/song.model';
|
|||||||
import { Artist } from './models/artist.model';
|
import { Artist } from './models/artist.model';
|
||||||
import { Genre } from './models/genre.model';
|
import { Genre } from './models/genre.model';
|
||||||
import { Language } from './models/language.model';
|
import { Language } from './models/language.model';
|
||||||
import { RuntimeConfigLoaderService} from 'runtime-config-loader';
|
|
||||||
|
|
||||||
import { Observable } from 'rxjs';
|
import { ConnectableObservable, Observable } from 'rxjs';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@ -16,9 +15,9 @@ export class SongServiceService {
|
|||||||
private api: string;
|
private api: string;
|
||||||
constructor(
|
constructor(
|
||||||
private http: HttpClient,
|
private http: HttpClient,
|
||||||
private configSvc: RuntimeConfigLoaderService
|
|
||||||
) {
|
) {
|
||||||
this.api=configSvc.getConfigObjectKey("api");
|
// TODO: get api from config
|
||||||
|
this.api= "http://localhost:5000/api";
|
||||||
}
|
}
|
||||||
|
|
||||||
searchSongByText(text: string): Observable<Array<Song>> {
|
searchSongByText(text: string): Observable<Array<Song>> {
|
||||||
@ -28,6 +27,7 @@ export class SongServiceService {
|
|||||||
|
|
||||||
this.http.get(this.api +"/songs/compl?search="+text).subscribe((data: Observable<JSON>) => {
|
this.http.get(this.api +"/songs/compl?search="+text).subscribe((data: Observable<JSON>) => {
|
||||||
data.forEach(element => {
|
data.forEach(element => {
|
||||||
|
console.log(element);
|
||||||
out.push(new Song(element["title"],element["artist"],element["karafun_id"],element["duo"],element["explicit"],element["_id"],element["styles"],element["languages"]));
|
out.push(new Song(element["title"],element["artist"],element["karafun_id"],element["duo"],element["explicit"],element["_id"],element["styles"],element["languages"]));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user