Skip to content

Commit

Permalink
feat: ftp server support (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
KirCute authored Dec 10, 2024
1 parent 24a8f43 commit 632abec
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/lang/en/manage.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"docs": "Documentation",
"offline_download": "Offline Download",
"ldap": "LDAP",
"s3": "S3"
"s3": "S3",
"ftp": "FTP"
},
"title": "AList Manage",
"not_admin": "You are not admin user, please login with admin account.",
Expand Down
9 changes: 8 additions & 1 deletion src/lang/en/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,12 @@
"version": "Version",
"video_autoplay": "Video autoplay",
"video_types": "Video types",
"webauthn_login_enabled": "Webauthn login enabled"
"webauthn_login_enabled": "Webauthn login enabled",
"ftp_public_host": "Public IP/Host",
"ftp_pasv_port_map": "Passive transfer port mapping",
"ftp_proxy_user_agent": "HTTP proxy user agent",
"ftp_mandatory_tls": "Enable mandatory TLS",
"ftp_implicit_tls": "Enable implicit TLS (implies mandatory TLS)",
"ftp_tls_private_key_path": "Path to TLS private key file",
"ftp_tls_public_cert_path": "Path to TLS certificate file"
}
4 changes: 3 additions & 1 deletion src/lang/en/users.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"copy": "Copy",
"delete": "Delete",
"webdav_read": "Webdav read",
"webdav_manage": "Webdav manage"
"webdav_manage": "Webdav manage",
"ftp_read": "FTP read",
"ftp_manage": "FTP manage"
},
"username": "Username",
"password": "Password",
Expand Down
7 changes: 7 additions & 0 deletions src/pages/manage/sidemenu_items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
BsCloudUploadFill,
BsSearch,
BsBucket,
BsHddNetwork,
} from "solid-icons/bs"
import { FiLogIn } from "solid-icons/fi"
import { SiMetabase } from "solid-icons/si"
Expand Down Expand Up @@ -84,6 +85,12 @@ export const side_menu_items: SideMenuItem[] = [
to: "/@manage/settings/s3",
component: lazy(() => import("./settings/S3")),
},
{
title: "manage.sidemenu.ftp",
icon: BsHddNetwork,
to: "/@manage/settings/ftp",
component: () => <CommonSettings group={Group.FTP} />,
},
{
title: "manage.sidemenu.other",
icon: BsMedium,
Expand Down
1 change: 1 addition & 0 deletions src/types/setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export enum Group {
SSO,
LDAP,
S3,
FTP,
}
export enum Flag {
PUBLIC,
Expand Down
8 changes: 6 additions & 2 deletions src/types/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@ export const UserPermissions = [
"delete",
"webdav_read",
"webdav_manage",
"ftp_read",
"ftp_manage",
] as const

export const UserMethods = {
is_guest: (user: User) => user.role === UserRole.GUEST,
is_admin: (user: User) => user.role === UserRole.ADMIN,
is_general: (user: User) => user.role === UserRole.GENERAL,
can: (user: User, permission: number) =>
UserMethods.is_admin(user) || ((user.permission >> permission) & 1) == 1,
can: (user: User, permission: number) => {
let adminPrivilege = UserMethods.is_admin(user) && permission < 10
return adminPrivilege || ((user.permission >> permission) & 1) == 1
},
// can_see_hides: (user: User) =>
// UserMethods.is_admin(user) || (user.permission & 1) == 1,
// can_access_without_password: (user: User) =>
Expand Down

0 comments on commit 632abec

Please sign in to comment.