Add Handy / Funscript support (#1377)

* Add funscript route to scenes

Adds a /scene/:id/funscript route which serves a funscript file, if present.

Current convention is that these are files stored with the same path, but with the extension ".funscript".

* Look for funscript during scan

This is stored in the Scene record and used to drive UI changes for funscript support.

Currently, that's limited to a funscript link in the Scene's file info.

* Add filtering and sorting for interactive
* Add Handy connection key to interface config
* Add Handy client and placeholder component.

Uses defucilis/thehandy, but not thehandy-react as I had difficulty integrating the context with the existing components.

Instead, the expensive calculation for the server time offset is put in localStorage for reuse.

A debounce was added when scrubbing the video, as otherwise it spammed the Handy API with updates to the current offset.
This commit is contained in:
UnluckyChemical765
2021-05-23 20:34:28 -07:00
committed by GitHub
parent 33999d3e93
commit 547f6d79ad
32 changed files with 301 additions and 24 deletions

View File

@@ -34,6 +34,7 @@ export const SettingsInterfacePanel: React.FC = () => {
const [css, setCSS] = useState<string>();
const [cssEnabled, setCSSEnabled] = useState<boolean>(false);
const [language, setLanguage] = useState<string>("en");
const [handyKey, setHandyKey] = useState<string>();
const [updateInterfaceConfig] = useConfigureInterface({
menuItems: menuItemIds,
@@ -47,6 +48,7 @@ export const SettingsInterfacePanel: React.FC = () => {
cssEnabled,
language,
slideshowDelay,
handyKey,
});
useEffect(() => {
@@ -62,6 +64,7 @@ export const SettingsInterfacePanel: React.FC = () => {
setCSSEnabled(iCfg?.cssEnabled ?? false);
setLanguage(iCfg?.language ?? "en-US");
setSlideshowDelay(iCfg?.slideshowDelay ?? 5000);
setHandyKey(iCfg?.handyKey ?? "");
}, [config]);
async function onSave() {
@@ -235,6 +238,20 @@ export const SettingsInterfacePanel: React.FC = () => {
</Form.Text>
</Form.Group>
<Form.Group>
<h5>Handy Connection Key</h5>
<Form.Control
className="col col-sm-6 text-input"
value={handyKey}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
setHandyKey(e.currentTarget.value);
}}
/>
<Form.Text className="text-muted">
Handy connection key to use for interactive scenes.
</Form.Text>
</Form.Group>
<hr />
<Button variant="primary" onClick={() => onSave()}>
Save