mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-04-21 00:32:04 +00:00
Merge pull request #122 from CrissZollo/url
Adding addons with stremio:// URL
This commit is contained in:
commit
1e9c8b07ac
2 changed files with 11 additions and 6 deletions
0
android/gradlew
vendored
Normal file → Executable file
0
android/gradlew
vendored
Normal file → Executable file
|
|
@ -700,7 +700,7 @@ const AddonsScreen = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAddAddon = async (url?: string) => {
|
const handleAddAddon = async (url?: string) => {
|
||||||
const urlToInstall = url || addonUrl;
|
let urlToInstall = url || addonUrl;
|
||||||
if (!urlToInstall) {
|
if (!urlToInstall) {
|
||||||
setAlertTitle('Error');
|
setAlertTitle('Error');
|
||||||
setAlertMessage('Please enter an addon URL or select a community addon');
|
setAlertMessage('Please enter an addon URL or select a community addon');
|
||||||
|
|
@ -709,6 +709,11 @@ const AddonsScreen = () => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Replace stremio:// with https:// if present
|
||||||
|
if (urlToInstall.startsWith('stremio://')) {
|
||||||
|
urlToInstall = urlToInstall.replace(/^stremio:\/\//, 'https://');
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setInstalling(true);
|
setInstalling(true);
|
||||||
const manifest = await stremioService.getManifest(urlToInstall);
|
const manifest = await stremioService.getManifest(urlToInstall);
|
||||||
|
|
@ -716,11 +721,11 @@ const AddonsScreen = () => {
|
||||||
setAddonUrl(urlToInstall);
|
setAddonUrl(urlToInstall);
|
||||||
setShowConfirmModal(true);
|
setShowConfirmModal(true);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error('Failed to fetch addon details:', error);
|
logger.error('Failed to fetch addon details:', error);
|
||||||
setAlertTitle('Error');
|
setAlertTitle('Error');
|
||||||
setAlertMessage(`Failed to fetch addon details from ${urlToInstall}`);
|
setAlertMessage(`Failed to fetch addon details from ${urlToInstall}`);
|
||||||
setAlertActions([{ label: 'OK', onPress: () => setAlertVisible(false) }]);
|
setAlertActions([{ label: 'OK', onPress: () => setAlertVisible(false) }]);
|
||||||
setAlertVisible(true);
|
setAlertVisible(true);
|
||||||
} finally {
|
} finally {
|
||||||
setInstalling(false);
|
setInstalling(false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue