diff --git a/components/FileListing.tsx b/components/FileListing.tsx
index 554109d..3ddba42 100644
--- a/components/FileListing.tsx
+++ b/components/FileListing.tsx
@@ -268,6 +268,18 @@ const FileListing: FC<{ query?: ParsedUrlQuery }> = ({ query }) => {
}
}
+ // Get selected file permalink
+ const handleSelectedPermalink = (baseUrl: string) => {
+ return getFiles()
+ .filter(c => selected[c.id])
+ .map(
+ c =>
+ `${baseUrl}/api/raw/?path=${path}/${encodeURIComponent(c.name)}${hashedToken ? `&odpt=${hashedToken}` : ''}`
+ )
+ .reduce((urls, cur) => urls + cur + '\n', '')
+ .slice(0, -1)
+ }
+
// Folder recursive download
const handleFolderDownload = (path: string, id: string, name?: string) => () => {
const files = (async function* () {
@@ -324,6 +336,7 @@ const FileListing: FC<{ query?: ParsedUrlQuery }> = ({ query }) => {
totalGenerating,
handleSelectedDownload,
folderGenerating,
+ handleSelectedPermalink,
handleFolderDownload,
}
diff --git a/components/FolderGridLayout.tsx b/components/FolderGridLayout.tsx
index 9e4cbac..0d5ba2c 100644
--- a/components/FolderGridLayout.tsx
+++ b/components/FolderGridLayout.tsx
@@ -64,6 +64,7 @@ const FolderGridLayout = ({
totalGenerating,
handleSelectedDownload,
folderGenerating,
+ handleSelectedPermalink,
handleFolderDownload,
toast,
}) => {
@@ -86,6 +87,17 @@ const FolderGridLayout = ({
indeterminate={true}
title={t('Select all files')}
/>
+
{totalGenerating ? (
) : (
diff --git a/components/FolderListLayout.tsx b/components/FolderListLayout.tsx
index b0a1b94..167ab7f 100644
--- a/components/FolderListLayout.tsx
+++ b/components/FolderListLayout.tsx
@@ -41,6 +41,7 @@ const FolderListLayout = ({
totalGenerating,
handleSelectedDownload,
folderGenerating,
+ handleSelectedPermalink,
handleFolderDownload,
toast,
}) => {
@@ -75,6 +76,17 @@ const FolderListLayout = ({
indeterminate={true}
title={t('Select files')}
/>
+
{totalGenerating ? (
) : (
diff --git a/public/locales/en/common.json b/public/locales/en/common.json
index 853324d..739bdb4 100644
--- a/public/locales/en/common.json
+++ b/public/locales/en/common.json
@@ -31,6 +31,8 @@
"Customise link": "Customise link",
"Customised": "Customised",
"Customised and encoded": "Customised and encoded",
+ "Copy selected files permalink": "Copy selected files permalink",
+ "Copied selected files permalink.": "Copied selected files permalink.",
"Default": "Default",
"Do not pretend to be the site owner": "Do not pretend to be the site owner",
"Don't worry, after storing them, onedrive-vercel-index will take care of token refreshes and updates after your site goes live.": "Don't worry, after storing them, onedrive-vercel-index will take care of token refreshes and updates after your site goes live.",
diff --git a/public/locales/zh-CN/common.json b/public/locales/zh-CN/common.json
index da9e4d1..b12cd14 100644
--- a/public/locales/zh-CN/common.json
+++ b/public/locales/zh-CN/common.json
@@ -29,6 +29,8 @@
"Customise link": "自定义直链",
"Customised": "自定义链接",
"Customised and encoded": "URL 编码的自定义链接",
+ "Copy selected files permalink": "复制选定文件永久链接",
+ "Copied selected files permalink.": "已复制选定文件永久链接。",
"Default": "默认",
"Do not pretend to be the site owner": "你不是网站所有者",
"Don't worry, after storing them, onedrive-vercel-index will take care of token refreshes and updates after your site goes live.": "别担心,存储它们之后,onedrive-vercel-index 会在帮助你定时更新 token",