2 Commits

Author SHA1 Message Date
9b23666fe6 remember a shuffle seed to remain page reload 2022-03-06 16:01:04 +01:00
1adafef4e1 remember sortby selection with localstorage 2022-03-01 13:20:39 +01:00
15 changed files with 156 additions and 195 deletions

View File

@ -108,13 +108,18 @@ Debian_Server:
- Minimize_Frontend - Minimize_Frontend
- Build_Backend - Build_Backend
.Test_Server_Common: Test_Server:
stage: deploy stage: deploy
image: luki42/ssh:latest image: luki42/ssh:latest
needs: needs:
- Frontend_Tests - Frontend_Tests
- Backend_Tests - Backend_Tests
- Debian_Server - Debian_Server
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH # run this always on default branch
- if: $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH # allow triggering this manually
when: manual
allow_failure: true
script: script:
- eval $(ssh-agent -s) - eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | ssh-add - - echo "$SSH_PRIVATE_KEY" | ssh-add -
@ -124,23 +129,18 @@ Debian_Server:
- ssh root@192.168.0.42 "DEBIAN_FRONTEND=noninteractive apt-get --reinstall -y -qq install /tmp/OpenMediaCenter-*.deb && rm /tmp/OpenMediaCenter-*.deb" - ssh root@192.168.0.42 "DEBIAN_FRONTEND=noninteractive apt-get --reinstall -y -qq install /tmp/OpenMediaCenter-*.deb && rm /tmp/OpenMediaCenter-*.deb"
allow_failure: true allow_failure: true
Test_Server_CD: Test_Server_2:
extends: .Test_Server_Common
only:
refs:
- master
Test_Server_MANUAL:
extends: .Test_Server_Common
when: manual
.Test_Server_2_Common:
stage: deploy stage: deploy
image: luki42/ssh:latest image: luki42/ssh:latest
needs: needs:
- Frontend_Tests - Frontend_Tests
- Backend_Tests - Backend_Tests
- Debian_Server - Debian_Server
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH # run this always on default branch
- if: $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH # allow triggering this manually
when: manual
allow_failure: true
script: script:
- eval $(ssh-agent -s) - eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY_2" | ssh-add - - echo "$SSH_PRIVATE_KEY_2" | ssh-add -
@ -150,12 +150,3 @@ Test_Server_MANUAL:
- ssh root@192.168.0.209 "DEBIAN_FRONTEND=noninteractive apt-get --reinstall -y -qq install /tmp/OpenMediaCenter-*.deb && rm /tmp/OpenMediaCenter-*.deb" - ssh root@192.168.0.209 "DEBIAN_FRONTEND=noninteractive apt-get --reinstall -y -qq install /tmp/OpenMediaCenter-*.deb && rm /tmp/OpenMediaCenter-*.deb"
allow_failure: true allow_failure: true
Test_Server_2_CD:
extends: .Test_Server_2_Common
only:
refs:
- master
Test_Server_2_MANUAL:
extends: .Test_Server_2_Common
when: manual

View File

@ -74,7 +74,6 @@ func getSettingsFromDB() {
TVShowPath string TVShowPath string
TVShowEnabled bool TVShowEnabled bool
FullDeleteEnabled bool FullDeleteEnabled bool
RandomNR uint32
} }
regexMatchUrl := regexp.MustCompile("^http(|s)://([0-9]){1,3}\\.([0-9]){1,3}\\.([0-9]){1,3}\\.([0-9]){1,3}:[0-9]{1,5}") regexMatchUrl := regexp.MustCompile("^http(|s)://([0-9]){1,3}\\.([0-9]){1,3}\\.([0-9]){1,3}\\.([0-9]){1,3}:[0-9]{1,5}")
@ -91,7 +90,6 @@ func getSettingsFromDB() {
TVShowPath: serverTVShowPath, TVShowPath: serverTVShowPath,
TVShowEnabled: !config.GetConfig().Features.DisableTVSupport, TVShowEnabled: !config.GetConfig().Features.DisableTVSupport,
FullDeleteEnabled: config.GetConfig().Features.FullyDeletableVideos, FullDeleteEnabled: config.GetConfig().Features.FullyDeletableVideos,
RandomNR: sett.RandomNR,
} }
context.Json(res) context.Json(res)
@ -129,13 +127,12 @@ func saveSettingsToDB() {
password=?, password=?,
mediacenter_name=?, mediacenter_name=?,
TMDB_grabbing=?, TMDB_grabbing=?,
DarkMode=?, DarkMode=?
random_nr=?
WHERE 1` WHERE 1`
// todo avoid conversion // todo avoid conversion
context.Text(string(database.SuccessQuery(query, context.Text(string(database.SuccessQuery(query,
args.VideoPath, args.EpisodePath, args.Password, args.VideoPath, args.EpisodePath, args.Password,
args.MediacenterName, args.TMDBGrabbing, args.DarkMode, args.RandomNR))) args.MediacenterName, args.TMDBGrabbing, args.DarkMode)))
}) })
} }

