(fileName: string, frontDir?: string)
| 864 | }; |
| 865 | |
| 866 | const getFileLink = async (fileName: string, frontDir?: string) => { |
| 867 | frontDir = frontDir || currentPath.value; |
| 868 | const { state: downloadCfg, execute: getDownloadCfg } = downloadAddress(); |
| 869 | |
| 870 | try { |
| 871 | await getDownloadCfg({ |
| 872 | params: { |
| 873 | file_name: frontDir + fileName, |
| 874 | daemonId: daemonId || "", |
| 875 | uuid: instanceId || "" |
| 876 | } |
| 877 | }); |
| 878 | if (!downloadCfg.value) return null; |
| 879 | const addr = parseForwardAddress(getFileConfigAddr(downloadCfg.value), "http"); |
| 880 | const path = `/download/${downloadCfg.value.password}/${fileName}`; |
| 881 | return addr + path; |
| 882 | } catch (err: any) { |
| 883 | console.error(err); |
| 884 | return reportErrorMsg(err.message); |
| 885 | } |
| 886 | }; |
| 887 | |
| 888 | const downloadFromUrl = async (downloadConfig: DownloadFileConfigItem) => { |
| 889 | if (!downloadConfig.url) throw new Error(t("TXT_CODE_f3031262")); |
no test coverage detected