mirror of
https://github.com/neosubhamoy/neodlp.git
synced 2025-12-19 17:52:59 +05:30
feat: added force ipv protocol settings
This commit is contained in:
17
src/App.tsx
17
src/App.tsx
@@ -81,6 +81,8 @@ export default function App({ children }: { children: React.ReactNode }) {
|
|||||||
const SPONSORBLOCK_REMOVE_CATEGORIES = useSettingsPageStatesStore(state => state.settings.sponsorblock_remove_categories);
|
const SPONSORBLOCK_REMOVE_CATEGORIES = useSettingsPageStatesStore(state => state.settings.sponsorblock_remove_categories);
|
||||||
const SPONSORBLOCK_MARK_CATEGORIES = useSettingsPageStatesStore(state => state.settings.sponsorblock_mark_categories);
|
const SPONSORBLOCK_MARK_CATEGORIES = useSettingsPageStatesStore(state => state.settings.sponsorblock_mark_categories);
|
||||||
const USE_ARIA2 = useSettingsPageStatesStore(state => state.settings.use_aria2);
|
const USE_ARIA2 = useSettingsPageStatesStore(state => state.settings.use_aria2);
|
||||||
|
const USE_FORCE_INTERNET_PROTOCOL = useSettingsPageStatesStore(state => state.settings.use_force_internet_protocol);
|
||||||
|
const FORCE_INTERNET_PROTOCOL = useSettingsPageStatesStore(state => state.settings.force_internet_protocol);
|
||||||
|
|
||||||
const isErrored = useDownloaderPageStatesStore((state) => state.isErrored);
|
const isErrored = useDownloaderPageStatesStore((state) => state.isErrored);
|
||||||
const isErrorExpected = useDownloaderPageStatesStore((state) => state.isErrorExpected);
|
const isErrorExpected = useDownloaderPageStatesStore((state) => state.isErrorExpected);
|
||||||
@@ -123,6 +125,13 @@ export default function App({ children }: { children: React.ReactNode }) {
|
|||||||
if (STRICT_DOWNLOADABILITY_CHECK && !formatId) args.push('--check-all-formats');
|
if (STRICT_DOWNLOADABILITY_CHECK && !formatId) args.push('--check-all-formats');
|
||||||
if (STRICT_DOWNLOADABILITY_CHECK && formatId) args.push('--check-formats');
|
if (STRICT_DOWNLOADABILITY_CHECK && formatId) args.push('--check-formats');
|
||||||
if (USE_PROXY && PROXY_URL) args.push('--proxy', PROXY_URL);
|
if (USE_PROXY && PROXY_URL) args.push('--proxy', PROXY_URL);
|
||||||
|
if (USE_FORCE_INTERNET_PROTOCOL && FORCE_INTERNET_PROTOCOL) {
|
||||||
|
if (FORCE_INTERNET_PROTOCOL === 'ipv4') {
|
||||||
|
args.push('--force-ipv4');
|
||||||
|
} else if (FORCE_INTERNET_PROTOCOL === 'ipv6') {
|
||||||
|
args.push('--force-ipv6');
|
||||||
|
}
|
||||||
|
}
|
||||||
if (USE_COOKIES) {
|
if (USE_COOKIES) {
|
||||||
if (IMPORT_COOKIES_FROM === 'browser' && COOKIES_BROWSER) {
|
if (IMPORT_COOKIES_FROM === 'browser' && COOKIES_BROWSER) {
|
||||||
args.push('--cookies-from-browser', COOKIES_BROWSER);
|
args.push('--cookies-from-browser', COOKIES_BROWSER);
|
||||||
@@ -293,6 +302,14 @@ export default function App({ children }: { children: React.ReactNode }) {
|
|||||||
if (USE_RATE_LIMIT && RATE_LIMIT) {
|
if (USE_RATE_LIMIT && RATE_LIMIT) {
|
||||||
args.push('--limit-rate', `${RATE_LIMIT}`);
|
args.push('--limit-rate', `${RATE_LIMIT}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (USE_FORCE_INTERNET_PROTOCOL && FORCE_INTERNET_PROTOCOL) {
|
||||||
|
if (FORCE_INTERNET_PROTOCOL === 'ipv4') {
|
||||||
|
args.push('--force-ipv4');
|
||||||
|
} else if (FORCE_INTERNET_PROTOCOL === 'ipv6') {
|
||||||
|
args.push('--force-ipv6');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (USE_COOKIES) {
|
if (USE_COOKIES) {
|
||||||
if (IMPORT_COOKIES_FROM === 'browser' && COOKIES_BROWSER) {
|
if (IMPORT_COOKIES_FROM === 'browser' && COOKIES_BROWSER) {
|
||||||
|
|||||||
@@ -107,6 +107,8 @@ export default function SettingsPage() {
|
|||||||
const sponsorblockRemoveCategories = useSettingsPageStatesStore(state => state.settings.sponsorblock_remove_categories);
|
const sponsorblockRemoveCategories = useSettingsPageStatesStore(state => state.settings.sponsorblock_remove_categories);
|
||||||
const sponsorblockMarkCategories = useSettingsPageStatesStore(state => state.settings.sponsorblock_mark_categories);
|
const sponsorblockMarkCategories = useSettingsPageStatesStore(state => state.settings.sponsorblock_mark_categories);
|
||||||
const useAria2 = useSettingsPageStatesStore(state => state.settings.use_aria2);
|
const useAria2 = useSettingsPageStatesStore(state => state.settings.use_aria2);
|
||||||
|
const useForceInternetProtocol = useSettingsPageStatesStore(state => state.settings.use_force_internet_protocol);
|
||||||
|
const forceInternetProtocol = useSettingsPageStatesStore(state => state.settings.force_internet_protocol);
|
||||||
|
|
||||||
const websocketPort = useSettingsPageStatesStore(state => state.settings.websocket_port);
|
const websocketPort = useSettingsPageStatesStore(state => state.settings.websocket_port);
|
||||||
const isChangingWebSocketPort = useSettingsPageStatesStore(state => state.isChangingWebSocketPort);
|
const isChangingWebSocketPort = useSettingsPageStatesStore(state => state.isChangingWebSocketPort);
|
||||||
@@ -737,6 +739,35 @@ export default function SettingsPage() {
|
|||||||
</form>
|
</form>
|
||||||
</Form>
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="force-internet-protocol">
|
||||||
|
<h3 className="font-semibold">Force Internet Protocol</h3>
|
||||||
|
<p className="text-xs text-muted-foreground mb-3">Force using a specific internet protocol (ipv4/ipv6) for all downloads, useful if you network supports only one (some sites may not work)</p>
|
||||||
|
<div className="flex items-center space-x-2 mb-4">
|
||||||
|
<Switch
|
||||||
|
id="use-force-internet-protocol"
|
||||||
|
checked={useForceInternetProtocol}
|
||||||
|
onCheckedChange={(checked) => saveSettingsKey('use_force_internet_protocol', checked)}
|
||||||
|
/>
|
||||||
|
<Label htmlFor="use-force-internet-protocol">Force</Label>
|
||||||
|
</div>
|
||||||
|
<RadioGroup
|
||||||
|
orientation="horizontal"
|
||||||
|
className="flex items-center gap-4 mb-2"
|
||||||
|
value={forceInternetProtocol}
|
||||||
|
onValueChange={(value) => saveSettingsKey('force_internet_protocol', value)}
|
||||||
|
disabled={!useForceInternetProtocol}
|
||||||
|
>
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<RadioGroupItem value="ipv4" id="force-ipv4" />
|
||||||
|
<Label htmlFor="force-ipv4">Use IPv4 Only</Label>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<RadioGroupItem value="ipv6" id="force-ipv6" />
|
||||||
|
<Label htmlFor="force-ipv6">Use IPv6 Only</Label>
|
||||||
|
</div>
|
||||||
|
</RadioGroup>
|
||||||
|
<Label className="text-xs text-muted-foreground">(Forced: {forceInternetProtocol === "ipv4" ? 'IPv4' : 'IPv6'}, Status: {useForceInternetProtocol ? 'Enabled' : 'Disabled'})</Label>
|
||||||
|
</div>
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
<TabsContent key="cookies" value="cookies" className="flex flex-col gap-4 min-h-[310px]">
|
<TabsContent key="cookies" value="cookies" className="flex flex-col gap-4 min-h-[310px]">
|
||||||
<div className="cookies">
|
<div className="cookies">
|
||||||
|
|||||||
@@ -152,6 +152,8 @@ export const useSettingsPageStatesStore = create<SettingsPageStatesStore>((set)
|
|||||||
sponsorblock_remove_categories: [],
|
sponsorblock_remove_categories: [],
|
||||||
sponsorblock_mark_categories: [],
|
sponsorblock_mark_categories: [],
|
||||||
use_aria2: false,
|
use_aria2: false,
|
||||||
|
use_force_internet_protocol: false,
|
||||||
|
force_internet_protocol: 'ipv4',
|
||||||
// extension settings
|
// extension settings
|
||||||
websocket_port: 53511
|
websocket_port: 53511
|
||||||
},
|
},
|
||||||
@@ -208,6 +210,8 @@ export const useSettingsPageStatesStore = create<SettingsPageStatesStore>((set)
|
|||||||
sponsorblock_remove_categories: [],
|
sponsorblock_remove_categories: [],
|
||||||
sponsorblock_mark_categories: [],
|
sponsorblock_mark_categories: [],
|
||||||
use_aria2: false,
|
use_aria2: false,
|
||||||
|
use_force_internet_protocol: false,
|
||||||
|
force_internet_protocol: 'ipv4',
|
||||||
// extension settings
|
// extension settings
|
||||||
websocket_port: 53511
|
websocket_port: 53511
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ export interface Settings {
|
|||||||
sponsorblock_remove_categories: string[];
|
sponsorblock_remove_categories: string[];
|
||||||
sponsorblock_mark_categories: string[];
|
sponsorblock_mark_categories: string[];
|
||||||
use_aria2: boolean;
|
use_aria2: boolean;
|
||||||
|
use_force_internet_protocol: boolean;
|
||||||
|
force_internet_protocol: string;
|
||||||
// extension settings
|
// extension settings
|
||||||
websocket_port: number;
|
websocket_port: number;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user