mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-22 16:06:19 -05:00
Adding HelpHeader to display a modal with the relevant Help document.
This commit is contained in:
parent
f94fc0fc5a
commit
fa97b25831
3 changed files with 59 additions and 20 deletions
|
|
@ -44,7 +44,7 @@ import {
|
|||
import {FilePreviewContext} from "./FilePreview";
|
||||
import _ from "lodash";
|
||||
import {killDownloads, startDownloads, unlockCookies} from "../api";
|
||||
import {allFrequencyOptions, NAME, semanticUIColorMap, validUrlRegex} from "./Vars";
|
||||
import {allFrequencyOptions, HELP_VIEWER_URI, NAME, semanticUIColorMap, validUrlRegex} from "./Vars";
|
||||
import Grid from "semantic-ui-react/dist/commonjs/collections/Grid";
|
||||
|
||||
export function Paginator({activePage, onPageChange, totalPages, showFirstAndLast, size = 'mini'}) {
|
||||
|
|
@ -903,6 +903,51 @@ export function InfoHeader({
|
|||
</div>
|
||||
}
|
||||
|
||||
export function HelpModal({
|
||||
icon = 'help circle',
|
||||
iconSize = null,
|
||||
iconStyle = {margin: '0.5em'},
|
||||
helpPath,
|
||||
title = null,
|
||||
modalSize = 'fullscreen',
|
||||
}) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const src = `${HELP_VIEWER_URI}${helpPath}`;
|
||||
const style = {position: 'relative', height: '75vh', width: '100%', border: 'none'};
|
||||
|
||||
return <>
|
||||
<Icon link name={icon} size={iconSize} style={iconStyle} onClick={() => setOpen(true)}/>
|
||||
<Modal open={open} onClose={() => setOpen(false)} size={modalSize} closeIcon>
|
||||
{title && <Modal.Header>{title}</Modal.Header>}
|
||||
<Modal.Content>
|
||||
<IframeViewer title={title} src={src} style={style}/>
|
||||
</Modal.Content>
|
||||
</Modal>
|
||||
</>
|
||||
}
|
||||
|
||||
export function HelpHeader({
|
||||
icon,
|
||||
headerSize = 'h2',
|
||||
iconSize,
|
||||
headerContent,
|
||||
helpPath,
|
||||
helpTitle,
|
||||
helpModalProps = {},
|
||||
for_ = null,
|
||||
required = false,
|
||||
...props
|
||||
}) {
|
||||
return <div className='inline-header' {...props}>
|
||||
<label htmlFor={for_}>
|
||||
<Header as={headerSize}>{headerContent} {required && <RequiredAsterisk/>}</Header>
|
||||
</label>
|
||||
<span>
|
||||
<HelpModal helpPath={helpPath} iconSize={iconSize} icon={icon} title={helpTitle} {...helpModalProps}/>
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
|
||||
export function HotspotToggle() {
|
||||
let {on, setHotspot} = useHotspot();
|
||||
const disabled = on === null;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import {
|
|||
findPosterPath,
|
||||
humanFileSize,
|
||||
humanNumber,
|
||||
HelpHeader,
|
||||
InfoHeader,
|
||||
isoDatetimeToAgoPopup,
|
||||
mimetypeColor,
|
||||
|
|
@ -65,7 +66,7 @@ import {
|
|||
} from "../api";
|
||||
import {Media, QueryContext, ThemeContext} from "../contexts/contexts";
|
||||
import _ from "lodash";
|
||||
import {defaultFileOrder, defaultSearchOrder, HELP_VIEWER_URI} from "./Vars";
|
||||
import {defaultFileOrder, defaultSearchOrder} from "./Vars";
|
||||
import {InputForm, ToggleForm, useForm} from "../hooks/useForm";
|
||||
import {VideoFormatSelectorForm, VideoResolutionSelectorForm} from "./Download";
|
||||
import {BatchReorganizeModal} from "./collections/BatchReorganizeModal";
|
||||
|
|
@ -645,24 +646,12 @@ function CookiesSettingsSection() {
|
|||
return <Label color='yellow'>Locked</Label>;
|
||||
};
|
||||
|
||||
const popupContent = <div>
|
||||
<p>Upload cookies exported from your browser to allow yt-dlp to download videos that require authentication.</p>
|
||||
<p><strong>Browser extensions for exporting cookies:</strong></p>
|
||||
<ul>
|
||||
<li><strong>Chrome/Brave:</strong> <a href="https://chromewebstore.google.com/detail/get-cookiestxt-locally/cclelndahbckbenkjhflpdbgdldlbecc" target="_blank" rel="noopener noreferrer">Get cookies.txt LOCALLY</a></li>
|
||||
<li><strong>Firefox:</strong> <a href="https://addons.mozilla.org/en-US/firefox/addon/get-cookies-txt-locally/" target="_blank" rel="noopener noreferrer">Get cookies.txt LOCALLY</a></li>
|
||||
</ul>
|
||||
<p>Cookies are encrypted with AES-128 and stored securely. You'll need to unlock them with your password after each restart.</p>
|
||||
</div>;
|
||||
|
||||
return <Segment>
|
||||
<Header as='h4'>
|
||||
<InfoHeader
|
||||
headerSize='h4'
|
||||
headerContent='Encrypted Cookies'
|
||||
popupContent={popupContent}
|
||||
/>
|
||||
</Header>
|
||||
<HelpHeader
|
||||
headerSize='h4'
|
||||
headerContent='Encrypted Cookies'
|
||||
helpPath='/modules/videos/cookies/'
|
||||
/>
|
||||
|
||||
<p>Use this feature at your own risk! You may be suspended or blocked if abused!
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import {ButtonGroup, Container, Dimmer, Dropdown, GridColumn, GridRow, Icon, Inp
|
|||
import {
|
||||
APIButton,
|
||||
ErrorMessage,
|
||||
HelpHeader,
|
||||
InfoPopup,
|
||||
RefreshHeader,
|
||||
Toggle,
|
||||
|
|
@ -817,7 +818,11 @@ export function SettingsPage() {
|
|||
|
||||
<Divider/>
|
||||
|
||||
<Header as='h3'>Root CA Certificate</Header>
|
||||
<HelpHeader
|
||||
headerSize={'h3'}
|
||||
headerContent='Root CA Certificate'
|
||||
helpPath='/system/certificates/'
|
||||
/>
|
||||
<p>Install the WROLPi Root CA certificate on your devices to trust all HTTPS connections to this WROLPi.
|
||||
You only need to do this once per device.</p>
|
||||
<a href='/ca.crt' download='wrolpi-ca.crt'>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue