feat: support URL Schema 'profile-web-page-url' (#816)
This commit is contained in:
committed by
GitHub
Unverified
parent
98536250bd
commit
3ee3e7c17b
@@ -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 },
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
"Create Profile": "Создать профиль",
|
||||
"Choose File": "Выбрать файл",
|
||||
"Close All": "Закрыть всё",
|
||||
"Home": "Главная",
|
||||
"Select": "Выбрать",
|
||||
"Edit Info": "Изменить информацию",
|
||||
"Edit File": "Изменить файл",
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
"Create Profile": "新建订阅",
|
||||
"Choose File": "选择文件",
|
||||
"Close All": "关闭全部",
|
||||
"Home": "首页",
|
||||
"Select": "使用",
|
||||
"Edit Info": "编辑信息",
|
||||
"Edit File": "编辑文件",
|
||||
|
||||
1
src/services/types.d.ts
vendored
1
src/services/types.d.ts
vendored
@@ -168,6 +168,7 @@ interface IProfileItem {
|
||||
expire: number;
|
||||
};
|
||||
option?: IProfileOption;
|
||||
home?: string;
|
||||
}
|
||||
|
||||
interface IProfileOption {
|
||||
|
||||
Reference in New Issue
Block a user