[ SYSTEM ]: Linux wordpress 6.1.0-44-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.164-1 (2026-03-09) x86_64
[ SERVER ]: Apache/2.4.66 (Debian) | PHP: 8.2.30
[ USER ]: www-data | IP: 172.19.30.54
GEFORCE FILE MANAGER
/
var
/
www
/
html
/
wordpress
/
wp-content
/
plugins
/
presto-player
/
src
/
admin
/
blocks
/
blocks
/
bunny
/
UPLOAD:
NAME
SIZE
QUICK PERMS
ACTIONS
📁 popup
SET
[ DEL ]
📄 APIPlaceholder.js
2,475 B
SET
[ EDIT ]
|
[ DEL ]
📄 StorageMedia.js
3,138 B
SET
[ EDIT ]
|
[ DEL ]
📄 StreamMedia.js
968 B
SET
[ EDIT ]
|
[ DEL ]
📄 block.json
3,024 B
SET
[ EDIT ]
|
[ DEL ]
📄 edit.js
15,670 B
SET
[ EDIT ]
|
[ DEL ]
📄 index.js
1,012 B
SET
[ EDIT ]
|
[ DEL ]
📄 useMedia.js
1,017 B
SET
[ EDIT ]
|
[ DEL ]
📄 useStorageConnection.js
2,896 B
SET
[ EDIT ]
|
[ DEL ]
📄 useStreamConnection.js
2,995 B
SET
[ EDIT ]
|
[ DEL ]
DELETE SELECTED
[ CLOSE ]
EDIT: useStreamConnection.js
const { __ } = wp.i18n; const { useState } = wp.element; const baseUrl = `${prestoPlayer.root}${prestoPlayer.prestoVersionString}bunny/stream/`; export default (onRefetch) => { const [apikey, setApikey] = useState(""); const [saveMessage, setSaveMessage] = useState(""); const [saving, setSaving] = useState(false); const [step, setStep] = useState(0); const [error, setError] = useState(""); const getError = (errorString) => { if (errorString.includes("Authorization has been denied")) { return "Your API key is incorrect. Please double-check to make sure you've copied it correctly."; } if (errorString.includes("localhost")) { return "You cannot use a CDN on a local site. Please use Bunny.net on a live, publicly accessible site."; } return errorString; }; const saveKey = async () => { setError(""); try { setSaving(true); setStep(0); setSaveMessage(__("Validating API Key...", "presto-player")); const { success } = await wp.apiFetch({ url: `${baseUrl}api-key`, method: "POST", data: { api_key: apikey, }, }); if (!success) { throw { message: "Could not save the API key. Please double check it to make sure it's correct.", }; } } catch (e) { setStep(0); setError( e?.message ? getError(e.message) : "Something went wrong. Please try again" ); return; } finally { setStep(1); setSaving(false); setSaveMessage(""); } // public library try { setSaving(true); setSaveMessage( __( "Setting up public video library. This make take a few moments...", "presto-player" ) ); const { id } = await wp.apiFetch({ url: `${baseUrl}library`, method: "POST", data: { type: "public", }, }); } catch (e) { setStep(0); setError( e?.message ? getError(e.message) : "Something went wrong. Please try again" ); return; } finally { setStep(2); setSaving(false); setSaveMessage(""); } // private library try { setSaving(true); setSaveMessage( __( "Setting up private video library. This make take a few moments...", "presto-player" ) ); await wp.apiFetch({ url: `${baseUrl}library`, method: "POST", data: { type: "private", }, }); } catch (e) { setStep(0); setError( e?.message ? getError(e.message) : "Something went wrong. Please try again" ); return; } finally { setStep(2); setSaving(false); setSaveMessage(""); } onRefetch(); }; const totalSteps = 3; return { saveKey, setApikey, step, saveMessage, saving, error, totalSteps }; };