feat: support URL Schema 'profile-web-page-url' (#816)

This commit is contained in:
dongchengjie
2024-04-01 19:28:28 +08:00
committed by GitHub
Unverified
parent 98536250bd
commit 3ee3e7c17b
6 changed files with 30 additions and 2 deletions

View File

@@ -55,6 +55,7 @@ export const ProfileItem = (props: Props) => {
// remote file mode
const hasUrl = !!itemData.url;
const hasExtra = !!extra; // only subscription url has extra info
const hasHome = !!itemData.home; // only subscription url has home page
const { upload = 0, download = 0, total = 0 } = extra ?? {};
const from = parseUrl(itemData.url);
@@ -95,6 +96,11 @@ export const ProfileItem = (props: Props) => {
const [fileOpen, setFileOpen] = useState(false);
const [confirmOpen, setConfirmOpen] = useState(false);
const onOpenHome = () => {
setAnchorEl(null);
window.open(itemData.home); // use built-in browser
};
const onEditInfo = () => {
setAnchorEl(null);
onEdit();
@@ -166,7 +172,9 @@ export const ProfileItem = (props: Props) => {
}
});
const urlModeMenu = [
const urlModeMenu = (
hasHome ? [{ label: "Home", handler: onOpenHome }] : []
).concat([
{ label: "Select", handler: onForceSelect },
{ label: "Edit Info", handler: onEditInfo },
{ label: "Edit File", handler: onEditFile },
@@ -180,7 +188,7 @@ export const ProfileItem = (props: Props) => {
setConfirmOpen(true);
},
},
];
]);
const fileModeMenu = [
{ label: "Select", handler: onForceSelect },
{ label: "Edit Info", handler: onEditInfo },

View File

@@ -30,6 +30,7 @@
"Create Profile": "Create Profile",
"Choose File": "Choose File",
"Close All": "Close All",
"Home": "Home",
"Select": "Select",
"Edit Info": "Edit Info",
"Edit File": "Edit File",

View File

@@ -30,6 +30,7 @@
"Create Profile": "Создать профиль",
"Choose File": "Выбрать файл",
"Close All": "Закрыть всё",
"Home": "Главная",
"Select": "Выбрать",
"Edit Info": "Изменить информацию",
"Edit File": "Изменить файл",

View File

@@ -30,6 +30,7 @@
"Create Profile": "新建订阅",
"Choose File": "选择文件",
"Close All": "关闭全部",
"Home": "首页",
"Select": "使用",
"Edit Info": "编辑信息",
"Edit File": "编辑文件",

View File

@@ -168,6 +168,7 @@ interface IProfileItem {
expire: number;
};
option?: IProfileOption;
home?: string;
}
interface IProfileOption {