View File

@ -1,8 +1,8 @@
package api package api
import ( import (
"encoding/json"
"fmt" "fmt"
"math/rand"
"net/url" "net/url"
"openmediacenter/apiGo/api/api" "openmediacenter/apiGo/api/api"
"openmediacenter/apiGo/api/types" "openmediacenter/apiGo/api/types"
@ -10,7 +10,6 @@ import (
"openmediacenter/apiGo/database" "openmediacenter/apiGo/database"
"os" "os"
"strconv" "strconv"
"strings"
) )
func addVideoHandlers() { func addVideoHandlers() {
@ -165,35 +164,27 @@ func getVideoHandlers() {
api.AddHandler("getRandomMovies", api.VideoNode, api.PermUser, func(context api.Context) { api.AddHandler("getRandomMovies", api.VideoNode, api.PermUser, func(context api.Context) {
var args struct { var args struct {
Number int Number int
TagFilter []uint32 Seed *int
} }
if api.DecodeRequest(context.GetRequest(), &args) != nil { if api.DecodeRequest(context.GetRequest(), &args) != nil {
context.Text("unable to decode request") context.Text("unable to decode request")
return return
} }
// if Seed argument not passed generate random seed
if args.Seed == nil {
r := rand.Int()
args.Seed = &r
}
var result struct { var result struct {
Tags []types.Tag Tags []types.Tag
Videos []types.VideoUnloadedType Videos []types.VideoUnloadedType
} }
whereclause := "WHERE 1" query := fmt.Sprintf("SELECT movie_id,movie_name FROM videos ORDER BY RAND(%d) LIMIT %d", *args.Seed, args.Number)
if len(args.TagFilter) > 0 {
d, _ := json.Marshal(args.TagFilter)
vals := strings.Trim(string(d), "[]")
whereclause = fmt.Sprintf("WHERE tag_id IN (%s)", vals)
}
query := fmt.Sprintf(`
SELECT video_tags.video_id,v.movie_name FROM video_tags join videos v on v.movie_id = video_tags.video_id
%s
group by video_id
ORDER BY RAND()
LIMIT %d`, whereclause, args.Number)
result.Videos = readVideosFromResultset(database.Query(query)) result.Videos = readVideosFromResultset(database.Query(query))
if len(result.Videos) > 0 {
var ids string var ids string
for i := range result.Videos { for i := range result.Videos {
ids += "video_tags.video_id=" + strconv.Itoa(result.Videos[i].MovieId) ids += "video_tags.video_id=" + strconv.Itoa(result.Videos[i].MovieId)
@ -210,7 +201,7 @@ SELECT video_tags.video_id,v.movie_name FROM video_tags join videos v on v.movie
GROUP BY t.tag_id`, ids) GROUP BY t.tag_id`, ids)
rows := database.Query(query) rows := database.Query(query)
if rows != nil {
for rows.Next() { for rows.Next() {
var tag types.Tag var tag types.Tag
err := rows.Scan(&tag.TagName, &tag.TagId) err := rows.Scan(&tag.TagName, &tag.TagId)
@ -220,10 +211,6 @@ SELECT video_tags.video_id,v.movie_name FROM video_tags join videos v on v.movie
// append to final array // append to final array
result.Tags = append(result.Tags, tag) result.Tags = append(result.Tags, tag)
} }
}
} else {
result.Tags = []types.Tag{}
}
context.Json(result) context.Json(result)
}) })

View File

@ -48,7 +48,6 @@ type SettingsType struct {
PasswordEnabled bool PasswordEnabled bool
TMDBGrabbing bool TMDBGrabbing bool
DarkMode bool DarkMode bool
RandomNR uint32
} }
type SettingsSizeType struct { type SettingsSizeType struct {

View File

@ -126,7 +126,7 @@ func GetSettings() (result types.SettingsType, PathPrefix string, sizes types.Se
SELECT COUNT(*) SELECT COUNT(*)
FROM video_tags FROM video_tags
) AS tagsadded, ) AS tagsadded,
video_path, episode_path, password, mediacenter_name, TMDB_grabbing, DarkMode, random_nr video_path, episode_path, password, mediacenter_name, TMDB_grabbing, DarkMode
FROM settings FROM settings
LIMIT 1`, DBName) LIMIT 1`, DBName)
@ -134,7 +134,7 @@ func GetSettings() (result types.SettingsType, PathPrefix string, sizes types.Se
var TMDBGrabbing int var TMDBGrabbing int
err := QueryRow(query).Scan(&sizes.VideoNr, &sizes.DBSize, &sizes.DifferentTags, &sizes.TagsAdded, err := QueryRow(query).Scan(&sizes.VideoNr, &sizes.DBSize, &sizes.DifferentTags, &sizes.TagsAdded,
&result.VideoPath, &result.EpisodePath, &result.Password, &result.MediacenterName, &TMDBGrabbing, &DarkMode, &result.RandomNR) &result.VideoPath, &result.EpisodePath, &result.Password, &result.MediacenterName, &TMDBGrabbing, &DarkMode)
if err != nil { if err != nil {
fmt.Println(err.Error()) fmt.Println(err.Error())

View File

@ -1,11 +0,0 @@
-- +goose Up
-- +goose StatementBegin
alter table settings
add random_nr int default 3 null;
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
alter table settings
drop random_nr;
-- +goose StatementEnd

View File

@ -20,16 +20,15 @@ type SettingsType struct {
MediacenterName string MediacenterName string
VideoPath string VideoPath string
TVShowPath string TVShowPath string
RandomNR uint32
} }
func LoadSettings() *SettingsType { func LoadSettings() *SettingsType {
query := "SELECT DarkMode, password, mediacenter_name, video_path, episode_path, random_nr from settings" query := "SELECT DarkMode, password, mediacenter_name, video_path, episode_path from settings"
result := SettingsType{} result := SettingsType{}
var darkmode uint8 var darkmode uint8
err := database.QueryRow(query).Scan(&darkmode, &result.Pasword, &result.MediacenterName, &result.VideoPath, &result.TVShowPath, &result.RandomNR) err := database.QueryRow(query).Scan(&darkmode, &result.Pasword, &result.MediacenterName, &result.VideoPath, &result.TVShowPath)
if err != nil { if err != nil {
fmt.Println("error while parsing db data: " + err.Error()) fmt.Println("error while parsing db data: " + err.Error())
} }

View File

@ -90,14 +90,12 @@ describe('<HomePage/>', function () {
const wrapper = shallow(<HomePage/>); const wrapper = shallow(<HomePage/>);
// expect those default values // expect those default values
expect(wrapper.state().sortby).toBe('Date Added'); expect(wrapper.state().sortby).toBe(0);
expect(wrapper.instance().sortState).toBe(SortBy.date);
expect(wrapper.instance().tagState).toBe(DefaultTags.all); expect(wrapper.instance().tagState).toBe(DefaultTags.all);
wrapper.instance().onDropDownItemClick(SortBy.name, 'namesort'); wrapper.instance().onDropDownItemClick(SortBy.name);
expect(wrapper.state().sortby).toBe('namesort'); expect(wrapper.state().sortby).toBe(SortBy.name);
expect(wrapper.instance().sortState).toBe(SortBy.name);
}); });
}); });

View File

@ -29,7 +29,7 @@ interface state {
subtitle: string; subtitle: string;
data: VideoTypes.VideoUnloadedType[]; data: VideoTypes.VideoUnloadedType[];
selectionnr: number; selectionnr: number;
sortby: string; sortby: SortBy;
} }
/** /**
@ -39,9 +39,33 @@ export class HomePage extends React.Component<Props, state> {
/** keyword variable needed temporary store search keyword */ /** keyword variable needed temporary store search keyword */
keyword = ''; keyword = '';
/**
* get text label from sort type
* @param type SortBy type
*/
getLabelFromSortType(type: SortBy): String {
switch (type) {
case SortBy.date:
return 'Date Added';
case SortBy.length:
return 'Length';
case SortBy.likes:
return 'Most likes';
case SortBy.name:
return 'Name';
case SortBy.random:
return 'Random';
default:
return '';
}
}
constructor(props: Props) { constructor(props: Props) {
super(props); super(props);
// get previously stored location from localstorage
const storedSelection = global.localStorage.getItem('sortby');
this.state = { this.state = {
sideinfo: { sideinfo: {
VideoNr: 0, VideoNr: 0,
@ -54,11 +78,10 @@ export class HomePage extends React.Component<Props, state> {
subtitle: 'All Videos', subtitle: 'All Videos',
data: [], data: [],
selectionnr: 0, selectionnr: 0,
sortby: 'Date Added' sortby: storedSelection == null ? SortBy.date : parseInt(storedSelection, 10)
}; };
} }
sortState = SortBy.date;
tagState = DefaultTags.all; tagState = DefaultTags.all;
componentDidMount(): void { componentDidMount(): void {
@ -87,7 +110,7 @@ export class HomePage extends React.Component<Props, state> {
fetchVideoData(): void { fetchVideoData(): void {
callAPI( callAPI(
APINode.Video, APINode.Video,
{action: 'getMovies', Tag: this.tagState.TagId, Sort: this.sortState}, {action: 'getMovies', Tag: this.tagState.TagId, Sort: this.state.sortby},
(result: {Videos: VideoTypes.VideoUnloadedType[]; TagName: string}) => { (result: {Videos: VideoTypes.VideoUnloadedType[]; TagName: string}) => {
this.setState({ this.setState({
data: result.Videos, data: result.Videos,
@ -190,15 +213,25 @@ export class HomePage extends React.Component<Props, state> {
<span className={style.sortbyLabel}>Sort By: </span> <span className={style.sortbyLabel}>Sort By: </span>
<div className={style.dropdown}> <div className={style.dropdown}>
<span className={style.dropbtn}> <span className={style.dropbtn}>
<span>{this.state.sortby}</span> <span>{this.getLabelFromSortType(this.state.sortby)}</span>
<FontAwesomeIcon style={{marginLeft: 3, paddingBottom: 3}} icon={faSortDown} size='1x' /> <FontAwesomeIcon style={{marginLeft: 3, paddingBottom: 3}} icon={faSortDown} size='1x' />
</span> </span>
<div className={style.dropdownContent}> <div className={style.dropdownContent}>
<span onClick={(): void => this.onDropDownItemClick(SortBy.date, 'Date Added')}>Date Added</span> <span onClick={(): void => this.onDropDownItemClick(SortBy.date)}>
<span onClick={(): void => this.onDropDownItemClick(SortBy.likes, 'Most likes')}>Most likes</span> {this.getLabelFromSortType(SortBy.date)}
<span onClick={(): void => this.onDropDownItemClick(SortBy.random, 'Random')}>Random</span> </span>
<span onClick={(): void => this.onDropDownItemClick(SortBy.name, 'Name')}>Name</span> <span onClick={(): void => this.onDropDownItemClick(SortBy.likes)}>
<span onClick={(): void => this.onDropDownItemClick(SortBy.length, 'Length')}>Length</span> {this.getLabelFromSortType(SortBy.likes)}
</span>
<span onClick={(): void => this.onDropDownItemClick(SortBy.random)}>
{this.getLabelFromSortType(SortBy.random)}
</span>
<span onClick={(): void => this.onDropDownItemClick(SortBy.name)}>
{this.getLabelFromSortType(SortBy.name)}
</span>
<span onClick={(): void => this.onDropDownItemClick(SortBy.length)}>
{this.getLabelFromSortType(SortBy.length)}
</span>
</div> </div>
</div> </div>
</div> </div>
@ -214,10 +247,12 @@ export class HomePage extends React.Component<Props, state> {
* @param type type of sort action * @param type type of sort action
* @param name new header title * @param name new header title
*/ */
onDropDownItemClick(type: SortBy, name: string): void { onDropDownItemClick(type: SortBy): void {
this.sortState = type; this.setState({sortby: type}, (): void => {
this.setState({sortby: name}); global.localStorage.setItem('sortby', type.toString());
this.fetchVideoData(); this.fetchVideoData();
});
} }
} }

View File

@ -2,22 +2,16 @@ import React from 'react';
import style from './RandomPage.module.css'; import style from './RandomPage.module.css';
import SideBar, {SideBarTitle} from '../../elements/SideBar/SideBar'; import SideBar, {SideBarTitle} from '../../elements/SideBar/SideBar';
import Tag from '../../elements/Tag/Tag'; import Tag from '../../elements/Tag/Tag';
import PageTitle, {Line} from '../../elements/PageTitle/PageTitle'; import PageTitle from '../../elements/PageTitle/PageTitle';
import VideoContainer from '../../elements/VideoContainer/VideoContainer'; import VideoContainer from '../../elements/VideoContainer/VideoContainer';
import {APINode, callAPI} from '../../utils/Api'; import {APINode, callAPI} from '../../utils/Api';
import {TagType} from '../../types/VideoTypes'; import {TagType} from '../../types/VideoTypes';
import {VideoTypes} from '../../types/ApiTypes'; import {VideoTypes} from '../../types/ApiTypes';
import {addKeyHandler, removeKeyHandler} from '../../utils/ShortkeyHandler'; import {addKeyHandler, removeKeyHandler} from '../../utils/ShortkeyHandler';
import {IconButton} from '../../elements/GPElements/Button';
import {faPlusCircle} from '@fortawesome/free-solid-svg-icons';
import AddTagPopup from '../../elements/Popups/AddTagPopup/AddTagPopup';
import GlobalInfos from '../../utils/GlobalInfos';
interface state { interface state {
videos: VideoTypes.VideoUnloadedType[]; videos: VideoTypes.VideoUnloadedType[];
tags: TagType[]; tags: TagType[];
filterTags: TagType[];
addTagPopup: boolean;
} }
interface GetRandomMoviesType { interface GetRandomMoviesType {
@ -29,23 +23,36 @@ interface GetRandomMoviesType {
* Randompage shuffles random viedeopreviews and provides a shuffle btn * Randompage shuffles random viedeopreviews and provides a shuffle btn
*/ */
class RandomPage extends React.Component<{}, state> { class RandomPage extends React.Component<{}, state> {
readonly LoadNR = 3;
// random seed to load videos, remains page reload.
seed = this.genRandInt();
constructor(props: {}) { constructor(props: {}) {
super(props); super(props);
// get previously stored location from localstorage
const storedseed = global.localStorage.getItem('randpageseed');
if (storedseed != null) {
this.seed = parseInt(storedseed, 10);
}
this.state = { this.state = {
addTagPopup: false,
videos: [], videos: [],
tags: [], tags: []
filterTags: []
}; };
this.keypress = this.keypress.bind(this); this.keypress = this.keypress.bind(this);
} }
genRandInt(): number {
return Math.floor(Math.random() * 2147483647) + 1;
}
componentDidMount(): void { componentDidMount(): void {
addKeyHandler(this.keypress); addKeyHandler(this.keypress);
this.loadShuffledvideos(); this.loadShuffledvideos(this.LoadNR);
} }
componentWillUnmount(): void { componentWillUnmount(): void {
@ -55,66 +62,55 @@ class RandomPage extends React.Component<{}, state> {
render(): JSX.Element { render(): JSX.Element {
return ( return (
<div> <div>
<PageTitle title='Random Videos' subtitle={GlobalInfos.getRandomNR() + 'pc'} /> <PageTitle title='Random Videos' subtitle='4pc' />
<SideBar> <SideBar>
<SideBarTitle>Visible Tags:</SideBarTitle> <SideBarTitle>Visible Tags:</SideBarTitle>
{this.state.tags.map((m) => ( {this.state.tags.map((m) => (
<Tag key={m.TagId} tagInfo={m} /> <Tag key={m.TagId} tagInfo={m} />
))} ))}
<Line />
<SideBarTitle>Filter Tags:</SideBarTitle>
{this.state.filterTags.map((m) => (
<Tag key={m.TagId} tagInfo={m} />
))}
<IconButton
title='Add'
icon={faPlusCircle}
onClick={(): void => {
this.setState({addTagPopup: true});
}}
/>
</SideBar> </SideBar>
{this.state.videos.length !== 0 ? <VideoContainer data={this.state.videos} /> : <div>No Data found!</div>} {this.state.videos.length !== 0 ? (
<VideoContainer data={this.state.videos}>
<div className={style.Shufflebutton}> <div className={style.Shufflebutton}>
<button onClick={(): void => this.loadShuffledvideos()} className={style.btnshuffle}> <button onClick={(): void => this.shuffleclick()} className={style.btnshuffle}>
Shuffle Shuffle
</button> </button>
</div> </div>
{this.state.addTagPopup ? ( </VideoContainer>
<AddTagPopup ) : (
onHide={(): void => this.setState({addTagPopup: false})} <div>No Data found!</div>
submit={(tagId: number, tagName: string): void => { )}
this.setState({filterTags: [...this.state.filterTags, {TagId: tagId, TagName: tagName}]}, (): void => {
this.loadShuffledvideos();
});
}}
/>
) : null}
</div> </div>
); );
} }
/** /**
* load random videos from backend * click handler for shuffle btn
*/ */
loadShuffledvideos(): void { shuffleclick(): void {
callAPI<GetRandomMoviesType>( this.genSeed();
APINode.Video, this.loadShuffledvideos(this.LoadNR);
{ }
action: 'getRandomMovies',
Number: GlobalInfos.getRandomNR(), genSeed(): void {
TagFilter: this.state.filterTags.map((t) => t.TagId) this.seed = this.genRandInt();
}, global.localStorage.setItem('randpageseed', this.seed.toString());
(result) => { }
/**
* load random videos from backend
* @param nr number of videos to load
*/
loadShuffledvideos(nr: number): void {
callAPI<GetRandomMoviesType>(APINode.Video, {action: 'getRandomMovies', Number: nr, Seed: this.seed}, (result) => {
this.setState({videos: []}); // needed to trigger rerender of main videoview this.setState({videos: []}); // needed to trigger rerender of main videoview
this.setState({ this.setState({
videos: result.Videos, videos: result.Videos,
tags: result.Tags tags: result.Tags
}); });
} });
);
} }
/** /**
@ -124,7 +120,8 @@ class RandomPage extends React.Component<{}, state> {
private keypress(event: KeyboardEvent): void { private keypress(event: KeyboardEvent): void {
// bind s to shuffle // bind s to shuffle
if (event.key === 's') { if (event.key === 's') {
this.loadShuffledvideos(); this.genSeed();
this.loadShuffledvideos(this.LoadNR);
} }
} }
} }

View File

@ -33,8 +33,7 @@ class GeneralSettings extends React.Component<Props, state> {
Password: '', Password: '',
PasswordEnabled: false, PasswordEnabled: false,
TMDBGrabbing: false, TMDBGrabbing: false,
VideoPath: '', VideoPath: ''
RandomNR: 3
}, },
sizes: { sizes: {
DBSize: 0, DBSize: 0,
@ -200,23 +199,6 @@ class GeneralSettings extends React.Component<Props, state> {
/> />
</Form.Group> </Form.Group>
<Form.Group className={style.mediacenternameform} data-testid='randnrform'>
<Form.Label>Number of random videos on Random page</Form.Label>
<Form.Control
type='number'
placeholder='2'
value={this.state.generalSettings.RandomNR}
onChange={(e): void =>
this.setState({
generalSettings: {
...this.state.generalSettings,
RandomNR: parseInt(e.target.value, 10)
}
})
}
/>
</Form.Group>
<Button variant='primary' type='submit'> <Button variant='primary' type='submit'>
Submit Submit
</Button> </Button>

View File

@ -40,7 +40,6 @@ export namespace SettingsTypes {
TVShowPath: string; TVShowPath: string;
TVShowEnabled: boolean; TVShowEnabled: boolean;
FullDeleteEnabled: boolean; FullDeleteEnabled: boolean;
RandomNR: number;
} }
export interface SettingsType { export interface SettingsType {
@ -51,7 +50,6 @@ export namespace SettingsTypes {
PasswordEnabled: boolean; PasswordEnabled: boolean;
TMDBGrabbing: boolean; TMDBGrabbing: boolean;
DarkMode: boolean; DarkMode: boolean;
RandomNR: number;
} }
export interface SizesType { export interface SizesType {

View File

@ -11,7 +11,6 @@ class StaticInfos {
private tvshowpath: string = ''; private tvshowpath: string = '';
private TVShowsEnabled: boolean = false; private TVShowsEnabled: boolean = false;
private fullDeleteable: boolean = false; private fullDeleteable: boolean = false;
private RandomNR: number = 3;
/** /**
* check if the current theme is the dark theme * check if the current theme is the dark theme
@ -45,7 +44,6 @@ class StaticInfos {
} }
handlers: (() => void)[] = []; handlers: (() => void)[] = [];
onThemeChange(func: () => void): void { onThemeChange(func: () => void): void {
this.handlers.push(func); this.handlers.push(func);
} }
@ -73,14 +71,6 @@ class StaticInfos {
getTVShowPath(): string { getTVShowPath(): string {
return this.tvshowpath; return this.tvshowpath;
} }
setRandomNR(nr: number): void {
this.RandomNR = nr;
}
getRandomNR(): number {
return this.RandomNR;
}
} }
export default new StaticInfos(); export default new StaticInfos();

View File

@ -32,7 +32,6 @@ export const LoginContextProvider: FunctionComponent = (props): JSX.Element => {
GlobalInfos.enableDarkTheme(result.DarkMode); GlobalInfos.enableDarkTheme(result.DarkMode);
GlobalInfos.setVideoPaths(result.VideoPath, result.TVShowPath); GlobalInfos.setVideoPaths(result.VideoPath, result.TVShowPath);
GlobalInfos.setRandomNR(result.RandomNR);
features.setTVShowEnabled(result.TVShowEnabled); features.setTVShowEnabled(result.TVShowEnabled);
features.setVideosFullyDeleteable(result.FullDeleteEnabled); features.setVideosFullyDeleteable(result.FullDeleteEnabled);

View File

@ -3538,9 +3538,9 @@ caniuse-api@^3.0.0:
lodash.uniq "^4.5.0" lodash.uniq "^4.5.0"
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001125, caniuse-lite@^1.0.30001219: caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001125, caniuse-lite@^1.0.30001219:
version "1.0.30001336" version "1.0.30001236"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001336.tgz" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001236.tgz#0a80de4cdf62e1770bb46a30d884fc8d633e3958"
integrity sha512-/YxSlBmL7iKXTbIJ48IQTnAOBk7XmWsxhBF1PZLOko5Dt9qc4Pl+84lfqG3Tc4EuavurRn1QLoVJGxY2iSycfw== integrity sha512-o0PRQSrSCGJKCPZcgMzl5fUaj5xHe8qA2m4QRvnyY4e1lITqoNkr7q/Oh1NcpGSy0Th97UZ35yoKcINPoq7YOQ==
capture-exit@^2.0.0: capture-exit@^2.0.0:
version "2.0.0" version "2.0.0"