mirror of
https://github.com/tubearchivist/tubearchivist.git
synced 2025-03-12 08:50:13 +00:00
add cast to appsettings
This commit is contained in:
parent
73f7e8945c
commit
7229cf1930
@ -62,6 +62,7 @@ class AppConfigAppSerializer(
|
|||||||
"""serialize app config"""
|
"""serialize app config"""
|
||||||
|
|
||||||
enable_snapshot = serializers.BooleanField()
|
enable_snapshot = serializers.BooleanField()
|
||||||
|
enable_cast = serializers.BooleanField()
|
||||||
|
|
||||||
|
|
||||||
class AppConfigSerializer(ValidateUnknownFieldsMixin, serializers.Serializer):
|
class AppConfigSerializer(ValidateUnknownFieldsMixin, serializers.Serializer):
|
||||||
|
@ -51,6 +51,7 @@ class ApplicationConfigType(TypedDict):
|
|||||||
"""describes application config"""
|
"""describes application config"""
|
||||||
|
|
||||||
enable_snapshot: bool
|
enable_snapshot: bool
|
||||||
|
enable_cast: bool
|
||||||
|
|
||||||
|
|
||||||
class AppConfigType(TypedDict):
|
class AppConfigType(TypedDict):
|
||||||
@ -93,7 +94,10 @@ class AppConfig:
|
|||||||
"integrate_ryd": False,
|
"integrate_ryd": False,
|
||||||
"integrate_sponsorblock": False,
|
"integrate_sponsorblock": False,
|
||||||
},
|
},
|
||||||
"application": {"enable_snapshot": True},
|
"application": {
|
||||||
|
"enable_snapshot": True,
|
||||||
|
"enable_cast": False,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -29,6 +29,7 @@ export type AppSettingsConfigType = {
|
|||||||
};
|
};
|
||||||
application: {
|
application: {
|
||||||
enable_snapshot: boolean;
|
enable_snapshot: boolean;
|
||||||
|
enable_cast: boolean;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -92,8 +92,7 @@ const EmbeddableVideoPlayer = ({ videoId }: EmbeddableVideoPlayerProps) => {
|
|||||||
const likes = formatNumbers(video.stats.like_count);
|
const likes = formatNumbers(video.stats.like_count);
|
||||||
const hasDislikes = video.stats.dislike_count > 0 && appSettingsConfig.downloads.integrate_ryd;
|
const hasDislikes = video.stats.dislike_count > 0 && appSettingsConfig.downloads.integrate_ryd;
|
||||||
const dislikes = formatNumbers(video.stats.dislike_count);
|
const dislikes = formatNumbers(video.stats.dislike_count);
|
||||||
// const config = videoResponse.config;
|
const cast = appSettingsConfig.application.enable_cast;
|
||||||
const cast = false; // config.enable_cast;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -92,6 +92,7 @@ const SettingsApplication = () => {
|
|||||||
const [showApiToken, setShowApiToken] = useState(false);
|
const [showApiToken, setShowApiToken] = useState(false);
|
||||||
const [downloadDislikes, setDownloadDislikes] = useState(false);
|
const [downloadDislikes, setDownloadDislikes] = useState(false);
|
||||||
const [enableSponsorBlock, setEnableSponsorBlock] = useState(false);
|
const [enableSponsorBlock, setEnableSponsorBlock] = useState(false);
|
||||||
|
const [enableCast, setEnableCast] = useState(false);
|
||||||
|
|
||||||
// Snapshots
|
// Snapshots
|
||||||
const [enableSnapshots, setEnableSnapshots] = useState(false);
|
const [enableSnapshots, setEnableSnapshots] = useState(false);
|
||||||
@ -135,6 +136,7 @@ const SettingsApplication = () => {
|
|||||||
// Integrations
|
// Integrations
|
||||||
setDownloadDislikes(appSettingsConfig.downloads.integrate_ryd);
|
setDownloadDislikes(appSettingsConfig.downloads.integrate_ryd);
|
||||||
setEnableSponsorBlock(appSettingsConfig.downloads.integrate_sponsorblock);
|
setEnableSponsorBlock(appSettingsConfig.downloads.integrate_sponsorblock);
|
||||||
|
setEnableCast(appSettingsConfig.application.enable_cast);
|
||||||
|
|
||||||
// Snapshots
|
// Snapshots
|
||||||
setEnableSnapshots(appSettingsConfig.application.enable_snapshot);
|
setEnableSnapshots(appSettingsConfig.application.enable_snapshot);
|
||||||
@ -867,6 +869,16 @@ const SettingsApplication = () => {
|
|||||||
updateCallback={handleUpdateConfig}
|
updateCallback={handleUpdateConfig}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="settings-box-wrapper">
|
||||||
|
<div>
|
||||||
|
<p>Enable Cast</p>
|
||||||
|
</div>
|
||||||
|
<ToggleConfig
|
||||||
|
name="application.enable_cast"
|
||||||
|
value={enableCast}
|
||||||
|
updateCallback={handleUpdateConfig}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="info-box-item">
|
<div className="info-box-item">
|
||||||
<h2>Snapshots</h2>
|
<h2>Snapshots</h2>
|
||||||
|
@ -39,7 +39,7 @@ import loadVideoNav, { VideoNavResponseType } from '../api/loader/loadVideoNav';
|
|||||||
import useIsAdmin from '../functions/useIsAdmin';
|
import useIsAdmin from '../functions/useIsAdmin';
|
||||||
import ToggleConfig from '../components/ToggleConfig';
|
import ToggleConfig from '../components/ToggleConfig';
|
||||||
import { PlaylistType } from '../api/loader/loadPlaylistById';
|
import { PlaylistType } from '../api/loader/loadPlaylistById';
|
||||||
// import { useAppSettingsStore } from '../stores/AppSettingsStore';
|
import { useAppSettingsStore } from '../stores/AppSettingsStore';
|
||||||
|
|
||||||
const isInPlaylist = (videoId: string, playlist: PlaylistType) => {
|
const isInPlaylist = (videoId: string, playlist: PlaylistType) => {
|
||||||
return playlist.playlist_entries.some(entry => {
|
return playlist.playlist_entries.some(entry => {
|
||||||
@ -110,7 +110,7 @@ const Video = () => {
|
|||||||
const { videoId } = useParams() as VideoParams;
|
const { videoId } = useParams() as VideoParams;
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const isAdmin = useIsAdmin();
|
const isAdmin = useIsAdmin();
|
||||||
// const { appSettingsConfig } = useAppSettingsStore();
|
const { appSettingsConfig } = useAppSettingsStore();
|
||||||
|
|
||||||
const [videoEnded, setVideoEnded] = useState(false);
|
const [videoEnded, setVideoEnded] = useState(false);
|
||||||
const [playlistAutoplay, setPlaylistAutoplay] = useState(
|
const [playlistAutoplay, setPlaylistAutoplay] = useState(
|
||||||
@ -193,7 +193,6 @@ const Video = () => {
|
|||||||
|
|
||||||
const video = videoResponse;
|
const video = videoResponse;
|
||||||
const watched = videoResponse.player.watched;
|
const watched = videoResponse.player.watched;
|
||||||
// const config = appSettingsConfig;
|
|
||||||
const playlistNav = videoPlaylistNav;
|
const playlistNav = videoPlaylistNav;
|
||||||
const sponsorBlock = videoResponse.sponsorblock;
|
const sponsorBlock = videoResponse.sponsorblock;
|
||||||
const customPlaylists = customPlaylistsResponse?.data;
|
const customPlaylists = customPlaylistsResponse?.data;
|
||||||
@ -202,7 +201,7 @@ const Video = () => {
|
|||||||
|
|
||||||
console.log('playlistNav', playlistNav);
|
console.log('playlistNav', playlistNav);
|
||||||
|
|
||||||
const cast = false; // config.enable_cast;
|
const cast = appSettingsConfig.application.enable_cast;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -36,6 +36,7 @@ export const useAppSettingsStore = create<AppSettingsState>(set => ({
|
|||||||
},
|
},
|
||||||
application: {
|
application: {
|
||||||
enable_snapshot: false,
|
enable_snapshot: false,
|
||||||
|
enable_cast: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
setAppSettingsConfig: appSettingsConfig => set({ appSettingsConfig }),
|
setAppSettingsConfig: appSettingsConfig => set({ appSettingsConfig }),
|
||||||
|
Loading…
Reference in New Issue
Block a user