├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── 1_bug_report.yml │ ├── 2_feature_request.yml │ └── config.yml ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── add-labels-for-pr.yml │ ├── build-publish-to-oss.yml │ ├── build-publish-to-r2.yml │ ├── issue-translator.yml │ ├── llm-code-review.yml │ ├── sonarcloud-scan.yml │ ├── sync2gitee.yml │ └── tyops-check.yml ├── .gitignore ├── .goreleaser.yaml ├── .idea └── icon.png ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── Makefile ├── OWNERS ├── README.md ├── SECURITY.md ├── backend ├── app │ ├── api │ │ └── v1 │ │ │ ├── ai.go │ │ │ ├── app.go │ │ │ ├── app_install.go │ │ │ ├── auth.go │ │ │ ├── backup.go │ │ │ ├── clam.go │ │ │ ├── command.go │ │ │ ├── compose_template.go │ │ │ ├── container.go │ │ │ ├── cronjob.go │ │ │ ├── dashboard.go │ │ │ ├── database.go │ │ │ ├── database_common.go │ │ │ ├── database_mysql.go │ │ │ ├── database_postgresql.go │ │ │ ├── database_redis.go │ │ │ ├── device.go │ │ │ ├── docker.go │ │ │ ├── entry.go │ │ │ ├── fail2ban.go │ │ │ ├── favorite.go │ │ │ ├── file.go │ │ │ ├── firewall.go │ │ │ ├── ftp.go │ │ │ ├── group.go │ │ │ ├── helper │ │ │ └── helper.go │ │ │ ├── host.go │ │ │ ├── host_tool.go │ │ │ ├── image.go │ │ │ ├── image_repo.go │ │ │ ├── logs.go │ │ │ ├── mcp_server.go │ │ │ ├── monitor.go │ │ │ ├── nginx.go │ │ │ ├── php_extensions.go │ │ │ ├── process.go │ │ │ ├── recycle_bin.go │ │ │ ├── runtime.go │ │ │ ├── setting.go │ │ │ ├── snapshot.go │ │ │ ├── ssh.go │ │ │ ├── terminal.go │ │ │ ├── upgrade.go │ │ │ ├── website.go │ │ │ ├── website_acme_account.go │ │ │ ├── website_ca.go │ │ │ ├── website_dns_account.go │ │ │ ├── website_domain.go │ │ │ └── website_ssl.go │ ├── dto │ │ ├── ai.go │ │ ├── alert.go │ │ ├── app.go │ │ ├── auth.go │ │ ├── backup.go │ │ ├── clam.go │ │ ├── command.go │ │ ├── common_req.go │ │ ├── common_res.go │ │ ├── compose_template.go │ │ ├── container.go │ │ ├── cronjob.go │ │ ├── dashboard.go │ │ ├── database.go │ │ ├── database_postgresql.go │ │ ├── device.go │ │ ├── docker.go │ │ ├── fail2ban.go │ │ ├── firewall.go │ │ ├── ftp.go │ │ ├── group.go │ │ ├── host.go │ │ ├── image.go │ │ ├── image_repo.go │ │ ├── logs.go │ │ ├── mcp.go │ │ ├── monitor.go │ │ ├── nginx.go │ │ ├── request │ │ │ ├── app.go │ │ │ ├── favorite.go │ │ │ ├── file.go │ │ │ ├── host_tool.go │ │ │ ├── mcp_server.go │ │ │ ├── nginx.go │ │ │ ├── php_extensions.go │ │ │ ├── process.go │ │ │ ├── recycle_bin.go │ │ │ ├── runtime.go │ │ │ ├── website.go │ │ │ └── website_ssl.go │ │ ├── response │ │ │ ├── app.go │ │ │ ├── favorite.go │ │ │ ├── file.go │ │ │ ├── host_tool.go │ │ │ ├── mcp_server.go │ │ │ ├── nginx.go │ │ │ ├── php_extensions.go │ │ │ ├── recycle_bin.go │ │ │ ├── runtime.go │ │ │ ├── website.go │ │ │ └── website_ssl.go │ │ ├── setting.go │ │ └── ssh.go │ ├── model │ │ ├── ai.go │ │ ├── app.go │ │ ├── app_detail.go │ │ ├── app_install.go │ │ ├── app_install_resource.go │ │ ├── app_tag.go │ │ ├── backup.go │ │ ├── base.go │ │ ├── clam.go │ │ ├── command.go │ │ ├── compose_template.go │ │ ├── cronjob.go │ │ ├── database.go │ │ ├── database_mysql.go │ │ ├── database_postgresql.go │ │ ├── favorite.go │ │ ├── firewall.go │ │ ├── ftp.go │ │ ├── group.go │ │ ├── host.go │ │ ├── image_repo.go │ │ ├── logs.go │ │ ├── mcp_server.go │ │ ├── monitor.go │ │ ├── php_extensions.go │ │ ├── runtime.go │ │ ├── setting.go │ │ ├── snapshot.go │ │ ├── tag.go │ │ ├── website.go │ │ ├── website_acme_account.go │ │ ├── website_ca.go │ │ ├── website_dns_account.go │ │ ├── website_domain.go │ │ └── website_ssl.go │ ├── repo │ │ ├── ai.go │ │ ├── app.go │ │ ├── app_detail.go │ │ ├── app_install.go │ │ ├── app_install_resource.go │ │ ├── app_tag.go │ │ ├── backup.go │ │ ├── clam.go │ │ ├── command.go │ │ ├── common.go │ │ ├── compose_template.go │ │ ├── cronjob.go │ │ ├── database.go │ │ ├── database_mysql.go │ │ ├── database_postgresql.go │ │ ├── favorite.go │ │ ├── ftp.go │ │ ├── group.go │ │ ├── host.go │ │ ├── image_repo.go │ │ ├── logs.go │ │ ├── mcp_server.go │ │ ├── php_extensions.go │ │ ├── runtime.go │ │ ├── setting.go │ │ ├── snapshot.go │ │ ├── tag.go │ │ ├── website.go │ │ ├── website_acme_account.go │ │ ├── website_ca.go │ │ ├── website_dns_account.go │ │ ├── website_domain.go │ │ └── website_ssl.go │ └── service │ │ ├── ai.go │ │ ├── app.go │ │ ├── app_install.go │ │ ├── app_utils.go │ │ ├── auth.go │ │ ├── backup.go │ │ ├── backup_app.go │ │ ├── backup_mysql.go │ │ ├── backup_postgresql.go │ │ ├── backup_redis.go │ │ ├── backup_runtime.go │ │ ├── backup_website.go │ │ ├── clam.go │ │ ├── command.go │ │ ├── compose_template.go │ │ ├── container.go │ │ ├── container_compose.go │ │ ├── container_network.go │ │ ├── container_volume.go │ │ ├── cronjob.go │ │ ├── cronjob_backup.go │ │ ├── cronjob_helper.go │ │ ├── dashboard.go │ │ ├── database.go │ │ ├── database_common.go │ │ ├── database_mysql.go │ │ ├── database_postgresql.go │ │ ├── database_redis.go │ │ ├── device.go │ │ ├── device_clean.go │ │ ├── docker.go │ │ ├── entry.go │ │ ├── fail2ban.go │ │ ├── favorite.go │ │ ├── file.go │ │ ├── firewall.go │ │ ├── ftp.go │ │ ├── group.go │ │ ├── helper.go │ │ ├── host.go │ │ ├── host_tool.go │ │ ├── image.go │ │ ├── image_repo.go │ │ ├── logs.go │ │ ├── mcp_server.go │ │ ├── monitor.go │ │ ├── nginx.go │ │ ├── nginx_utils.go │ │ ├── php_extensions.go │ │ ├── process.go │ │ ├── recycle_bin.go │ │ ├── runtime.go │ │ ├── runtime_utils.go │ │ ├── setting.go │ │ ├── snapshot.go │ │ ├── snapshot_create.go │ │ ├── snapshot_recover.go │ │ ├── ssh.go │ │ ├── upgrade.go │ │ ├── website.go │ │ ├── website_acme_account.go │ │ ├── website_ca.go │ │ ├── website_dns_account.go │ │ ├── website_ssl.go │ │ └── website_utils.go ├── buserr │ ├── errors.go │ └── multi_err.go ├── configs │ ├── config.go │ ├── log.go │ └── system.go ├── constant │ ├── alert.go │ ├── app.go │ ├── backup.go │ ├── common.go │ ├── container.go │ ├── dir.go │ ├── errs.go │ ├── host_tool.go │ ├── nginx.go │ ├── runtime.go │ ├── session.go │ ├── status.go │ └── website.go ├── cron │ ├── cron.go │ └── job │ │ ├── app.go │ │ ├── cache.go │ │ ├── ssl.go │ │ └── website.go ├── global │ └── global.go ├── i18n │ ├── i18n.go │ └── lang │ │ ├── en.yaml │ │ ├── ja.yaml │ │ ├── ko.yaml │ │ ├── ms.yml │ │ ├── pt-BR.yaml │ │ ├── ru.yaml │ │ ├── zh-Hant.yaml │ │ └── zh.yaml ├── init │ ├── app │ │ └── app.go │ ├── business │ │ └── business.go │ ├── cache │ │ ├── badger_db │ │ │ └── badger_db.go │ │ └── cache.go │ ├── db │ │ └── db.go │ ├── hook │ │ └── hook.go │ ├── lang │ │ └── lang.go │ ├── log │ │ └── log.go │ ├── migration │ │ ├── migrate.go │ │ └── migrations │ │ │ ├── init.go │ │ │ ├── v_1_10.go │ │ │ ├── v_1_7.go │ │ │ ├── v_1_8.go │ │ │ └── v_1_9.go │ ├── router │ │ └── router.go │ ├── session │ │ ├── psession │ │ │ └── psession.go │ │ └── session.go │ ├── validator │ │ └── validator.go │ └── viper │ │ └── viper.go ├── log │ ├── config.go │ ├── dup_write_darwin.go │ ├── dup_write_linux.go │ ├── dup_write_windows.go │ ├── manager.go │ └── writer.go ├── middleware │ ├── bind_domain.go │ ├── demo_handle.go │ ├── helper.go │ ├── ip_limit.go │ ├── jwt.go │ ├── loading.go │ ├── operation.go │ ├── password_expired.go │ ├── password_rsa.go │ └── session.go ├── router │ ├── common.go │ ├── entry.go │ ├── ro_ai.go │ ├── ro_app.go │ ├── ro_base.go │ ├── ro_container.go │ ├── ro_cronjob.go │ ├── ro_dashboard.go │ ├── ro_database.go │ ├── ro_file.go │ ├── ro_group.go │ ├── ro_host.go │ ├── ro_log.go │ ├── ro_mcp.go │ ├── ro_nginx.go │ ├── ro_process.go │ ├── ro_router.go │ ├── ro_runtime.go │ ├── ro_setting.go │ ├── ro_terminal.go │ ├── ro_toolbox.go │ ├── ro_website.go │ ├── ro_website_acme_account.go │ ├── ro_website_ca.go │ ├── ro_website_dns_account.go │ └── ro_website_ssl.go ├── server │ ├── init.go │ └── server.go └── utils │ ├── ai_tools │ ├── gpu │ │ ├── common │ │ │ └── gpu_info.go │ │ ├── gpu.go │ │ └── schema │ │ │ ├── parser.go │ │ │ └── types.go │ └── xpu │ │ ├── types.go │ │ ├── xpu.go │ │ └── xpu_info.go │ ├── captcha │ └── captcha.go │ ├── cloud_storage │ ├── client │ │ ├── cos.go │ │ ├── helper.go │ │ ├── kodo.go │ │ ├── local.go │ │ ├── minio.go │ │ ├── onedrive.go │ │ ├── oss.go │ │ ├── s3.go │ │ ├── sftp.go │ │ └── webdav.go │ └── cloud_storage_client.go │ ├── cmd │ └── cmd.go │ ├── common │ └── common.go │ ├── compose │ └── compose.go │ ├── copier │ └── copier.go │ ├── docker │ ├── compose.go │ └── docker.go │ ├── encrypt │ └── encrypt.go │ ├── env │ └── env.go │ ├── files │ ├── archiver.go │ ├── file_op.go │ ├── fileinfo.go │ ├── tar.go │ ├── tar_gz.go │ ├── utils.go │ └── zip.go │ ├── firewall │ ├── client.go │ └── client │ │ ├── firewalld.go │ │ ├── info.go │ │ ├── iptables.go │ │ └── ufw.go │ ├── geo │ └── geo.go │ ├── http │ ├── get.go │ └── request.go │ ├── ini_conf │ └── ini.go │ ├── jwt │ └── jwt.go │ ├── mfa │ └── mfa.go │ ├── mysql │ ├── client.go │ └── client │ │ ├── info.go │ │ ├── local.go │ │ └── remote.go │ ├── nginx │ ├── components │ │ ├── block.go │ │ ├── comment.go │ │ ├── config.go │ │ ├── directive.go │ │ ├── http.go │ │ ├── location.go │ │ ├── lua_block.go │ │ ├── server.go │ │ ├── server_listen.go │ │ ├── statement.go │ │ ├── upstream.go │ │ └── upstream_server.go │ ├── dumper.go │ └── parser │ │ ├── flag │ │ └── flag.go │ │ ├── lexer.go │ │ └── parser.go │ ├── ntp │ └── ntp.go │ ├── postgresql │ ├── client.go │ └── client │ │ ├── info.go │ │ ├── local.go │ │ └── remote.go │ ├── redis │ └── redis.go │ ├── ssh │ └── ssh.go │ ├── ssl │ ├── acme.go │ └── client.go │ ├── systemctl │ ├── configloade.go │ ├── handle.go │ ├── managers.go │ └── systemctl.go │ ├── terminal │ ├── local_cmd.go │ ├── ws_local_session.go │ └── ws_session.go │ ├── toolbox │ ├── fail2ban.go │ └── pure-ftpd.go │ ├── websocket │ ├── client.go │ └── process_data.go │ └── xpack │ └── xpack.go ├── ci └── script.sh ├── cmd └── server │ ├── app │ ├── app_config.go │ ├── app_config.yml │ ├── app_param.yml │ └── logo.png │ ├── cmd │ ├── app.go │ ├── listen-ip.go │ ├── reset.go │ ├── restore.go │ ├── root.go │ ├── update.go │ ├── user-info.go │ └── version.go │ ├── conf │ ├── app.yaml │ └── conf.go │ ├── docs │ ├── docs.go │ ├── swagger.go │ ├── swagger.json │ └── swagger.yaml │ ├── main.go │ ├── mcp │ ├── compose.yml │ └── mcp.go │ ├── nginx_conf │ ├── 404.html │ ├── cache.conf │ ├── domain404.html │ ├── gzip.conf │ ├── index.html │ ├── index.php │ ├── nginx_conf.go │ ├── proxy.conf │ ├── proxy_cache.conf │ ├── proxy_no_cache.conf │ ├── rewrite │ │ ├── crmeb.conf │ │ ├── dabr.conf │ │ ├── dbshop.conf │ │ ├── dedecms.conf │ │ ├── default.conf │ │ ├── discuz.conf │ │ ├── discuzx.conf │ │ ├── discuzx2.conf │ │ ├── discuzx3.conf │ │ ├── drupal.conf │ │ ├── ecshop.conf │ │ ├── edusoho.conf │ │ ├── emlog.conf │ │ ├── empirecms.conf │ │ ├── laravel5.conf │ │ ├── maccms.conf │ │ ├── mvc.conf │ │ ├── niushop.conf │ │ ├── phpcms.conf │ │ ├── phpwind.conf │ │ ├── sablog.conf │ │ ├── seacms.conf │ │ ├── shopex.conf │ │ ├── shopwind.conf │ │ ├── thinkphp.conf │ │ ├── typecho.conf │ │ ├── typecho2.conf │ │ ├── wordpress.conf │ │ ├── wp2.conf │ │ ├── yii2.conf │ │ └── zblog.conf │ ├── sse.conf │ ├── ssl.conf │ ├── stop.html │ └── website_default.conf │ ├── res │ ├── error_msg.go │ └── html │ │ ├── 200.html │ │ ├── 200_err_domain.html │ │ ├── 200_err_ip_limit.html │ │ ├── 400.html │ │ ├── 401.html │ │ ├── 403.html │ │ ├── 404.html │ │ ├── 408.html │ │ ├── 416.html │ │ └── 500.html │ └── web │ ├── favicon.png │ └── web.go ├── docs ├── README.ar.md ├── README.de.md ├── README.es.md ├── README.fr.md ├── README.id.md ├── README.ja.md ├── README.ko.md ├── README.ms.md ├── README.pt-br.md ├── README.ru.md ├── README.tr.md ├── README.zh-Hans.md └── README.zh-Hant.md ├── frontend ├── .editorconfig ├── .env ├── .env.development ├── .env.production ├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── .prettierignore ├── .prettierrc.js ├── .stylelintignore ├── .stylelintrc.js ├── index.html ├── lint-staged.config.js ├── package.json ├── postcss.config.js ├── public │ └── favicon.png ├── src │ ├── App.vue │ ├── api │ │ ├── config │ │ │ └── service-port.ts │ │ ├── helper │ │ │ ├── axios-cancel.ts │ │ │ └── check-status.ts │ │ ├── index.ts │ │ ├── interface │ │ │ ├── ai.ts │ │ │ ├── app.ts │ │ │ ├── auth.ts │ │ │ ├── backup.ts │ │ │ ├── command.ts │ │ │ ├── container.ts │ │ │ ├── cronjob.ts │ │ │ ├── dashboard.ts │ │ │ ├── database.ts │ │ │ ├── file.ts │ │ │ ├── group.ts │ │ │ ├── host-tool.ts │ │ │ ├── host.ts │ │ │ ├── index.ts │ │ │ ├── log.ts │ │ │ ├── nginx.ts │ │ │ ├── process.ts │ │ │ ├── runtime.ts │ │ │ ├── setting.ts │ │ │ ├── terminal.ts │ │ │ ├── toolbox.ts │ │ │ └── website.ts │ │ └── modules │ │ │ ├── ai.ts │ │ │ ├── app.ts │ │ │ ├── auth.ts │ │ │ ├── container.ts │ │ │ ├── cronjob.ts │ │ │ ├── dashboard.ts │ │ │ ├── database.ts │ │ │ ├── files.ts │ │ │ ├── group.ts │ │ │ ├── host-tool.ts │ │ │ ├── host.ts │ │ │ ├── log.ts │ │ │ ├── nginx.ts │ │ │ ├── process.ts │ │ │ ├── runtime.ts │ │ │ ├── setting.ts │ │ │ ├── toolbox.ts │ │ │ └── website.ts │ ├── assets │ │ ├── iconfont │ │ │ ├── iconfont.css │ │ │ ├── iconfont.js │ │ │ ├── iconfont.json │ │ │ ├── iconfont.svg │ │ │ ├── iconfont.ttf │ │ │ ├── iconfont.woff │ │ │ └── iconfont.woff2 │ │ ├── images │ │ │ ├── 1panel-login-bg.png │ │ │ ├── 1panel-login.png │ │ │ ├── 1panel-logo.svg │ │ │ ├── 1panel-menu-logo.svg │ │ │ ├── 2345explorer.png │ │ │ ├── 360se.png │ │ │ ├── 404.svg │ │ │ ├── android.png │ │ │ ├── chrome.png │ │ │ ├── cros.png │ │ │ ├── edge.png │ │ │ ├── enlarge_black.svg │ │ │ ├── enlarge_white.svg │ │ │ ├── error.svg │ │ │ ├── favicon-gold.png │ │ │ ├── favicon.png │ │ │ ├── favicon.svg │ │ │ ├── firefox.png │ │ │ ├── harmonyos.png │ │ │ ├── huaweibrowser.png │ │ │ ├── ie.png │ │ │ ├── ios.png │ │ │ ├── linux.png │ │ │ ├── logo.svg │ │ │ ├── mac.png │ │ │ ├── machine.png │ │ │ ├── menu-bg.png │ │ │ ├── menu-bg.svg │ │ │ ├── mobile.png │ │ │ ├── no_app.svg │ │ │ ├── no_update_app.svg │ │ │ ├── opera.png │ │ │ ├── pc.png │ │ │ ├── safari.png │ │ │ ├── spider.png │ │ │ ├── tencent.png │ │ │ ├── theworld.png │ │ │ ├── ucweb.png │ │ │ ├── unknown.png │ │ │ ├── unsafe.svg │ │ │ ├── wechat.png │ │ │ └── windows.png │ │ └── json │ │ │ ├── china-name.json │ │ │ ├── china.json │ │ │ ├── iso.json │ │ │ ├── world-name.json │ │ │ └── world.json │ ├── components │ │ ├── app-status │ │ │ └── index.vue │ │ ├── back-button │ │ │ └── index.vue │ │ ├── backup │ │ │ └── index.vue │ │ ├── bread-crumbs │ │ │ ├── bread-crumbs-item.vue │ │ │ └── index.vue │ │ ├── card-with-header │ │ │ └── index.vue │ │ ├── codemirror-dialog │ │ │ └── index.vue │ │ ├── complex-table │ │ │ └── index.vue │ │ ├── compose-log │ │ │ └── index.vue │ │ ├── config-card │ │ │ └── index.vue │ │ ├── confirm-dialog │ │ │ └── index.vue │ │ ├── container-log │ │ │ └── index.vue │ │ ├── copy-button │ │ │ └── index.vue │ │ ├── del-dialog │ │ │ └── index.vue │ │ ├── drawer-header │ │ │ └── index.vue │ │ ├── error-message │ │ │ ├── 404.vue │ │ │ └── error_code.vue │ │ ├── error-prompt │ │ │ └── index.vue │ │ ├── exist-file │ │ │ └── index.vue │ │ ├── file-list │ │ │ └── index.vue │ │ ├── file-role │ │ │ └── index.vue │ │ ├── group │ │ │ ├── change.vue │ │ │ └── index.vue │ │ ├── index.ts │ │ ├── layout-content │ │ │ ├── form-button.vue │ │ │ └── index.vue │ │ ├── license-import │ │ │ └── index.vue │ │ ├── log-dialog │ │ │ └── index.vue │ │ ├── log-file │ │ │ └── index.vue │ │ ├── msg-info │ │ │ └── index.vue │ │ ├── port-jump │ │ │ └── index.vue │ │ ├── router-button │ │ │ └── index.vue │ │ ├── status │ │ │ └── index.vue │ │ ├── svg-icon │ │ │ └── svg-icon.vue │ │ ├── system-upgrade │ │ │ └── index.vue │ │ ├── table-search │ │ │ └── index.vue │ │ ├── table-setting │ │ │ └── index.vue │ │ ├── terminal │ │ │ └── index.vue │ │ ├── tooltip │ │ │ └── index.vue │ │ ├── upload │ │ │ └── index.vue │ │ ├── v-charts │ │ │ ├── components │ │ │ │ ├── Line.vue │ │ │ │ └── Pie.vue │ │ │ └── index.vue │ │ └── vscode-open │ │ │ └── index.vue │ ├── config │ │ ├── config.ts │ │ ├── nprogress.ts │ │ ├── pinia-persist.ts │ │ └── service-loading.ts │ ├── enums │ │ ├── app.ts │ │ ├── files.ts │ │ └── http-enum.ts │ ├── env.d.ts │ ├── global │ │ ├── business.ts │ │ ├── form-rules.ts │ │ └── mimetype.ts │ ├── hooks │ │ ├── interface │ │ │ └── index.ts │ │ ├── use-delete-data.ts │ │ ├── use-logo.ts │ │ └── use-theme.ts │ ├── lang │ │ ├── index.ts │ │ └── modules │ │ │ ├── en.ts │ │ │ ├── ja.ts │ │ │ ├── ko.ts │ │ │ ├── ms.ts │ │ │ ├── pt-br.ts │ │ │ ├── ru.ts │ │ │ ├── tw.ts │ │ │ └── zh.ts │ ├── layout │ │ ├── components │ │ │ ├── AppFooter.vue │ │ │ ├── AppMain.vue │ │ │ ├── MobileHeader.vue │ │ │ ├── Sidebar │ │ │ │ ├── components │ │ │ │ │ ├── Collapse.vue │ │ │ │ │ ├── Logo.vue │ │ │ │ │ └── SubItem.vue │ │ │ │ ├── index.scss │ │ │ │ └── index.vue │ │ │ ├── Tabs │ │ │ │ ├── components │ │ │ │ │ └── TabItem.vue │ │ │ │ └── index.vue │ │ │ └── index.ts │ │ ├── hooks │ │ │ └── useResize.ts │ │ └── index.vue │ ├── main.ts │ ├── routers │ │ ├── cache-router.ts │ │ ├── constant.ts │ │ ├── index.ts │ │ ├── modules │ │ │ ├── ai.ts │ │ │ ├── app-store.ts │ │ │ ├── container.ts │ │ │ ├── cronjob.ts │ │ │ ├── database.ts │ │ │ ├── error.ts │ │ │ ├── host.ts │ │ │ ├── log.ts │ │ │ ├── setting.ts │ │ │ ├── toolbox.ts │ │ │ └── website.ts │ │ └── router.ts │ ├── shims-vue.d.ts │ ├── store │ │ ├── index.ts │ │ ├── interface │ │ │ └── index.ts │ │ └── modules │ │ │ ├── global.ts │ │ │ ├── menu.ts │ │ │ └── tabs.ts │ ├── styles │ │ ├── common.scss │ │ ├── element-dark.scss │ │ ├── element.scss │ │ ├── index.scss │ │ ├── mixins.scss │ │ ├── moblie.scss │ │ ├── reset.scss │ │ ├── style.css │ │ └── var.scss │ ├── typings │ │ ├── global.d.ts │ │ ├── plugins.d.ts │ │ └── window.d.ts │ ├── utils │ │ ├── bus.ts │ │ ├── docker.ts │ │ ├── get-env.ts │ │ ├── is │ │ │ └── index.ts │ │ ├── message.ts │ │ ├── shortcuts.ts │ │ ├── svg.ts │ │ ├── theme.ts │ │ ├── util.ts │ │ └── xpack.ts │ └── views │ │ ├── ai │ │ ├── gpu │ │ │ └── index.vue │ │ ├── mcp │ │ │ ├── index.vue │ │ │ └── server │ │ │ │ ├── bind │ │ │ │ └── index.vue │ │ │ │ ├── config │ │ │ │ └── index.vue │ │ │ │ ├── import │ │ │ │ └── index.vue │ │ │ │ ├── index.vue │ │ │ │ ├── operate │ │ │ │ └── index.vue │ │ │ │ └── volume │ │ │ │ └── index.vue │ │ └── model │ │ │ ├── add │ │ │ └── index.vue │ │ │ ├── conn │ │ │ └── index.vue │ │ │ ├── del │ │ │ └── index.vue │ │ │ ├── domain │ │ │ └── index.vue │ │ │ ├── index.vue │ │ │ └── terminal │ │ │ └── index.vue │ │ ├── app-store │ │ ├── apps │ │ │ └── index.vue │ │ ├── bus.ts │ │ ├── detail │ │ │ ├── index.vue │ │ │ ├── install │ │ │ │ └── index.vue │ │ │ └── params │ │ │ │ └── index.vue │ │ ├── index.scss │ │ ├── index.vue │ │ └── installed │ │ │ ├── check │ │ │ └── index.vue │ │ │ ├── delete │ │ │ └── index.vue │ │ │ ├── detail │ │ │ └── index.vue │ │ │ ├── ignore │ │ │ └── index.vue │ │ │ ├── index.vue │ │ │ └── upgrade │ │ │ ├── diff │ │ │ └── index.vue │ │ │ └── index.vue │ │ ├── container │ │ ├── compose │ │ │ ├── create │ │ │ │ └── index.vue │ │ │ ├── delete │ │ │ │ └── index.vue │ │ │ ├── detail │ │ │ │ └── index.vue │ │ │ ├── edit │ │ │ │ └── index.vue │ │ │ └── index.vue │ │ ├── container │ │ │ ├── commit │ │ │ │ └── index.vue │ │ │ ├── index.vue │ │ │ ├── log │ │ │ │ └── index.vue │ │ │ ├── monitor │ │ │ │ └── index.vue │ │ │ ├── operate │ │ │ │ └── index.vue │ │ │ ├── prune │ │ │ │ └── index.vue │ │ │ ├── rename │ │ │ │ └── index.vue │ │ │ ├── terminal │ │ │ │ └── index.vue │ │ │ └── upgrade │ │ │ │ └── index.vue │ │ ├── image │ │ │ ├── build │ │ │ │ └── index.vue │ │ │ ├── delete │ │ │ │ └── index.vue │ │ │ ├── index.vue │ │ │ ├── load │ │ │ │ └── index.vue │ │ │ ├── prune │ │ │ │ └── index.vue │ │ │ ├── pull │ │ │ │ └── index.vue │ │ │ ├── push │ │ │ │ └── index.vue │ │ │ ├── save │ │ │ │ └── index.vue │ │ │ └── tag │ │ │ │ └── index.vue │ │ ├── index.vue │ │ ├── network │ │ │ ├── create │ │ │ │ └── index.vue │ │ │ └── index.vue │ │ ├── repo │ │ │ ├── index.vue │ │ │ └── operator │ │ │ │ └── index.vue │ │ ├── setting │ │ │ ├── index.vue │ │ │ ├── ipv6 │ │ │ │ └── index.vue │ │ │ ├── log │ │ │ │ └── index.vue │ │ │ ├── mirror │ │ │ │ └── index.vue │ │ │ ├── registry │ │ │ │ └── index.vue │ │ │ └── sock-path │ │ │ │ └── index.vue │ │ ├── template │ │ │ ├── detail │ │ │ │ └── index.vue │ │ │ ├── index.vue │ │ │ └── operator │ │ │ │ └── index.vue │ │ └── volume │ │ │ ├── create │ │ │ └── index.vue │ │ │ └── index.vue │ │ ├── cronjob │ │ ├── backup │ │ │ └── index.vue │ │ ├── helper.ts │ │ ├── index.vue │ │ ├── operate │ │ │ └── index.vue │ │ └── record │ │ │ └── index.vue │ │ ├── database │ │ ├── index.vue │ │ ├── mysql │ │ │ ├── bind │ │ │ │ └── index.vue │ │ │ ├── check │ │ │ │ └── index.vue │ │ │ ├── conn │ │ │ │ └── index.vue │ │ │ ├── create │ │ │ │ └── index.vue │ │ │ ├── delete │ │ │ │ └── index.vue │ │ │ ├── index.vue │ │ │ ├── password │ │ │ │ └── index.vue │ │ │ ├── remote │ │ │ │ ├── delete │ │ │ │ │ └── index.vue │ │ │ │ ├── index.vue │ │ │ │ └── operate │ │ │ │ │ └── index.vue │ │ │ └── setting │ │ │ │ ├── helper.ts │ │ │ │ ├── index.vue │ │ │ │ ├── slow-log │ │ │ │ └── index.vue │ │ │ │ ├── status │ │ │ │ └── index.vue │ │ │ │ └── variables │ │ │ │ └── index.vue │ │ ├── postgresql │ │ │ ├── bind │ │ │ │ └── index.vue │ │ │ ├── check │ │ │ │ └── index.vue │ │ │ ├── conn │ │ │ │ └── index.vue │ │ │ ├── create │ │ │ │ └── index.vue │ │ │ ├── delete │ │ │ │ └── index.vue │ │ │ ├── index.vue │ │ │ ├── password │ │ │ │ └── index.vue │ │ │ ├── privileges │ │ │ │ └── index.vue │ │ │ ├── remote │ │ │ │ ├── delete │ │ │ │ │ └── index.vue │ │ │ │ ├── index.vue │ │ │ │ └── operate │ │ │ │ │ └── index.vue │ │ │ └── setting │ │ │ │ └── index.vue │ │ └── redis │ │ │ ├── check │ │ │ └── index.vue │ │ │ ├── command │ │ │ └── index.vue │ │ │ ├── conn │ │ │ └── index.vue │ │ │ ├── index.vue │ │ │ ├── remote │ │ │ ├── delete │ │ │ │ └── index.vue │ │ │ ├── index.vue │ │ │ └── operate │ │ │ │ └── index.vue │ │ │ └── setting │ │ │ ├── index.vue │ │ │ ├── persistence │ │ │ └── index.vue │ │ │ └── status │ │ │ └── index.vue │ │ ├── home │ │ ├── app │ │ │ └── index.vue │ │ ├── index.vue │ │ └── status │ │ │ └── index.vue │ │ ├── host │ │ ├── file-management │ │ │ ├── batch-role │ │ │ │ └── index.vue │ │ │ ├── change-role │ │ │ │ └── index.vue │ │ │ ├── chown │ │ │ │ └── index.vue │ │ │ ├── code-editor │ │ │ │ └── index.vue │ │ │ ├── compress │ │ │ │ └── index.vue │ │ │ ├── create │ │ │ │ └── index.vue │ │ │ ├── decompress │ │ │ │ └── index.vue │ │ │ ├── delete │ │ │ │ └── index.vue │ │ │ ├── detail │ │ │ │ └── index.vue │ │ │ ├── download │ │ │ │ └── index.vue │ │ │ ├── favorite │ │ │ │ └── index.vue │ │ │ ├── hooks │ │ │ │ └── searchable.ts │ │ │ ├── index.vue │ │ │ ├── move │ │ │ │ └── index.vue │ │ │ ├── preview │ │ │ │ └── index.vue │ │ │ ├── process │ │ │ │ └── index.vue │ │ │ ├── recycle-bin │ │ │ │ ├── delete │ │ │ │ │ └── index.vue │ │ │ │ ├── index.vue │ │ │ │ └── reduce │ │ │ │ │ └── index.vue │ │ │ ├── rename │ │ │ │ └── index.vue │ │ │ ├── upload │ │ │ │ └── index.vue │ │ │ └── wget │ │ │ │ └── index.vue │ │ ├── firewall │ │ │ ├── forward │ │ │ │ ├── index.vue │ │ │ │ └── operate │ │ │ │ │ └── index.vue │ │ │ ├── index.vue │ │ │ ├── ip │ │ │ │ ├── index.vue │ │ │ │ └── operate │ │ │ │ │ └── index.vue │ │ │ ├── port │ │ │ │ ├── index.vue │ │ │ │ └── operate │ │ │ │ │ └── index.vue │ │ │ └── status │ │ │ │ └── index.vue │ │ ├── monitor │ │ │ ├── index.vue │ │ │ ├── monitor │ │ │ │ └── index.vue │ │ │ └── setting │ │ │ │ ├── days │ │ │ │ └── index.vue │ │ │ │ ├── index.vue │ │ │ │ └── interval │ │ │ │ └── index.vue │ │ ├── process │ │ │ ├── index.vue │ │ │ ├── network │ │ │ │ └── index.vue │ │ │ └── process │ │ │ │ ├── detail │ │ │ │ └── index.vue │ │ │ │ └── index.vue │ │ ├── ssh │ │ │ ├── index.vue │ │ │ ├── log │ │ │ │ ├── index.vue │ │ │ │ └── log.vue │ │ │ ├── session │ │ │ │ └── index.vue │ │ │ └── ssh │ │ │ │ ├── address │ │ │ │ └── index.vue │ │ │ │ ├── index.vue │ │ │ │ ├── port │ │ │ │ └── index.vue │ │ │ │ ├── pubkey │ │ │ │ └── index.vue │ │ │ │ └── root │ │ │ │ └── index.vue │ │ └── terminal │ │ │ ├── command │ │ │ └── index.vue │ │ │ ├── host │ │ │ ├── change-group │ │ │ │ └── index.vue │ │ │ ├── index.vue │ │ │ └── operate │ │ │ │ └── index.vue │ │ │ ├── index.vue │ │ │ └── terminal │ │ │ ├── host-create.vue │ │ │ └── index.vue │ │ ├── log │ │ ├── index.vue │ │ ├── login │ │ │ └── index.vue │ │ ├── operation │ │ │ └── index.vue │ │ ├── system │ │ │ └── index.vue │ │ └── website │ │ │ └── index.vue │ │ ├── login │ │ ├── components │ │ │ └── login-form.vue │ │ ├── entrance │ │ │ └── index.vue │ │ └── index.vue │ │ ├── setting │ │ ├── about │ │ │ └── index.vue │ │ ├── backup-account │ │ │ ├── cos │ │ │ │ └── index.vue │ │ │ ├── index.vue │ │ │ ├── kodo │ │ │ │ └── index.vue │ │ │ ├── local │ │ │ │ └── index.vue │ │ │ ├── minio │ │ │ │ └── index.vue │ │ │ ├── onedrive │ │ │ │ └── index.vue │ │ │ ├── oss │ │ │ │ └── index.vue │ │ │ ├── s3 │ │ │ │ └── index.vue │ │ │ ├── sftp │ │ │ │ └── index.vue │ │ │ └── webdav │ │ │ │ └── index.vue │ │ ├── expired.vue │ │ ├── index.vue │ │ ├── license │ │ │ └── index.vue │ │ ├── panel │ │ │ ├── api-interface │ │ │ │ └── index.vue │ │ │ ├── default-network │ │ │ │ └── index.vue │ │ │ ├── hidemenu │ │ │ │ └── index.vue │ │ │ ├── index.vue │ │ │ ├── name │ │ │ │ └── index.vue │ │ │ ├── password │ │ │ │ └── index.vue │ │ │ ├── proxy │ │ │ │ └── index.vue │ │ │ ├── systemip │ │ │ │ └── index.vue │ │ │ ├── theme-color │ │ │ │ └── index.vue │ │ │ ├── timeout │ │ │ │ └── index.vue │ │ │ └── username │ │ │ │ └── index.vue │ │ ├── safe │ │ │ ├── allowips │ │ │ │ └── index.vue │ │ │ ├── bind │ │ │ │ └── index.vue │ │ │ ├── domain │ │ │ │ └── index.vue │ │ │ ├── entrance │ │ │ │ └── index.vue │ │ │ ├── index.vue │ │ │ ├── mfa │ │ │ │ └── index.vue │ │ │ ├── port │ │ │ │ └── index.vue │ │ │ ├── response │ │ │ │ └── index.vue │ │ │ ├── ssl │ │ │ │ └── index.vue │ │ │ └── timeout │ │ │ │ └── index.vue │ │ └── snapshot │ │ │ ├── ignore-rule │ │ │ └── index.vue │ │ │ ├── import │ │ │ └── index.vue │ │ │ ├── index.vue │ │ │ ├── recover │ │ │ └── index.vue │ │ │ ├── snap_status │ │ │ └── index.vue │ │ │ └── status │ │ │ └── index.vue │ │ ├── toolbox │ │ ├── clam │ │ │ ├── index.vue │ │ │ ├── operate │ │ │ │ └── index.vue │ │ │ ├── record │ │ │ │ └── index.vue │ │ │ ├── setting │ │ │ │ └── index.vue │ │ │ └── status │ │ │ │ └── index.vue │ │ ├── clean │ │ │ └── index.vue │ │ ├── device │ │ │ ├── dns │ │ │ │ └── index.vue │ │ │ ├── hostname │ │ │ │ └── index.vue │ │ │ ├── hosts │ │ │ │ └── index.vue │ │ │ ├── index.vue │ │ │ ├── ntp │ │ │ │ └── index.vue │ │ │ ├── passwd │ │ │ │ └── index.vue │ │ │ ├── swap │ │ │ │ └── index.vue │ │ │ └── time-zone │ │ │ │ └── index.vue │ │ ├── fail2ban │ │ │ ├── ban-action │ │ │ │ └── index.vue │ │ │ ├── ban-time │ │ │ │ └── index.vue │ │ │ ├── find-time │ │ │ │ └── index.vue │ │ │ ├── index.vue │ │ │ ├── ips │ │ │ │ └── index.vue │ │ │ ├── log-path │ │ │ │ └── index.vue │ │ │ ├── max-retry │ │ │ │ └── index.vue │ │ │ └── port │ │ │ │ └── index.vue │ │ ├── ftp │ │ │ ├── index.vue │ │ │ ├── log │ │ │ │ └── index.vue │ │ │ └── operate │ │ │ │ └── index.vue │ │ ├── index.vue │ │ └── supervisor │ │ │ ├── config │ │ │ ├── basic │ │ │ │ └── index.vue │ │ │ ├── index.vue │ │ │ ├── log │ │ │ │ └── index.vue │ │ │ └── source │ │ │ │ └── index.vue │ │ │ ├── create │ │ │ └── index.vue │ │ │ ├── file │ │ │ └── index.vue │ │ │ ├── index.vue │ │ │ └── status │ │ │ ├── index.vue │ │ │ └── init │ │ │ └── index.vue │ │ └── website │ │ ├── runtime │ │ ├── delete │ │ │ └── index.vue │ │ ├── dotnet │ │ │ ├── index.vue │ │ │ └── operate │ │ │ │ └── index.vue │ │ ├── go │ │ │ ├── index.vue │ │ │ └── operate │ │ │ │ └── index.vue │ │ ├── index.vue │ │ ├── java │ │ │ ├── index.vue │ │ │ └── operate │ │ │ │ └── index.vue │ │ ├── node │ │ │ ├── index.vue │ │ │ ├── module │ │ │ │ └── index.vue │ │ │ └── operate │ │ │ │ └── index.vue │ │ ├── php │ │ │ ├── check │ │ │ │ └── index.vue │ │ │ ├── create │ │ │ │ └── index.vue │ │ │ ├── edit │ │ │ │ └── index.vue │ │ │ ├── extensions │ │ │ │ ├── index.vue │ │ │ │ └── operate │ │ │ │ │ └── index.vue │ │ │ ├── index.vue │ │ │ └── param │ │ │ │ └── index.vue │ │ └── python │ │ │ ├── index.vue │ │ │ └── operate │ │ │ └── index.vue │ │ ├── ssl │ │ ├── acme-account │ │ │ ├── create │ │ │ │ └── index.vue │ │ │ └── index.vue │ │ ├── apply │ │ │ └── index.vue │ │ ├── ca │ │ │ ├── create │ │ │ │ └── index.vue │ │ │ ├── detail │ │ │ │ └── index.vue │ │ │ ├── index.vue │ │ │ └── obtain │ │ │ │ └── index.vue │ │ ├── create │ │ │ └── index.vue │ │ ├── detail │ │ │ └── index.vue │ │ ├── dns-account │ │ │ ├── create │ │ │ │ └── index.vue │ │ │ └── index.vue │ │ ├── index.vue │ │ ├── obtain │ │ │ └── index.vue │ │ └── upload │ │ │ └── index.vue │ │ └── website │ │ ├── check │ │ └── index.vue │ │ ├── config │ │ ├── basic │ │ │ ├── anti-Leech │ │ │ │ └── index.vue │ │ │ ├── auth-basic │ │ │ │ ├── create │ │ │ │ │ └── index.vue │ │ │ │ └── index.vue │ │ │ ├── default-doc │ │ │ │ └── index.vue │ │ │ ├── domain │ │ │ │ ├── create │ │ │ │ │ └── index.vue │ │ │ │ └── index.vue │ │ │ ├── https │ │ │ │ └── index.vue │ │ │ ├── index.vue │ │ │ ├── limit-conn │ │ │ │ └── index.vue │ │ │ ├── other │ │ │ │ └── index.vue │ │ │ ├── proxy │ │ │ │ ├── create │ │ │ │ │ └── index.vue │ │ │ │ ├── file │ │ │ │ │ └── index.vue │ │ │ │ └── index.vue │ │ │ ├── redirect │ │ │ │ ├── create │ │ │ │ │ └── index.vue │ │ │ │ ├── file │ │ │ │ │ └── index.vue │ │ │ │ └── index.vue │ │ │ ├── rewrite │ │ │ │ └── index.vue │ │ │ └── site-folder │ │ │ │ └── index.vue │ │ ├── index.vue │ │ ├── log │ │ │ ├── index.vue │ │ │ └── log-fiile │ │ │ │ └── index.vue │ │ ├── php │ │ │ ├── config │ │ │ │ └── index.vue │ │ │ ├── function │ │ │ │ └── index.vue │ │ │ ├── index.vue │ │ │ ├── upload │ │ │ │ └── index.vue │ │ │ └── version │ │ │ │ └── index.vue │ │ └── resource │ │ │ ├── index.vue │ │ │ ├── nginx │ │ │ └── index.vue │ │ │ └── php-fpm │ │ │ └── index.vue │ │ ├── create │ │ └── index.vue │ │ ├── default │ │ └── index.vue │ │ ├── delete │ │ └── index.vue │ │ ├── html │ │ └── index.vue │ │ ├── index.vue │ │ ├── nginx │ │ ├── index.vue │ │ ├── performance │ │ │ └── index.vue │ │ ├── source │ │ │ └── index.vue │ │ └── status │ │ │ └── index.vue │ │ └── status │ │ └── index.vue ├── tailwind.config.js ├── tsconfig.json ├── vite-env.d.ts └── vite.config.ts ├── go.mod ├── go.sum └── sonar-project.properties /.gitattributes: -------------------------------------------------------------------------------- 1 | *.ts linguist-language=Go 2 | *.js linguist-language=Go 3 | *.css linguist-language=Go 4 | *.scss linguist-language=Go 5 | *.html linguist-language=Go 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/2_feature_request.yml: -------------------------------------------------------------------------------- 1 | name: 'Feature Request' 2 | description: 'Suggest an idea' 3 | title: '[Feature] ' 4 | assignees: wanghe-fit2cloud 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: "## Environment Information" 9 | - type: input 10 | validations: 11 | required: true 12 | attributes: 13 | label: "1Panel Version" 14 | description: "Log in to the 1Panel Web console and check the current version at the bottom right of the page." 15 | - type: markdown 16 | attributes: 17 | value: "## Detailed information" 18 | - type: textarea 19 | attributes: 20 | label: "Please describe your needs or suggestions for improvements" 21 | validations: 22 | required: true 23 | - type: textarea 24 | attributes: 25 | label: "Please describe the solution you suggest" 26 | - type: textarea 27 | attributes: 28 | label: "Additional Information" 29 | description: "If you have any additional information to provide, you can include it here (screenshots, videos, etc., are welcome)." -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Questions & Discussions 4 | url: https://github.com/1Panel-dev/1Panel/discussions 5 | about: Raise questions about the installation, deployment, use and other aspects of the project. 6 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | #### What this PR does / why we need it? 2 | 3 | #### Summary of your change 4 | 5 | #### Please indicate you've done the following: 6 | 7 | - [ ] Made sure tests are passing and test coverage is added if needed. 8 | - [ ] Made sure commit message follow the rule of [Conventional Commits specification](https://www.conventionalcommits.org/). 9 | - [ ] Considered the docs impact and opened a new docs issue or PR with docs changes if needed. -------------------------------------------------------------------------------- /.github/workflows/add-labels-for-pr.yml: -------------------------------------------------------------------------------- 1 | name: General PR Handling for 1Panel 2 | on: pull_request 3 | permissions: 4 | pull-requests: write 5 | jobs: 6 | generic_handler: 7 | name: Add Labels to PR 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v3 11 | - uses: actions-ecosystem/action-add-labels@v1 12 | with: 13 | github_token: ${{ secrets.GITHUBTOKEN }} 14 | labels: ${{ github.base_ref }} 15 | -------------------------------------------------------------------------------- /.github/workflows/issue-translator.yml: -------------------------------------------------------------------------------- 1 | name: Issue Translator 2 | on: 3 | issue_comment: 4 | types: [created] 5 | issues: 6 | types: [opened] 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: usthe/issues-translate-action@v2.7 12 | with: 13 | IS_MODIFY_TITLE: true 14 | BOT_GITHUB_TOKEN: ${{ secrets.ISSUE_TRANSLATOR_TOKEN }} 15 | -------------------------------------------------------------------------------- /.github/workflows/llm-code-review.yml: -------------------------------------------------------------------------------- 1 | name: LLM Code Review 2 | permissions: 3 | contents: read 4 | pull-requests: write 5 | on: 6 | pull_request: 7 | types: [opened, reopened, synchronize] 8 | jobs: 9 | llm-code-review: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: fit2cloud/LLM-CodeReview-Action@main 13 | env: 14 | GITHUB_TOKEN: ${{ secrets.FIT2CLOUDRD_LLM_CODE_REVIEW_TOKEN }} 15 | OPENAI_API_KEY: ${{ secrets.ALIYUN_LLM_API_KEY }} 16 | LANGUAGE: English 17 | OPENAI_API_ENDPOINT: https://dashscope.aliyuncs.com/compatible-mode/v1 18 | MODEL: qwen2.5-coder-3b-instruct 19 | PROMPT: "Please check the following code differences for any irregularities, potential issues, or optimization suggestions, and provide your answers in English." 20 | top_p: 1 21 | temperature: 1 22 | # max_tokens: 10000 23 | MAX_PATCH_LENGTH: 10000 24 | IGNORE_PATTERNS: "/node_modules,*.md,/dist,/.github" 25 | FILE_PATTERNS: "*.java,*.go,*.py,*.vue,*.ts,*.js,*.css,*.scss,*.html" 26 | -------------------------------------------------------------------------------- /.github/workflows/sonarcloud-scan.yml: -------------------------------------------------------------------------------- 1 | name: SonarCloud Scan 2 | on: 3 | push: 4 | branches: 5 | - dev 6 | pull_request: 7 | types: [opened, synchronize, reopened] 8 | jobs: 9 | sonarcloud: 10 | name: SonarCloud 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v3 14 | with: 15 | fetch-depth: 0 16 | - name: SonarCloud Scan 17 | uses: SonarSource/sonarcloud-github-action@master 18 | env: 19 | GITHUB_TOKEN: ${{ secrets.GITHUBTOKEN }} 20 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} 21 | -------------------------------------------------------------------------------- /.github/workflows/sync2gitee.yml: -------------------------------------------------------------------------------- 1 | name: Synchronize to Gitee 2 | on: [push] 3 | jobs: 4 | repo-sync: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - name: Mirror the Github organization repos to Gitee. 8 | uses: Yikun/hub-mirror-action@master 9 | with: 10 | src: 'github/1Panel-dev' 11 | dst: 'gitee/fit2cloud-feizhiyun' 12 | dst_key: ${{ secrets.GITEE_PRIVATE_KEY }} 13 | dst_token: ${{ secrets.GITEE_TOKEN }} 14 | static_list: "1Panel" 15 | force_update: true 16 | -------------------------------------------------------------------------------- /.github/workflows/tyops-check.yml: -------------------------------------------------------------------------------- 1 | name: Typos Check 2 | on: pull_request 3 | jobs: 4 | run: 5 | name: Spell Check with Typos 6 | runs-on: ubuntu-latest 7 | steps: 8 | - name: Checkout Actions Repository 9 | uses: actions/checkout@v2 10 | - name: Check spelling 11 | uses: crate-ci/typos@master 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | build/1panel 8 | 9 | # Mac 10 | .DS_Store 11 | */.DS_Store 12 | 13 | # VS Code 14 | .vscode 15 | *.project 16 | *.factorypath 17 | 18 | # IntelliJ IDEA 19 | .idea/* 20 | !.idea/icon.png 21 | *.iws 22 | *.iml 23 | *.ipr 24 | 25 | # Test binary, built with `go test -c` 26 | *.test 27 | 28 | # Output of the go coverage tool, specifically when used with LiteIDE 29 | *.out 30 | 31 | # Dependency directories 32 | /pkg/ 33 | backend/__debug_bin 34 | cmd/server/__debug_bin 35 | cmd/server/web/assets 36 | cmd/server/web/monacoeditorwork 37 | cmd/server/web/index.html 38 | frontend/auto-imports.d.ts 39 | frontend/components.d.ts 40 | frontend/src/xpack 41 | backend/xpack 42 | *_xpack.go 43 | .history/ 44 | dist/ 45 | 1pctl 46 | 1panel.service 47 | install.sh 48 | quick_start.sh 49 | cmd/server/fileList.txt 50 | .fileList.txt 51 | 1Panel.code-workspace 52 | -------------------------------------------------------------------------------- /.goreleaser.yaml: -------------------------------------------------------------------------------- 1 | # yaml-language-server: $schema=https://goreleaser.com/static/schema.json 2 | # vim: set ts=2 sw=2 tw=0 fo=jcroql 3 | version: 2 4 | 5 | before: 6 | hooks: 7 | # - export NODE_OPTIONS="--max-old-space-size=8192" 8 | # - make build_web 9 | - chmod +x ./ci/script.sh 10 | - ./ci/script.sh 11 | - sed -i 's@ORIGINAL_VERSION=.*@ORIGINAL_VERSION=v{{ .Version }}@g' 1pctl 12 | - go mod tidy 13 | 14 | builds: 15 | - main: ./cmd/server/main.go 16 | binary: 1panel 17 | flags: 18 | - -tags=xpack 19 | - -trimpath 20 | ldflags: 21 | - -w -s 22 | env: 23 | - CGO_ENABLED=0 24 | goos: 25 | - linux 26 | goarm: 27 | - 7 28 | goarch: 29 | - amd64 30 | - arm64 31 | - arm 32 | - ppc64le 33 | - s390x 34 | - riscv64 35 | 36 | archives: 37 | - formats: [ 'tar.gz' ] 38 | name_template: "1panel-v{{ .Version }}-{{ .Os }}-{{ .Arch }}{{- if .Arm }}v{{ .Arm }}{{ end }}" 39 | wrap_in_directory: true 40 | files: 41 | - 1pctl 42 | - install.sh 43 | - initscript/* 44 | - lang/* 45 | - GeoIP.mmdb 46 | 47 | checksum: 48 | name_template: 'checksums.txt' 49 | 50 | changelog: 51 | sort: asc 52 | filters: 53 | exclude: 54 | - "^docs:" 55 | - "^test:" 56 | -------------------------------------------------------------------------------- /.idea/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1Panel-dev/1Panel/6ae150b64ec4ef5026a14f0ec79f7014e414d2ff/.idea/icon.png -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | GOCMD=go 2 | GOBUILD=$(GOCMD) build 3 | GOCLEAN=$(GOCMD) clean 4 | GOARCH=$(shell go env GOARCH) 5 | GOOS=$(shell go env GOOS) 6 | 7 | BASE_PATH := $(shell pwd) 8 | BUILD_PATH = $(BASE_PATH)/build 9 | WEB_PATH=$(BASE_PATH)/frontend 10 | SERVER_PATH=$(BASE_PATH)/backend 11 | MAIN= $(BASE_PATH)/cmd/server/main.go 12 | APP_NAME=1panel 13 | ASSERT_PATH= $(BASE_PATH)/cmd/server/web/assets 14 | 15 | clean_assets: 16 | rm -rf $(ASSERT_PATH) 17 | 18 | upx_bin: 19 | upx $(BUILD_PATH)/$(APP_NAME) 20 | 21 | build_frontend: 22 | cd $(WEB_PATH) && npm install && npm run build:pro 23 | 24 | build_backend_on_linux: 25 | cd $(SERVER_PATH) \ 26 | && CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(APP_NAME) $(MAIN) 27 | 28 | build_backend_on_darwin: 29 | cd $(SERVER_PATH) \ 30 | && GOOS=linux GOARCH=amd64 $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(APP_NAME) $(MAIN) 31 | 32 | build_all: build_frontend build_backend_on_linux 33 | 34 | build_on_local: clean_assets build_frontend build_backend_on_darwin upx_bin 35 | -------------------------------------------------------------------------------- /OWNERS: -------------------------------------------------------------------------------- 1 | reviewers: 2 | - wanghe-fit2cloud 3 | - zhengkunwang223 4 | - ssongliu 5 | 6 | approvers: 7 | - wanghe-fit2cloud 8 | - zhengkunwang223 9 | - ssongliu 10 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security policy 2 | 3 | ## Supported versions 4 | 5 | | Version | Supported | 6 | | ------- | ------------------ | 7 | | v1.x | :white_check_mark: | 8 | 9 | ## Reporting a vulnerability 10 | 11 | We first appreciate and are very thankful that you've found a vulnerability issue in 1Panel! By disclosing such issue to 1Panel development team you are helping 1Panel to become a much more safer project than before! ;) 12 | 13 | To protect the existing users of 1Panel, we kindly ask you to not disclose the vulnerability to anyone except the 1Panel development team before a fix has been rolled out. Send an email to `wanghe@fit2cloud.com` instead. 14 | -------------------------------------------------------------------------------- /backend/app/api/v1/process.go: -------------------------------------------------------------------------------- 1 | package v1 2 | 3 | import ( 4 | "github.com/1Panel-dev/1Panel/backend/app/api/v1/helper" 5 | "github.com/1Panel-dev/1Panel/backend/app/dto/request" 6 | "github.com/1Panel-dev/1Panel/backend/constant" 7 | websocket2 "github.com/1Panel-dev/1Panel/backend/utils/websocket" 8 | "github.com/gin-gonic/gin" 9 | ) 10 | 11 | func (b *BaseApi) ProcessWs(c *gin.Context) { 12 | ws, err := wsUpgrade.Upgrade(c.Writer, c.Request, nil) 13 | if err != nil { 14 | return 15 | } 16 | wsClient := websocket2.NewWsClient("processClient", ws) 17 | go wsClient.Read() 18 | go wsClient.Write() 19 | } 20 | 21 | // @Tags Process 22 | // @Summary Stop Process 23 | // @Param request body request.ProcessReq true "request" 24 | // @Success 200 25 | // @Security ApiKeyAuth 26 | // @Security Timestamp 27 | // @Router /process/stop [post] 28 | // @x-panel-log {"bodyKeys":["PID"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"结束进程 [PID]","formatEN":"结束进程 [PID]"} 29 | func (b *BaseApi) StopProcess(c *gin.Context) { 30 | var req request.ProcessReq 31 | if err := helper.CheckBindAndValidate(&req, c); err != nil { 32 | return 33 | } 34 | if err := processService.StopProcess(req); err != nil { 35 | helper.ErrorWithDetail(c, constant.CodeErrBadRequest, constant.ErrTypeInvalidParams, err) 36 | return 37 | } 38 | helper.SuccessWithOutData(c) 39 | } 40 | -------------------------------------------------------------------------------- /backend/app/dto/alert.go: -------------------------------------------------------------------------------- 1 | package dto 2 | 3 | type CreateOrUpdateAlert struct { 4 | AlertTitle string `json:"alertTitle"` 5 | AlertType string `json:"alertType"` 6 | AlertCount uint `json:"alertCount"` 7 | EntryID uint `json:"entryID"` 8 | } 9 | 10 | type AlertBase struct { 11 | AlertType string `json:"alertType"` 12 | EntryID uint `json:"entryID"` 13 | } 14 | 15 | type PushAlert struct { 16 | TaskName string `json:"taskName"` 17 | AlertType string `json:"alertType"` 18 | EntryID uint `json:"entryID"` 19 | Param string `json:"param"` 20 | } 21 | -------------------------------------------------------------------------------- /backend/app/dto/command.go: -------------------------------------------------------------------------------- 1 | package dto 2 | 3 | type SearchCommandWithPage struct { 4 | PageInfo 5 | OrderBy string `json:"orderBy" validate:"required,oneof=name command created_at"` 6 | Order string `json:"order" validate:"required,oneof=null ascending descending"` 7 | GroupID uint `json:"groupID"` 8 | Info string `json:"info"` 9 | Name string `json:"name"` 10 | } 11 | 12 | type CommandOperate struct { 13 | ID uint `json:"id"` 14 | GroupID uint `json:"groupID"` 15 | GroupBelong string `json:"groupBelong"` 16 | Name string `json:"name" validate:"required"` 17 | Command string `json:"command" validate:"required"` 18 | } 19 | 20 | type CommandInfo struct { 21 | ID uint `json:"id"` 22 | GroupID uint `json:"groupID"` 23 | Name string `json:"name"` 24 | Command string `json:"command"` 25 | GroupBelong string `json:"groupBelong"` 26 | } 27 | 28 | type CommandTree struct { 29 | ID uint `json:"id"` 30 | Label string `json:"label"` 31 | Children []CommandInfo `json:"children"` 32 | } 33 | 34 | type RedisCommand struct { 35 | ID uint `json:"id"` 36 | Name string `json:"name"` 37 | Command string `json:"command"` 38 | } 39 | -------------------------------------------------------------------------------- /backend/app/dto/common_res.go: -------------------------------------------------------------------------------- 1 | package dto 2 | 3 | type PageResult struct { 4 | Total int64 `json:"total"` 5 | Items interface{} `json:"items"` 6 | } 7 | 8 | type Response struct { 9 | Code int `json:"code"` 10 | Message string `json:"message"` 11 | Data interface{} `json:"data"` 12 | } 13 | 14 | type Options struct { 15 | Option string `json:"option"` 16 | } 17 | -------------------------------------------------------------------------------- /backend/app/dto/compose_template.go: -------------------------------------------------------------------------------- 1 | package dto 2 | 3 | import "time" 4 | 5 | type ComposeTemplateCreate struct { 6 | Name string `json:"name" validate:"required"` 7 | Description string `json:"description"` 8 | Content string `json:"content"` 9 | } 10 | 11 | type ComposeTemplateUpdate struct { 12 | ID uint `json:"id"` 13 | Description string `json:"description"` 14 | Content string `json:"content"` 15 | } 16 | 17 | type ComposeTemplateInfo struct { 18 | ID uint `json:"id"` 19 | CreatedAt time.Time `json:"createdAt"` 20 | Name string `json:"name"` 21 | Description string `json:"description"` 22 | Content string `json:"content"` 23 | } 24 | -------------------------------------------------------------------------------- /backend/app/dto/device.go: -------------------------------------------------------------------------------- 1 | package dto 2 | 3 | type DeviceBaseInfo struct { 4 | DNS []string `json:"dns"` 5 | Hosts []HostHelper `json:"hosts"` 6 | Hostname string `json:"hostname"` 7 | TimeZone string `json:"timeZone"` 8 | LocalTime string `json:"localTime"` 9 | Ntp string `json:"ntp"` 10 | User string `json:"user"` 11 | 12 | SwapMemoryTotal uint64 `json:"swapMemoryTotal"` 13 | SwapMemoryAvailable uint64 `json:"swapMemoryAvailable"` 14 | SwapMemoryUsed uint64 `json:"swapMemoryUsed"` 15 | MaxSize uint64 `json:"maxSize"` 16 | 17 | SwapDetails []SwapHelper `json:"swapDetails"` 18 | } 19 | 20 | type HostHelper struct { 21 | IP string `json:"ip"` 22 | Host string `json:"host"` 23 | } 24 | 25 | type SwapHelper struct { 26 | Path string `json:"path" validate:"required"` 27 | Size uint64 `json:"size"` 28 | Used string `json:"used"` 29 | 30 | IsNew bool `json:"isNew"` 31 | } 32 | 33 | type TimeZoneOptions struct { 34 | From string `json:"from"` 35 | Zones []string `json:"zones"` 36 | } 37 | 38 | type ChangePasswd struct { 39 | User string `json:"user"` 40 | Passwd string `json:"passwd"` 41 | } 42 | -------------------------------------------------------------------------------- /backend/app/dto/docker.go: -------------------------------------------------------------------------------- 1 | package dto 2 | 3 | type DaemonJsonUpdateByFile struct { 4 | File string `json:"file"` 5 | } 6 | 7 | type DaemonJsonConf struct { 8 | IsSwarm bool `json:"isSwarm"` 9 | Status string `json:"status"` 10 | Version string `json:"version"` 11 | Mirrors []string `json:"registryMirrors"` 12 | Registries []string `json:"insecureRegistries"` 13 | LiveRestore bool `json:"liveRestore"` 14 | IPTables bool `json:"iptables"` 15 | CgroupDriver string `json:"cgroupDriver"` 16 | 17 | Ipv6 bool `json:"ipv6"` 18 | FixedCidrV6 string `json:"fixedCidrV6"` 19 | Ip6Tables bool `json:"ip6Tables"` 20 | Experimental bool `json:"experimental"` 21 | 22 | LogMaxSize string `json:"logMaxSize"` 23 | LogMaxFile string `json:"logMaxFile"` 24 | } 25 | 26 | type LogOption struct { 27 | LogMaxSize string `json:"logMaxSize"` 28 | LogMaxFile string `json:"logMaxFile"` 29 | } 30 | 31 | type Ipv6Option struct { 32 | FixedCidrV6 string `json:"fixedCidrV6"` 33 | Ip6Tables bool `json:"ip6Tables" validate:"required"` 34 | Experimental bool `json:"experimental"` 35 | } 36 | 37 | type DockerOperation struct { 38 | Operation string `json:"operation" validate:"required,oneof=start restart stop"` 39 | } 40 | -------------------------------------------------------------------------------- /backend/app/dto/fail2ban.go: -------------------------------------------------------------------------------- 1 | package dto 2 | 3 | type Fail2BanBaseInfo struct { 4 | IsEnable bool `json:"isEnable"` 5 | IsActive bool `json:"isActive"` 6 | IsExist bool `json:"isExist"` 7 | Version string `json:"version"` 8 | 9 | Port int `json:"port"` 10 | MaxRetry int `json:"maxRetry"` 11 | BanTime string `json:"banTime"` 12 | FindTime string `json:"findTime"` 13 | BanAction string `json:"banAction"` 14 | LogPath string `json:"logPath"` 15 | } 16 | 17 | type Fail2BanSearch struct { 18 | Status string `json:"status" validate:"required,oneof=banned ignore"` 19 | } 20 | 21 | type Fail2BanUpdate struct { 22 | Key string `json:"key" validate:"required,oneof=port bantime findtime maxretry banaction logpath"` 23 | Value string `json:"value"` 24 | } 25 | 26 | type Fail2BanSet struct { 27 | IPs []string `json:"ips"` 28 | Operate string `json:"operate" validate:"required,oneof=banned ignore"` 29 | } 30 | -------------------------------------------------------------------------------- /backend/app/dto/ftp.go: -------------------------------------------------------------------------------- 1 | package dto 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | type FtpInfo struct { 8 | ID uint `json:"id"` 9 | CreatedAt time.Time `json:"createdAt"` 10 | 11 | User string `json:"user"` 12 | Password string `json:"password"` 13 | Path string `json:"path"` 14 | Status string `json:"status"` 15 | Description string `json:"description"` 16 | } 17 | 18 | type FtpBaseInfo struct { 19 | IsActive bool `json:"isActive"` 20 | IsExist bool `json:"isExist"` 21 | } 22 | 23 | type FtpLogSearch struct { 24 | PageInfo 25 | User string `json:"user"` 26 | Operation string `json:"operation"` 27 | } 28 | 29 | type FtpCreate struct { 30 | User string `json:"user" validate:"required"` 31 | Password string `json:"password" validate:"required"` 32 | Path string `json:"path" validate:"required"` 33 | Description string `json:"description"` 34 | } 35 | 36 | type FtpUpdate struct { 37 | ID uint `json:"id"` 38 | 39 | Password string `json:"password" validate:"required"` 40 | Path string `json:"path" validate:"required"` 41 | Status string `json:"status"` 42 | Description string `json:"description"` 43 | } 44 | -------------------------------------------------------------------------------- /backend/app/dto/group.go: -------------------------------------------------------------------------------- 1 | package dto 2 | 3 | type GroupCreate struct { 4 | ID uint `json:"id"` 5 | Name string `json:"name" validate:"required"` 6 | Type string `json:"type" validate:"required"` 7 | } 8 | 9 | type GroupSearch struct { 10 | Type string `json:"type" validate:"required"` 11 | } 12 | 13 | type GroupUpdate struct { 14 | ID uint `json:"id"` 15 | Name string `json:"name"` 16 | Type string `json:"type" validate:"required"` 17 | IsDefault bool `json:"isDefault"` 18 | } 19 | 20 | type GroupInfo struct { 21 | ID uint `json:"id"` 22 | Name string `json:"name"` 23 | Type string `json:"type"` 24 | IsDefault bool `json:"isDefault"` 25 | } 26 | -------------------------------------------------------------------------------- /backend/app/dto/mcp.go: -------------------------------------------------------------------------------- 1 | package dto 2 | 3 | type DockerComposeService struct { 4 | Image string `yaml:"image"` 5 | ContainerName string `yaml:"container_name"` 6 | Restart string `yaml:"restart"` 7 | Ports []string `yaml:"ports"` 8 | Environment []string `yaml:"environment"` 9 | Command []string `yaml:"command"` 10 | } 11 | -------------------------------------------------------------------------------- /backend/app/dto/monitor.go: -------------------------------------------------------------------------------- 1 | package dto 2 | 3 | import "time" 4 | 5 | type MonitorSearch struct { 6 | Param string `json:"param" validate:"required,oneof=all cpu memory load io network"` 7 | Info string `json:"info"` 8 | StartTime time.Time `json:"startTime"` 9 | EndTime time.Time `json:"endTime"` 10 | } 11 | 12 | type MonitorData struct { 13 | Param string `json:"param" validate:"required,oneof=cpu memory load io network"` 14 | Date []time.Time `json:"date"` 15 | Value []interface{} `json:"value"` 16 | } 17 | -------------------------------------------------------------------------------- /backend/app/dto/request/favorite.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | type FavoriteCreate struct { 4 | Path string `json:"path" validate:"required"` 5 | } 6 | 7 | type FavoriteDelete struct { 8 | ID uint `json:"id" validate:"required"` 9 | } 10 | -------------------------------------------------------------------------------- /backend/app/dto/request/php_extensions.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import "github.com/1Panel-dev/1Panel/backend/app/dto" 4 | 5 | type PHPExtensionsSearch struct { 6 | dto.PageInfo 7 | All bool `json:"all"` 8 | } 9 | 10 | type PHPExtensionsCreate struct { 11 | Name string `json:"name" validate:"required"` 12 | Extensions string `json:"extensions" validate:"required"` 13 | } 14 | 15 | type PHPExtensionsUpdate struct { 16 | ID uint `json:"id" validate:"required"` 17 | Extensions string `json:"extensions" validate:"required"` 18 | } 19 | 20 | type PHPExtensionsDelete struct { 21 | ID uint `json:"id" validate:"required"` 22 | } 23 | -------------------------------------------------------------------------------- /backend/app/dto/request/process.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | type ProcessReq struct { 4 | PID int32 `json:"PID" validate:"required"` 5 | } 6 | -------------------------------------------------------------------------------- /backend/app/dto/request/recycle_bin.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | type RecycleBinCreate struct { 4 | SourcePath string `json:"sourcePath" validate:"required"` 5 | } 6 | 7 | type RecycleBinReduce struct { 8 | From string `json:"from" validate:"required"` 9 | RName string `json:"rName" validate:"required"` 10 | Name string `json:"name"` 11 | } 12 | -------------------------------------------------------------------------------- /backend/app/dto/response/favorite.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "github.com/1Panel-dev/1Panel/backend/app/model" 4 | 5 | type FavoriteDTO struct { 6 | model.Favorite 7 | } 8 | -------------------------------------------------------------------------------- /backend/app/dto/response/host_tool.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | type HostToolRes struct { 4 | Type string `json:"type"` 5 | Config interface{} `json:"config"` 6 | } 7 | 8 | type Supervisor struct { 9 | ConfigPath string `json:"configPath"` 10 | IncludeDir string `json:"includeDir"` 11 | LogPath string `json:"logPath"` 12 | IsExist bool `json:"isExist"` 13 | Init bool `json:"init"` 14 | Msg string `json:"msg"` 15 | Version string `json:"version"` 16 | Status string `json:"status"` 17 | CtlExist bool `json:"ctlExist"` 18 | ServiceName string `json:"serviceName"` 19 | } 20 | 21 | type HostToolConfig struct { 22 | Content string `json:"content"` 23 | } 24 | 25 | type SupervisorProcessConfig struct { 26 | Name string `json:"name"` 27 | Command string `json:"command"` 28 | User string `json:"user"` 29 | Dir string `json:"dir"` 30 | Numprocs string `json:"numprocs"` 31 | Msg string `json:"msg"` 32 | Status []ProcessStatus `json:"status"` 33 | } 34 | 35 | type ProcessStatus struct { 36 | Name string `json:"name"` 37 | Status string `json:"status"` 38 | PID string `json:"PID"` 39 | Uptime string `json:"uptime"` 40 | Msg string `json:"msg"` 41 | } 42 | -------------------------------------------------------------------------------- /backend/app/dto/response/mcp_server.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import ( 4 | "github.com/1Panel-dev/1Panel/backend/app/dto/request" 5 | "github.com/1Panel-dev/1Panel/backend/app/model" 6 | ) 7 | 8 | type McpServersRes struct { 9 | Items []McpServerDTO `json:"items"` 10 | Total int64 `json:"total"` 11 | } 12 | 13 | type McpServerDTO struct { 14 | model.McpServer 15 | Environments []request.Environment `json:"environments"` 16 | Volumes []request.Volume `json:"volumes"` 17 | } 18 | 19 | type McpBindDomainRes struct { 20 | Domain string `json:"domain"` 21 | SSLID uint `json:"sslID"` 22 | AcmeAccountID uint `json:"acmeAccountID"` 23 | AllowIPs []string `json:"allowIPs"` 24 | WebsiteID uint `json:"websiteID"` 25 | ConnUrl string `json:"connUrl"` 26 | } 27 | -------------------------------------------------------------------------------- /backend/app/dto/response/php_extensions.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "github.com/1Panel-dev/1Panel/backend/app/model" 4 | 5 | type PHPExtensionsDTO struct { 6 | model.PHPExtensions 7 | } 8 | -------------------------------------------------------------------------------- /backend/app/dto/response/recycle_bin.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "time" 4 | 5 | type RecycleBinDTO struct { 6 | Name string `json:"name"` 7 | Size int `json:"size"` 8 | Type string `json:"type"` 9 | DeleteTime time.Time `json:"deleteTime"` 10 | RName string `json:"rName"` 11 | SourcePath string `json:"sourcePath"` 12 | IsDir bool `json:"isDir"` 13 | From string `json:"from"` 14 | } 15 | -------------------------------------------------------------------------------- /backend/app/dto/response/website_ssl.go: -------------------------------------------------------------------------------- 1 | package response 2 | 3 | import "github.com/1Panel-dev/1Panel/backend/app/model" 4 | 5 | type WebsiteSSLDTO struct { 6 | model.WebsiteSSL 7 | LogPath string `json:"logPath"` 8 | } 9 | 10 | type WebsiteDNSRes struct { 11 | Key string `json:"resolve"` 12 | Value string `json:"value"` 13 | Domain string `json:"domain"` 14 | Err string `json:"err"` 15 | } 16 | 17 | type WebsiteAcmeAccountDTO struct { 18 | model.WebsiteAcmeAccount 19 | } 20 | 21 | type WebsiteDnsAccountDTO struct { 22 | model.WebsiteDnsAccount 23 | Authorization map[string]string `json:"authorization"` 24 | } 25 | 26 | type WebsiteCADTO struct { 27 | model.WebsiteCA 28 | CommonName string `json:"commonName" ` 29 | Country string `json:"country"` 30 | Organization string `json:"organization"` 31 | OrganizationUint string `json:"organizationUint"` 32 | Province string `json:"province" ` 33 | City string `json:"city"` 34 | } 35 | -------------------------------------------------------------------------------- /backend/app/model/ai.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type OllamaModel struct { 4 | BaseModel 5 | 6 | Name string `json:"name"` 7 | Size string `json:"size"` 8 | From string `json:"from"` 9 | Status string `json:"status"` 10 | Message string `json:"message"` 11 | } 12 | -------------------------------------------------------------------------------- /backend/app/model/app_detail.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type AppDetail struct { 4 | BaseModel 5 | AppId uint `json:"appId" gorm:"type:integer;not null"` 6 | Version string `json:"version" gorm:"type:varchar(64);not null"` 7 | Params string `json:"-" gorm:"type:longtext;"` 8 | DockerCompose string `json:"dockerCompose" gorm:"type:longtext;"` 9 | Status string `json:"status" gorm:"type:varchar(64);not null"` 10 | LastVersion string `json:"lastVersion" gorm:"type:varchar(64);"` 11 | LastModified int `json:"lastModified" gorm:"type:integer;"` 12 | DownloadUrl string `json:"downloadUrl" gorm:"type:varchar;"` 13 | DownloadCallBackUrl string `json:"downloadCallBackUrl" gorm:"type:longtext;"` 14 | Update bool `json:"update"` 15 | IgnoreUpgrade bool `json:"ignoreUpgrade"` 16 | } 17 | -------------------------------------------------------------------------------- /backend/app/model/app_install_resource.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type AppInstallResource struct { 4 | BaseModel 5 | AppInstallId uint `json:"appInstallId" gorm:"type:integer;not null;"` 6 | LinkId uint `json:"linkId" gorm:"type:integer;not null;"` 7 | ResourceId uint `json:"resourceId" gorm:"type:integer;"` 8 | Key string `json:"key" gorm:"type:varchar(64);not null"` 9 | From string `json:"from" gorm:"type:varchar(64);not null;default:local"` 10 | } 11 | -------------------------------------------------------------------------------- /backend/app/model/app_tag.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type AppTag struct { 4 | BaseModel 5 | AppId uint `json:"appId" gorm:"type:integer;not null"` 6 | TagId uint `json:"tagId" gorm:"type:integer;not null"` 7 | } 8 | -------------------------------------------------------------------------------- /backend/app/model/backup.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type BackupAccount struct { 4 | BaseModel 5 | Type string `gorm:"type:varchar(64);unique;not null" json:"type"` 6 | Bucket string `gorm:"type:varchar(256)" json:"bucket"` 7 | AccessKey string `gorm:"type:varchar(256)" json:"accessKey"` 8 | Credential string `gorm:"type:varchar(256)" json:"credential"` 9 | BackupPath string `gorm:"type:varchar(256)" json:"backupPath"` 10 | Vars string `gorm:"type:longText" json:"vars"` 11 | } 12 | 13 | type BackupRecord struct { 14 | BaseModel 15 | From string `gorm:"type:varchar(64)" json:"from"` 16 | CronjobID uint `gorm:"type:decimal" json:"cronjobID"` 17 | Type string `gorm:"type:varchar(64);not null" json:"type"` 18 | Name string `gorm:"type:varchar(64);not null" json:"name"` 19 | DetailName string `gorm:"type:varchar(256)" json:"detailName"` 20 | Source string `gorm:"type:varchar(256)" json:"source"` 21 | BackupType string `gorm:"type:varchar(256)" json:"backupType"` 22 | FileDir string `gorm:"type:varchar(256)" json:"fileDir"` 23 | FileName string `gorm:"type:varchar(256)" json:"fileName"` 24 | } 25 | -------------------------------------------------------------------------------- /backend/app/model/base.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | import "time" 4 | 5 | type BaseModel struct { 6 | ID uint `gorm:"primarykey;AUTO_INCREMENT" json:"id"` 7 | CreatedAt time.Time `json:"createdAt"` 8 | UpdatedAt time.Time `json:"updatedAt"` 9 | } 10 | -------------------------------------------------------------------------------- /backend/app/model/clam.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type Clam struct { 4 | BaseModel 5 | 6 | Name string `gorm:"type:varchar(64);not null" json:"name"` 7 | Status string `gorm:"type:varchar(64)" json:"status"` 8 | Path string `gorm:"type:varchar(64);not null" json:"path"` 9 | InfectedStrategy string `gorm:"type:varchar(64)" json:"infectedStrategy"` 10 | InfectedDir string `gorm:"type:varchar(64)" json:"infectedDir"` 11 | Spec string `gorm:"type:varchar(64)" json:"spec"` 12 | EntryID int `gorm:"type:varchar(64)" json:"entryID"` 13 | Description string `gorm:"type:varchar(64)" json:"description"` 14 | } 15 | -------------------------------------------------------------------------------- /backend/app/model/command.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type Command struct { 4 | BaseModel 5 | Name string `gorm:"type:varchar(64);unique;not null" json:"name"` 6 | GroupID uint `gorm:"type:decimal" json:"groupID"` 7 | Command string `gorm:"type:varchar(256);not null" json:"command"` 8 | } 9 | 10 | type RedisCommand struct { 11 | BaseModel 12 | Name string `gorm:"type:varchar(64);unique;not null" json:"name"` 13 | Command string `gorm:"type:varchar(256);not null" json:"command"` 14 | } 15 | -------------------------------------------------------------------------------- /backend/app/model/compose_template.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type ComposeTemplate struct { 4 | BaseModel 5 | 6 | Name string `gorm:"type:varchar(64);not null;unique" json:"name"` 7 | Description string `gorm:"type:varchar(256)" json:"description"` 8 | Content string `gorm:"type:longtext" json:"content"` 9 | } 10 | 11 | type Compose struct { 12 | BaseModel 13 | 14 | Name string `gorm:"type:varchar(256)" json:"name"` 15 | Path string `gorm:"type:varchar(256)" json:"path"` 16 | } 17 | -------------------------------------------------------------------------------- /backend/app/model/database.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type Database struct { 4 | BaseModel 5 | AppInstallID uint `json:"appInstallID" gorm:"type:decimal"` 6 | Name string `json:"name" gorm:"type:varchar(64);not null;unique"` 7 | Type string `json:"type" gorm:"type:varchar(64);not null"` 8 | Version string `json:"version" gorm:"type:varchar(64);not null"` 9 | From string `json:"from" gorm:"type:varchar(64);not null"` 10 | Address string `json:"address" gorm:"type:varchar(64);not null"` 11 | Port uint `json:"port" gorm:"type:decimal;not null"` 12 | Username string `json:"username" gorm:"type:varchar(64)"` 13 | Password string `json:"password" gorm:"type:varchar(64)"` 14 | 15 | SSL bool `json:"ssl"` 16 | RootCert string `json:"rootCert" gorm:"type:longText"` 17 | ClientKey string `json:"clientKey" gorm:"type:longText"` 18 | ClientCert string `json:"clientCert" gorm:"type:longText"` 19 | SkipVerify bool `json:"skipVerify"` 20 | 21 | Description string `json:"description" gorm:"type:varchar(256);"` 22 | } 23 | -------------------------------------------------------------------------------- /backend/app/model/database_mysql.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type DatabaseMysql struct { 4 | BaseModel 5 | Name string `json:"name" gorm:"type:varchar(256);not null"` 6 | From string `json:"from" gorm:"type:varchar(256);not null;default:local"` 7 | MysqlName string `json:"mysqlName" gorm:"type:varchar(64);not null"` 8 | Format string `json:"format" gorm:"type:varchar(64);not null"` 9 | Username string `json:"username" gorm:"type:varchar(256);not null"` 10 | Password string `json:"password" gorm:"type:varchar(256);not null"` 11 | Permission string `json:"permission" gorm:"type:varchar(256);not null"` 12 | IsDelete bool `json:"isDelete" gorm:"type:varchar(64)"` 13 | Description string `json:"description" gorm:"type:varchar(256);"` 14 | } 15 | -------------------------------------------------------------------------------- /backend/app/model/database_postgresql.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type DatabasePostgresql struct { 4 | BaseModel 5 | Name string `json:"name" gorm:"type:varchar(256);not null"` 6 | From string `json:"from" gorm:"type:varchar(256);not null;default:local"` 7 | PostgresqlName string `json:"postgresqlName" gorm:"type:varchar(64);not null"` 8 | Format string `json:"format" gorm:"type:varchar(64);not null"` 9 | Username string `json:"username" gorm:"type:varchar(256);not null"` 10 | Password string `json:"password" gorm:"type:varchar(256);not null"` 11 | SuperUser bool `json:"superUser" gorm:"type:varchar(64)"` 12 | IsDelete bool `json:"isDelete" gorm:"type:varchar(64)"` 13 | Description string `json:"description" gorm:"type:varchar(256);"` 14 | } 15 | -------------------------------------------------------------------------------- /backend/app/model/favorite.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type Favorite struct { 4 | BaseModel 5 | Name string `gorm:"type:varchar(256);not null;" json:"name" ` 6 | Path string `gorm:"type:varchar(256);not null;unique" json:"path"` 7 | Type string `gorm:"type:varchar(64);" json:"type"` 8 | IsDir bool `json:"isDir"` 9 | IsTxt bool `json:"isTxt"` 10 | } 11 | -------------------------------------------------------------------------------- /backend/app/model/firewall.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type Firewall struct { 4 | BaseModel 5 | 6 | Type string `gorm:"type:varchar(64);not null" json:"type"` 7 | Port string `gorm:"type:varchar(64);not null" json:"port"` 8 | Protocol string `gorm:"type:varchar(64);not null" json:"protocol"` 9 | Address string `gorm:"type:varchar(64);not null" json:"address"` 10 | Strategy string `gorm:"type:varchar(64);not null" json:"strategy"` 11 | Description string `gorm:"type:varchar(64);not null" json:"description"` 12 | } 13 | 14 | type Forward struct { 15 | BaseModel 16 | 17 | Protocol string `gorm:"type:varchar(64);not null" json:"protocol"` 18 | Port string `gorm:"type:varchar(64);not null" json:"port"` 19 | TargetIP string `gorm:"type:varchar(64);not null" json:"targetIP"` 20 | TargetPort string `gorm:"type:varchar(64);not null" json:"targetPort"` 21 | } 22 | -------------------------------------------------------------------------------- /backend/app/model/ftp.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type Ftp struct { 4 | BaseModel 5 | 6 | User string `gorm:"type:varchar(64);not null" json:"user"` 7 | Password string `gorm:"type:varchar(64);not null" json:"password"` 8 | Status string `gorm:"type:varchar(64);not null" json:"status"` 9 | Path string `gorm:"type:varchar(64);not null" json:"path"` 10 | Description string `gorm:"type:varchar(64);not null" json:"description"` 11 | } 12 | -------------------------------------------------------------------------------- /backend/app/model/group.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type Group struct { 4 | BaseModel 5 | IsDefault bool `json:"isDefault"` 6 | Name string `gorm:"type:varchar(64);not null" json:"name"` 7 | Type string `gorm:"type:varchar(16);not null" json:"type"` 8 | } 9 | -------------------------------------------------------------------------------- /backend/app/model/host.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type Host struct { 4 | BaseModel 5 | 6 | GroupID uint `gorm:"type:decimal;not null" json:"group_id"` 7 | Name string `gorm:"type:varchar(64);not null" json:"name"` 8 | Addr string `gorm:"type:varchar(16);not null" json:"addr"` 9 | Port int `gorm:"type:decimal;not null" json:"port"` 10 | User string `gorm:"type:varchar(64);not null" json:"user"` 11 | AuthMode string `gorm:"type:varchar(16);not null" json:"authMode"` 12 | Password string `gorm:"type:varchar(64)" json:"password"` 13 | PrivateKey string `gorm:"type:varchar(256)" json:"privateKey"` 14 | PassPhrase string `gorm:"type:varchar(256)" json:"passPhrase"` 15 | RememberPassword bool `json:"rememberPassword"` 16 | 17 | Description string `gorm:"type:varchar(256)" json:"description"` 18 | } 19 | -------------------------------------------------------------------------------- /backend/app/model/image_repo.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type ImageRepo struct { 4 | BaseModel 5 | 6 | Name string `gorm:"type:varchar(64);not null" json:"name"` 7 | DownloadUrl string `gorm:"type:varchar(256)" json:"downloadUrl"` 8 | Protocol string `gorm:"type:varchar(64)" json:"protocol"` 9 | Username string `gorm:"type:varchar(256)" json:"username"` 10 | Password string `gorm:"type:varchar(256)" json:"password"` 11 | Auth bool `gorm:"type:varchar(256)" json:"auth"` 12 | 13 | Status string `gorm:"type:varchar(64)" json:"status"` 14 | Message string `gorm:"type:varchar(256)" json:"message"` 15 | } 16 | -------------------------------------------------------------------------------- /backend/app/model/logs.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | type OperationLog struct { 8 | BaseModel 9 | Source string `gorm:"type:varchar(64)" json:"source"` 10 | 11 | IP string `gorm:"type:varchar(64)" json:"ip"` 12 | Path string `gorm:"type:varchar(64)" json:"path"` 13 | Method string `gorm:"type:varchar(64)" json:"method"` 14 | UserAgent string `gorm:"type:varchar(256)" json:"userAgent"` 15 | 16 | Latency time.Duration `gorm:"type:varchar(64)" json:"latency"` 17 | Status string `gorm:"type:varchar(64)" json:"status"` 18 | Message string `gorm:"type:varchar(256)" json:"message"` 19 | 20 | DetailZH string `gorm:"type:varchar(256)" json:"detailZH"` 21 | DetailEN string `gorm:"type:varchar(256)" json:"detailEN"` 22 | } 23 | 24 | type LoginLog struct { 25 | BaseModel 26 | IP string `gorm:"type:varchar(64)" json:"ip"` 27 | Address string `gorm:"type:varchar(64)" json:"address"` 28 | Agent string `gorm:"type:varchar(256)" json:"agent"` 29 | Status string `gorm:"type:varchar(64)" json:"status"` 30 | Message string `gorm:"type:longText" json:"message"` 31 | } 32 | -------------------------------------------------------------------------------- /backend/app/model/mcp_server.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type McpServer struct { 4 | BaseModel 5 | Name string `json:"name"` 6 | DockerCompose string `json:"dockerCompose"` 7 | Command string `json:"command"` 8 | ContainerName string `json:"containerName"` 9 | Message string `json:"message"` 10 | Port int `json:"port"` 11 | Status string `json:"status"` 12 | Env string `json:"env"` 13 | BaseURL string `json:"baseUrl"` 14 | SsePath string `json:"ssePath"` 15 | WebsiteID int `json:"websiteID"` 16 | Dir string `json:"dir"` 17 | HostIP string `json:"hostIP"` 18 | } 19 | -------------------------------------------------------------------------------- /backend/app/model/monitor.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type MonitorBase struct { 4 | BaseModel 5 | Cpu float64 `gorm:"type:float" json:"cpu"` 6 | 7 | LoadUsage float64 `gorm:"type:float" json:"loadUsage"` 8 | CpuLoad1 float64 `gorm:"type:float" json:"cpuLoad1"` 9 | CpuLoad5 float64 `gorm:"type:float" json:"cpuLoad5"` 10 | CpuLoad15 float64 `gorm:"type:float" json:"cpuLoad15"` 11 | 12 | Memory float64 `gorm:"type:float" json:"memory"` 13 | } 14 | 15 | type MonitorIO struct { 16 | BaseModel 17 | Name string `json:"name"` 18 | Read uint64 `json:"read"` 19 | Write uint64 `json:"write"` 20 | Count uint64 `json:"count"` 21 | Time uint64 `json:"time"` 22 | } 23 | 24 | type MonitorNetwork struct { 25 | BaseModel 26 | Name string `json:"name"` 27 | Up float64 `gorm:"type:float" json:"up"` 28 | Down float64 `gorm:"type:float" json:"down"` 29 | } 30 | -------------------------------------------------------------------------------- /backend/app/model/php_extensions.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type PHPExtensions struct { 4 | BaseModel 5 | Name string ` json:"name" gorm:"not null"` 6 | Extensions string `json:"extensions" gorm:"not null"` 7 | } 8 | -------------------------------------------------------------------------------- /backend/app/model/setting.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type Setting struct { 4 | BaseModel 5 | Key string `json:"key" gorm:"type:varchar(256);not null;"` 6 | Value string `json:"value" gorm:"type:varchar(256)"` 7 | About string `json:"about" gorm:"type:longText"` 8 | } 9 | -------------------------------------------------------------------------------- /backend/app/model/tag.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type Tag struct { 4 | BaseModel 5 | Key string `json:"key" gorm:"type:varchar(64);not null"` 6 | Name string `json:"name" gorm:"type:varchar(64);not null"` 7 | Translations string `json:"translations"` 8 | Sort int `json:"sort" gorm:"type:int;not null;default:1"` 9 | } 10 | -------------------------------------------------------------------------------- /backend/app/model/website_acme_account.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type WebsiteAcmeAccount struct { 4 | BaseModel 5 | Email string `gorm:"not null" json:"email"` 6 | URL string `gorm:"not null" json:"url"` 7 | PrivateKey string `gorm:"not null" json:"-"` 8 | Type string `gorm:"not null;default:letsencrypt" json:"type"` 9 | EabKid string `gorm:"default:null;" json:"eabKid"` 10 | EabHmacKey string `gorm:"default:null" json:"eabHmacKey"` 11 | KeyType string `gorm:"not null;default:2048" json:"keyType"` 12 | } 13 | 14 | func (w WebsiteAcmeAccount) TableName() string { 15 | return "website_acme_accounts" 16 | } 17 | -------------------------------------------------------------------------------- /backend/app/model/website_ca.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type WebsiteCA struct { 4 | BaseModel 5 | CSR string `gorm:"not null;" json:"csr"` 6 | Name string `gorm:"not null;" json:"name"` 7 | PrivateKey string `gorm:"not null" json:"privateKey"` 8 | KeyType string `gorm:"not null;default:2048" json:"keyType"` 9 | } 10 | -------------------------------------------------------------------------------- /backend/app/model/website_dns_account.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type WebsiteDnsAccount struct { 4 | BaseModel 5 | Name string `gorm:"type:varchar(64);not null" json:"name"` 6 | Type string `gorm:"type:varchar(64);not null" json:"type"` 7 | Authorization string `gorm:"type:varchar(256);not null" json:"-"` 8 | } 9 | 10 | func (w WebsiteDnsAccount) TableName() string { 11 | return "website_dns_accounts" 12 | } 13 | -------------------------------------------------------------------------------- /backend/app/model/website_domain.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type WebsiteDomain struct { 4 | BaseModel 5 | WebsiteID uint `gorm:"column:website_id;type:varchar(64);not null;" json:"websiteId"` 6 | Domain string `gorm:"type:varchar(256);not null" json:"domain"` 7 | Port int `gorm:"type:integer" json:"port"` 8 | } 9 | 10 | func (w WebsiteDomain) TableName() string { 11 | return "website_domains" 12 | } 13 | -------------------------------------------------------------------------------- /backend/app/service/helper.go: -------------------------------------------------------------------------------- 1 | package service 2 | 3 | import ( 4 | "context" 5 | "github.com/1Panel-dev/1Panel/backend/constant" 6 | "github.com/1Panel-dev/1Panel/backend/global" 7 | "gorm.io/gorm" 8 | ) 9 | 10 | func getTxAndContext() (tx *gorm.DB, ctx context.Context) { 11 | tx = global.DB.Begin() 12 | ctx = context.WithValue(context.Background(), constant.DB, tx) 13 | return 14 | } 15 | -------------------------------------------------------------------------------- /backend/app/service/process.go: -------------------------------------------------------------------------------- 1 | package service 2 | 3 | import ( 4 | "github.com/1Panel-dev/1Panel/backend/app/dto/request" 5 | "github.com/shirou/gopsutil/v3/process" 6 | ) 7 | 8 | type ProcessService struct{} 9 | 10 | type IProcessService interface { 11 | StopProcess(req request.ProcessReq) error 12 | } 13 | 14 | func NewIProcessService() IProcessService { 15 | return &ProcessService{} 16 | } 17 | 18 | func (p *ProcessService) StopProcess(req request.ProcessReq) error { 19 | proc, err := process.NewProcess(req.PID) 20 | if err != nil { 21 | return err 22 | } 23 | if err := proc.Kill(); err != nil { 24 | return err 25 | } 26 | return nil 27 | } 28 | -------------------------------------------------------------------------------- /backend/buserr/multi_err.go: -------------------------------------------------------------------------------- 1 | package buserr 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "sort" 7 | ) 8 | 9 | type MultiErr map[string]error 10 | 11 | func (e MultiErr) Error() string { 12 | var keys []string 13 | for key := range e { 14 | keys = append(keys, key) 15 | } 16 | sort.Strings(keys) 17 | 18 | buffer := bytes.NewBufferString("") 19 | for _, key := range keys { 20 | buffer.WriteString(fmt.Sprintf("[%s] %s\n", key, e[key])) 21 | } 22 | return buffer.String() 23 | } 24 | -------------------------------------------------------------------------------- /backend/configs/config.go: -------------------------------------------------------------------------------- 1 | package configs 2 | 3 | type ServerConfig struct { 4 | System System `mapstructure:"system"` 5 | LogConfig LogConfig `mapstructure:"log"` 6 | } 7 | -------------------------------------------------------------------------------- /backend/configs/log.go: -------------------------------------------------------------------------------- 1 | package configs 2 | 3 | type LogConfig struct { 4 | Level string `mapstructure:"level"` 5 | TimeZone string `mapstructure:"timeZone"` 6 | LogName string `mapstructure:"log_name"` 7 | LogSuffix string `mapstructure:"log_suffix"` 8 | MaxBackup int `mapstructure:"max_backup"` 9 | } 10 | -------------------------------------------------------------------------------- /backend/constant/alert.go: -------------------------------------------------------------------------------- 1 | package constant 2 | 3 | const ( 4 | AlertEnable = "Enable" 5 | AlertDisable = "Disable" 6 | AlertSuccess = "Success" 7 | AlertError = "Error" 8 | AlertSyncError = "SyncError" 9 | AlertPushError = "PushError" 10 | AlertPushSuccess = "PushSuccess" 11 | ) 12 | -------------------------------------------------------------------------------- /backend/constant/backup.go: -------------------------------------------------------------------------------- 1 | package constant 2 | 3 | const ( 4 | Valid = "VALID" 5 | DisConnect = "DISCONNECT" 6 | VerifyFailed = "VERIFYFAILED" 7 | S3 = "S3" 8 | OSS = "OSS" 9 | Sftp = "SFTP" 10 | OneDrive = "OneDrive" 11 | MinIo = "MINIO" 12 | Cos = "COS" 13 | Kodo = "KODO" 14 | WebDAV = "WebDAV" 15 | Local = "LOCAL" 16 | 17 | OneDriveRedirectURI = "http://localhost/login/authorized" 18 | ) 19 | -------------------------------------------------------------------------------- /backend/constant/container.go: -------------------------------------------------------------------------------- 1 | package constant 2 | 3 | const ( 4 | ContainerOpStart = "start" 5 | ContainerOpStop = "stop" 6 | ContainerOpRestart = "restart" 7 | ContainerOpKill = "kill" 8 | ContainerOpPause = "pause" 9 | ContainerOpUnpause = "unpause" 10 | ContainerOpRename = "rename" 11 | ContainerOpRemove = "remove" 12 | 13 | ComposeOpStop = "stop" 14 | ComposeOpRestart = "restart" 15 | ComposeOpRemove = "remove" 16 | 17 | DaemonJsonPath = "/etc/docker/daemon.json" 18 | ) 19 | -------------------------------------------------------------------------------- /backend/constant/dir.go: -------------------------------------------------------------------------------- 1 | package constant 2 | 3 | import ( 4 | "path" 5 | 6 | "github.com/1Panel-dev/1Panel/backend/global" 7 | ) 8 | 9 | var ( 10 | DataDir = global.CONF.System.DataDir 11 | ResourceDir = path.Join(DataDir, "resource") 12 | AppResourceDir = path.Join(ResourceDir, "apps") 13 | AppInstallDir = path.Join(DataDir, "apps") 14 | LocalAppResourceDir = path.Join(AppResourceDir, "local") 15 | LocalAppInstallDir = path.Join(AppInstallDir, "local") 16 | RemoteAppResourceDir = path.Join(AppResourceDir, "remote") 17 | RuntimeDir = path.Join(DataDir, "runtime") 18 | RecycleBinDir = "/.1panel_clash" 19 | SSLLogDir = path.Join(global.CONF.System.DataDir, "log", "ssl") 20 | McpDir = path.Join(DataDir, "mcp") 21 | ) 22 | -------------------------------------------------------------------------------- /backend/constant/host_tool.go: -------------------------------------------------------------------------------- 1 | package constant 2 | 3 | const ( 4 | Supervisord = "supervisord" 5 | Supervisor = "supervisor" 6 | SupervisorConfigPath = "SupervisorConfigPath" 7 | SupervisorServiceName = "SupervisorServiceName" 8 | ) 9 | -------------------------------------------------------------------------------- /backend/constant/nginx.go: -------------------------------------------------------------------------------- 1 | package constant 2 | 3 | const ( 4 | NginxScopeServer = "server" 5 | NginxScopeHttp = "http" 6 | NginxScopeOut = "out" 7 | 8 | NginxReload = "reload" 9 | NginxCheck = "check" 10 | NginxRestart = "restart" 11 | 12 | ConfigNew = "add" 13 | ConfigUpdate = "update" 14 | ConfigDel = "delete" 15 | ) 16 | -------------------------------------------------------------------------------- /backend/constant/runtime.go: -------------------------------------------------------------------------------- 1 | package constant 2 | 3 | const ( 4 | ResourceLocal = "local" 5 | ResourceAppstore = "appstore" 6 | 7 | RuntimeNormal = "normal" 8 | RuntimeError = "error" 9 | RuntimeBuildIng = "building" 10 | RuntimeStarting = "starting" 11 | RuntimeRunning = "running" 12 | RuntimeReCreating = "recreating" 13 | RuntimeStopped = "stopped" 14 | RuntimeUnhealthy = "unhealthy" 15 | RuntimeCreating = "creating" 16 | RuntimeReStarting = "restarting" 17 | 18 | RuntimePHP = "php" 19 | RuntimeNode = "node" 20 | RuntimeJava = "java" 21 | RuntimeGo = "go" 22 | RuntimePython = "python" 23 | RuntimeDotNet = "dotnet" 24 | 25 | RuntimeProxyUnix = "unix" 26 | RuntimeProxyTcp = "tcp" 27 | 28 | RuntimeUp = "up" 29 | RuntimeDown = "down" 30 | RuntimeRestart = "restart" 31 | 32 | RuntimeInstall = "install" 33 | RuntimeUninstall = "uninstall" 34 | RuntimeUpdate = "update" 35 | 36 | RuntimeNpm = "npm" 37 | RuntimeYarn = "yarn" 38 | ) 39 | -------------------------------------------------------------------------------- /backend/constant/session.go: -------------------------------------------------------------------------------- 1 | package constant 2 | 3 | const ( 4 | AuthMethodSession = "session" 5 | SessionName = "psession" 6 | 7 | AuthMethodJWT = "jwt" 8 | JWTHeaderName = "PanelAuthorization" 9 | JWTBufferTime = 3600 10 | JWTIssuer = "1Panel" 11 | 12 | PasswordExpiredName = "expired" 13 | ) 14 | -------------------------------------------------------------------------------- /backend/constant/status.go: -------------------------------------------------------------------------------- 1 | package constant 2 | 3 | const ( 4 | StatusRunning = "Running" 5 | StatusDone = "Done" 6 | StatusWaiting = "Waiting" 7 | StatusSuccess = "Success" 8 | StatusFailed = "Failed" 9 | StatusDeleted = "Deleted" 10 | StatusCanceled = "Canceled" 11 | StatusUploading = "Uploading" 12 | StatusEnable = "Enable" 13 | StatusDisable = "Disable" 14 | StatusNone = "None" 15 | StatusOnRetry = "OnRetry" 16 | StatusLost = "Lost" 17 | 18 | OrderDesc = "descending" 19 | OrderAsc = "ascending" 20 | ) 21 | -------------------------------------------------------------------------------- /backend/constant/website.go: -------------------------------------------------------------------------------- 1 | package constant 2 | 3 | const ( 4 | WebRunning = "Running" 5 | WebStopped = "Stopped" 6 | 7 | ProtocolHTTP = "HTTP" 8 | ProtocolHTTPS = "HTTPS" 9 | 10 | NewApp = "new" 11 | InstalledApp = "installed" 12 | 13 | Deployment = "deployment" 14 | Static = "static" 15 | Proxy = "proxy" 16 | Runtime = "runtime" 17 | 18 | SSLExisted = "existed" 19 | SSLAuto = "auto" 20 | SSLManual = "manual" 21 | 22 | DNSAccount = "dnsAccount" 23 | DnsManual = "dnsManual" 24 | Http = "http" 25 | Manual = "manual" 26 | SelfSigned = "selfSigned" 27 | 28 | StartWeb = "start" 29 | StopWeb = "stop" 30 | 31 | HTTPSOnly = "HTTPSOnly" 32 | HTTPAlso = "HTTPAlso" 33 | HTTPToHTTPS = "HTTPToHTTPS" 34 | 35 | GetLog = "get" 36 | DisableLog = "disable" 37 | EnableLog = "enable" 38 | DeleteLog = "delete" 39 | 40 | AccessLog = "access.log" 41 | ErrorLog = "error.log" 42 | 43 | ConfigPHP = "php" 44 | ConfigFPM = "fpm" 45 | 46 | SSLInit = "init" 47 | SSLError = "error" 48 | SSLReady = "ready" 49 | SSLApply = "applying" 50 | SSLApplyError = "applyError" 51 | ) 52 | -------------------------------------------------------------------------------- /backend/cron/job/app.go: -------------------------------------------------------------------------------- 1 | package job 2 | 3 | import ( 4 | "github.com/1Panel-dev/1Panel/backend/app/service" 5 | "github.com/1Panel-dev/1Panel/backend/global" 6 | ) 7 | 8 | type app struct{} 9 | 10 | func NewAppStoreJob() *app { 11 | return &app{} 12 | } 13 | 14 | func (a *app) Run() { 15 | global.LOG.Info("AppStore scheduled task in progress ...") 16 | appService := service.NewIAppService() 17 | if err := appService.SyncAppListFromRemote(); err != nil { 18 | global.LOG.Errorf("AppStore sync failed %s", err.Error()) 19 | } 20 | appService.SyncAppListFromLocal() 21 | global.LOG.Info("AppStore scheduled task has completed") 22 | } 23 | -------------------------------------------------------------------------------- /backend/cron/job/cache.go: -------------------------------------------------------------------------------- 1 | package job 2 | 3 | import ( 4 | "github.com/1Panel-dev/1Panel/backend/global" 5 | "time" 6 | ) 7 | 8 | type Cache struct{} 9 | 10 | func NewCacheJob() *Cache { 11 | return &Cache{} 12 | } 13 | 14 | func (c *Cache) Run() { 15 | global.LOG.Info("run cache gc start ...") 16 | ticker := time.NewTicker(5 * time.Minute) 17 | defer ticker.Stop() 18 | for range ticker.C { 19 | again: 20 | err := global.CacheDb.RunValueLogGC(0.7) 21 | if err == nil { 22 | goto again 23 | } 24 | } 25 | global.LOG.Info("run cache gc end ...") 26 | } 27 | -------------------------------------------------------------------------------- /backend/global/global.go: -------------------------------------------------------------------------------- 1 | package global 2 | 3 | import ( 4 | "github.com/1Panel-dev/1Panel/backend/configs" 5 | "github.com/1Panel-dev/1Panel/backend/init/cache/badger_db" 6 | "github.com/1Panel-dev/1Panel/backend/init/session/psession" 7 | "github.com/dgraph-io/badger/v4" 8 | "github.com/go-playground/validator/v10" 9 | "github.com/nicksnyder/go-i18n/v2/i18n" 10 | "github.com/robfig/cron/v3" 11 | "github.com/sirupsen/logrus" 12 | "github.com/spf13/viper" 13 | "gorm.io/gorm" 14 | ) 15 | 16 | var ( 17 | DB *gorm.DB 18 | MonitorDB *gorm.DB 19 | LOG *logrus.Logger 20 | CONF configs.ServerConfig 21 | VALID *validator.Validate 22 | SESSION *psession.PSession 23 | CACHE *badger_db.Cache 24 | CacheDb *badger.DB 25 | Viper *viper.Viper 26 | 27 | Cron *cron.Cron 28 | MonitorCronID cron.EntryID 29 | OneDriveCronID cron.EntryID 30 | 31 | I18n *i18n.Localizer 32 | I18nForCmd *i18n.Localizer 33 | ) 34 | -------------------------------------------------------------------------------- /backend/init/migration/migrations/v_1_7.go: -------------------------------------------------------------------------------- 1 | package migrations 2 | 3 | import ( 4 | "github.com/1Panel-dev/1Panel/backend/app/model" 5 | "github.com/go-gormigrate/gormigrate/v2" 6 | "gorm.io/gorm" 7 | ) 8 | 9 | var AddDefaultNetwork = &gormigrate.Migration{ 10 | ID: "20230928-add-default-network", 11 | Migrate: func(tx *gorm.DB) error { 12 | if err := tx.Create(&model.Setting{Key: "DefaultNetwork", Value: "all"}).Error; err != nil { 13 | return err 14 | } 15 | if err := tx.Create(&model.Setting{Key: "LastCleanTime", Value: ""}).Error; err != nil { 16 | return err 17 | } 18 | if err := tx.Create(&model.Setting{Key: "LastCleanSize", Value: ""}).Error; err != nil { 19 | return err 20 | } 21 | if err := tx.Create(&model.Setting{Key: "LastCleanData", Value: ""}).Error; err != nil { 22 | return err 23 | } 24 | return nil 25 | }, 26 | } 27 | 28 | var UpdateRuntime = &gormigrate.Migration{ 29 | ID: "20230927-update-runtime", 30 | Migrate: func(tx *gorm.DB) error { 31 | if err := tx.AutoMigrate(&model.Runtime{}); err != nil { 32 | return err 33 | } 34 | return nil 35 | }, 36 | } 37 | 38 | var UpdateTag = &gormigrate.Migration{ 39 | ID: "20231008-update-tag", 40 | Migrate: func(tx *gorm.DB) error { 41 | if err := tx.AutoMigrate(&model.Tag{}); err != nil { 42 | return err 43 | } 44 | return nil 45 | }, 46 | } 47 | -------------------------------------------------------------------------------- /backend/init/session/psession/psession.go: -------------------------------------------------------------------------------- 1 | package psession 2 | 3 | import ( 4 | "encoding/json" 5 | "time" 6 | 7 | "github.com/1Panel-dev/1Panel/backend/init/cache/badger_db" 8 | ) 9 | 10 | type SessionUser struct { 11 | ID uint `json:"id"` 12 | Name string `json:"name"` 13 | } 14 | 15 | type PSession struct { 16 | ExpireTime int64 `json:"expire_time"` 17 | store *badger_db.Cache 18 | } 19 | 20 | func NewPSession(db *badger_db.Cache) *PSession { 21 | return &PSession{ 22 | store: db, 23 | } 24 | } 25 | 26 | func (p *PSession) Get(sessionID string) (SessionUser, error) { 27 | var result SessionUser 28 | item, err := p.store.Get(sessionID) 29 | if err != nil { 30 | return result, err 31 | } 32 | _ = json.Unmarshal(item, &result) 33 | return result, nil 34 | } 35 | 36 | func (p *PSession) Set(sessionID string, user SessionUser, ttlSeconds int) error { 37 | p.ExpireTime = time.Now().Unix() + int64(ttlSeconds) 38 | return p.store.SetWithTTL(sessionID, user, time.Second*time.Duration(ttlSeconds)) 39 | } 40 | 41 | func (p *PSession) Delete(sessionID string) error { 42 | return p.store.Del(sessionID) 43 | } 44 | 45 | func (p *PSession) Clean() error { 46 | return p.store.Clean() 47 | } 48 | -------------------------------------------------------------------------------- /backend/init/session/session.go: -------------------------------------------------------------------------------- 1 | package session 2 | 3 | import ( 4 | "github.com/1Panel-dev/1Panel/backend/global" 5 | "github.com/1Panel-dev/1Panel/backend/init/session/psession" 6 | ) 7 | 8 | func Init() { 9 | global.SESSION = psession.NewPSession(global.CACHE) 10 | global.LOG.Info("init session successfully") 11 | } 12 | -------------------------------------------------------------------------------- /backend/log/config.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "errors" 5 | "io" 6 | "os" 7 | "path" 8 | ) 9 | 10 | var ( 11 | BufferSize = 0x100000 12 | DefaultFileMode = os.FileMode(0644) 13 | DefaultFileFlag = os.O_RDWR | os.O_CREATE | os.O_APPEND 14 | ErrInvalidArgument = errors.New("error argument invalid") 15 | QueueSize = 1024 16 | ErrClosed = errors.New("error write on close") 17 | ) 18 | 19 | type Config struct { 20 | TimeTagFormat string 21 | LogPath string 22 | FileName string 23 | LogSuffix string 24 | MaxRemain int 25 | RollingTimePattern string 26 | } 27 | 28 | type Manager interface { 29 | Fire() chan string 30 | Close() 31 | } 32 | 33 | type RollingWriter interface { 34 | io.Writer 35 | Close() error 36 | } 37 | 38 | func FilePath(c *Config) (filepath string) { 39 | filepath = path.Join(c.LogPath, c.FileName) + c.LogSuffix 40 | return 41 | } 42 | -------------------------------------------------------------------------------- /backend/log/dup_write_darwin.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "golang.org/x/sys/unix" 5 | "os" 6 | "runtime" 7 | ) 8 | 9 | var stdErrFileHandler *os.File 10 | 11 | func dupWrite(file *os.File) error { 12 | stdErrFileHandler = file 13 | if err := unix.Dup2(int(file.Fd()), int(os.Stderr.Fd())); err != nil { 14 | return err 15 | } 16 | runtime.SetFinalizer(stdErrFileHandler, func(fd *os.File) { 17 | fd.Close() 18 | }) 19 | return nil 20 | } 21 | -------------------------------------------------------------------------------- /backend/log/dup_write_linux.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "golang.org/x/sys/unix" 5 | "os" 6 | "runtime" 7 | ) 8 | 9 | var stdErrFileHandler *os.File 10 | 11 | func dupWrite(file *os.File) error { 12 | stdErrFileHandler = file 13 | if err := unix.Dup2(int(file.Fd()), int(os.Stderr.Fd())); err != nil { 14 | return err 15 | } 16 | runtime.SetFinalizer(stdErrFileHandler, func(fd *os.File) { 17 | fd.Close() 18 | }) 19 | return nil 20 | } 21 | -------------------------------------------------------------------------------- /backend/log/dup_write_windows.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "os" 5 | ) 6 | 7 | func dupWrite(file *os.File) error { 8 | return nil 9 | } 10 | -------------------------------------------------------------------------------- /backend/log/manager.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "github.com/robfig/cron/v3" 5 | "path" 6 | "sync" 7 | "time" 8 | ) 9 | 10 | type manager struct { 11 | startAt time.Time 12 | fire chan string 13 | cr *cron.Cron 14 | context chan int 15 | wg sync.WaitGroup 16 | lock sync.Mutex 17 | } 18 | 19 | func (m *manager) Fire() chan string { 20 | return m.fire 21 | } 22 | 23 | func (m *manager) Close() { 24 | close(m.context) 25 | m.cr.Stop() 26 | } 27 | 28 | func NewManager(c *Config) (Manager, error) { 29 | m := &manager{ 30 | startAt: time.Now(), 31 | cr: cron.New(), 32 | fire: make(chan string), 33 | context: make(chan int), 34 | wg: sync.WaitGroup{}, 35 | } 36 | 37 | if _, err := m.cr.AddFunc(c.RollingTimePattern, func() { 38 | m.fire <- m.GenLogFileName(c) 39 | }); err != nil { 40 | return nil, err 41 | } 42 | m.cr.Start() 43 | 44 | return m, nil 45 | } 46 | 47 | func (m *manager) GenLogFileName(c *Config) (filename string) { 48 | m.lock.Lock() 49 | filename = path.Join(c.LogPath, c.FileName+"-"+m.startAt.Format(c.TimeTagFormat)) + c.LogSuffix 50 | m.startAt = time.Now() 51 | m.lock.Unlock() 52 | return 53 | } 54 | -------------------------------------------------------------------------------- /backend/middleware/bind_domain.go: -------------------------------------------------------------------------------- 1 | package middleware 2 | 3 | import ( 4 | "strings" 5 | 6 | "github.com/1Panel-dev/1Panel/backend/app/api/v1/helper" 7 | "github.com/1Panel-dev/1Panel/backend/app/repo" 8 | "github.com/1Panel-dev/1Panel/backend/constant" 9 | "github.com/gin-gonic/gin" 10 | ) 11 | 12 | func BindDomain() gin.HandlerFunc { 13 | return func(c *gin.Context) { 14 | settingRepo := repo.NewISettingRepo() 15 | status, err := settingRepo.Get(settingRepo.WithByKey("BindDomain")) 16 | if err != nil { 17 | helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err) 18 | return 19 | } 20 | if len(status.Value) == 0 { 21 | c.Next() 22 | return 23 | } 24 | domains := c.Request.Host 25 | parts := strings.Split(c.Request.Host, ":") 26 | if len(parts) > 0 { 27 | domains = parts[0] 28 | } 29 | 30 | if domains != status.Value { 31 | code := LoadErrCode() 32 | helper.ErrWithHtml(c, code, "err_domain") 33 | return 34 | } 35 | c.Next() 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /backend/middleware/helper.go: -------------------------------------------------------------------------------- 1 | package middleware 2 | 3 | import ( 4 | "net/http" 5 | 6 | "github.com/1Panel-dev/1Panel/backend/app/repo" 7 | ) 8 | 9 | func LoadErrCode() int { 10 | settingRepo := repo.NewISettingRepo() 11 | codeVal, err := settingRepo.Get(settingRepo.WithByKey("NoAuthSetting")) 12 | if err != nil { 13 | return 500 14 | } 15 | 16 | switch codeVal.Value { 17 | case "400": 18 | return http.StatusBadRequest 19 | case "401": 20 | return http.StatusUnauthorized 21 | case "403": 22 | return http.StatusForbidden 23 | case "404": 24 | return http.StatusNotFound 25 | case "408": 26 | return http.StatusRequestTimeout 27 | case "416": 28 | return http.StatusRequestedRangeNotSatisfiable 29 | case "500": 30 | return http.StatusInternalServerError 31 | case "444": 32 | return 444 33 | default: 34 | return http.StatusOK 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /backend/middleware/jwt.go: -------------------------------------------------------------------------------- 1 | package middleware 2 | 3 | import ( 4 | "github.com/1Panel-dev/1Panel/backend/app/api/v1/helper" 5 | "github.com/1Panel-dev/1Panel/backend/constant" 6 | jwtUtils "github.com/1Panel-dev/1Panel/backend/utils/jwt" 7 | 8 | "github.com/gin-gonic/gin" 9 | ) 10 | 11 | func JwtAuth() gin.HandlerFunc { 12 | return func(c *gin.Context) { 13 | token := c.Request.Header.Get(constant.JWTHeaderName) 14 | if token == "" { 15 | c.Next() 16 | return 17 | } 18 | j := jwtUtils.NewJWT() 19 | claims, err := j.ParseToken(token) 20 | if err != nil { 21 | helper.ErrorWithDetail(c, constant.CodeErrUnauthorized, constant.ErrTypeInternalServer, err) 22 | return 23 | } 24 | c.Set("claims", claims) 25 | c.Set("authMethod", constant.AuthMethodJWT) 26 | c.Next() 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /backend/middleware/loading.go: -------------------------------------------------------------------------------- 1 | package middleware 2 | 3 | import ( 4 | "github.com/1Panel-dev/1Panel/backend/app/api/v1/helper" 5 | "github.com/1Panel-dev/1Panel/backend/app/repo" 6 | "github.com/1Panel-dev/1Panel/backend/constant" 7 | "github.com/gin-gonic/gin" 8 | ) 9 | 10 | func GlobalLoading() gin.HandlerFunc { 11 | return func(c *gin.Context) { 12 | settingRepo := repo.NewISettingRepo() 13 | status, err := settingRepo.Get(settingRepo.WithByKey("SystemStatus")) 14 | if err != nil { 15 | helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err) 16 | return 17 | } 18 | if status.Value != "Free" { 19 | helper.ErrorWithDetail(c, constant.CodeGlobalLoading, status.Value, err) 20 | return 21 | } 22 | c.Next() 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /backend/middleware/password_rsa.go: -------------------------------------------------------------------------------- 1 | package middleware 2 | 3 | import ( 4 | "encoding/base64" 5 | "github.com/1Panel-dev/1Panel/backend/app/repo" 6 | "github.com/gin-gonic/gin" 7 | ) 8 | 9 | func SetPasswordPublicKey() gin.HandlerFunc { 10 | return func(c *gin.Context) { 11 | cookieKey, _ := c.Cookie("panel_public_key") 12 | settingRepo := repo.NewISettingRepo() 13 | key, _ := settingRepo.Get(settingRepo.WithByKey("PASSWORD_PUBLIC_KEY")) 14 | base64Key := base64.StdEncoding.EncodeToString([]byte(key.Value)) 15 | if base64Key == cookieKey { 16 | c.Next() 17 | return 18 | } 19 | c.SetCookie("panel_public_key", base64Key, 7*24*60*60, "/", "", false, false) 20 | c.Next() 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /backend/router/common.go: -------------------------------------------------------------------------------- 1 | package router 2 | 3 | func commonGroups() []CommonRouter { 4 | return []CommonRouter{ 5 | &BaseRouter{}, 6 | &DashboardRouter{}, 7 | &HostRouter{}, 8 | &ContainerRouter{}, 9 | &LogRouter{}, 10 | &FileRouter{}, 11 | &ToolboxRouter{}, 12 | &TerminalRouter{}, 13 | &CronjobRouter{}, 14 | &SettingRouter{}, 15 | &AppRouter{}, 16 | &WebsiteRouter{}, 17 | &WebsiteGroupRouter{}, 18 | &WebsiteDnsAccountRouter{}, 19 | &WebsiteAcmeAccountRouter{}, 20 | &WebsiteSSLRouter{}, 21 | &DatabaseRouter{}, 22 | &NginxRouter{}, 23 | &RuntimeRouter{}, 24 | &ProcessRouter{}, 25 | &WebsiteCARouter{}, 26 | &AIToolsRouter{}, 27 | &McpServerRouter{}, 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /backend/router/entry.go: -------------------------------------------------------------------------------- 1 | //go:build !xpack 2 | 3 | package router 4 | 5 | func RouterGroups() []CommonRouter { 6 | return commonGroups() 7 | } 8 | 9 | var RouterGroupApp = RouterGroups() 10 | -------------------------------------------------------------------------------- /backend/router/ro_base.go: -------------------------------------------------------------------------------- 1 | package router 2 | 3 | import ( 4 | v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1" 5 | "github.com/gin-gonic/gin" 6 | ) 7 | 8 | type BaseRouter struct{} 9 | 10 | func (s *BaseRouter) InitRouter(Router *gin.RouterGroup) { 11 | baseRouter := Router.Group("auth") 12 | baseApi := v1.ApiGroupApp.BaseApi 13 | { 14 | baseRouter.GET("/captcha", baseApi.Captcha) 15 | baseRouter.POST("/mfalogin", baseApi.MFALogin) 16 | baseRouter.POST("/login", baseApi.Login) 17 | baseRouter.POST("/logout", baseApi.LogOut) 18 | baseRouter.GET("/demo", baseApi.CheckIsDemo) 19 | baseRouter.GET("/language", baseApi.GetLanguage) 20 | baseRouter.GET("/intl", baseApi.CheckIsIntl) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /backend/router/ro_cronjob.go: -------------------------------------------------------------------------------- 1 | package router 2 | 3 | import ( 4 | v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1" 5 | "github.com/1Panel-dev/1Panel/backend/middleware" 6 | 7 | "github.com/gin-gonic/gin" 8 | ) 9 | 10 | type CronjobRouter struct{} 11 | 12 | func (s *CronjobRouter) InitRouter(Router *gin.RouterGroup) { 13 | cmdRouter := Router.Group("cronjobs"). 14 | Use(middleware.JwtAuth()). 15 | Use(middleware.SessionAuth()). 16 | Use(middleware.PasswordExpired()) 17 | baseApi := v1.ApiGroupApp.BaseApi 18 | { 19 | cmdRouter.POST("", baseApi.CreateCronjob) 20 | cmdRouter.POST("/del", baseApi.DeleteCronjob) 21 | cmdRouter.POST("/update", baseApi.UpdateCronjob) 22 | cmdRouter.POST("/status", baseApi.UpdateCronjobStatus) 23 | cmdRouter.POST("/handle", baseApi.HandleOnce) 24 | cmdRouter.POST("/download", baseApi.TargetDownload) 25 | cmdRouter.POST("/search", baseApi.SearchCronjob) 26 | cmdRouter.POST("/search/records", baseApi.SearchJobRecords) 27 | cmdRouter.POST("/records/log", baseApi.LoadRecordLog) 28 | cmdRouter.POST("/records/clean", baseApi.CleanRecord) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /backend/router/ro_dashboard.go: -------------------------------------------------------------------------------- 1 | package router 2 | 3 | import ( 4 | v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1" 5 | "github.com/1Panel-dev/1Panel/backend/middleware" 6 | 7 | "github.com/gin-gonic/gin" 8 | ) 9 | 10 | type DashboardRouter struct{} 11 | 12 | func (s *DashboardRouter) InitRouter(Router *gin.RouterGroup) { 13 | cmdRouter := Router.Group("dashboard"). 14 | Use(middleware.JwtAuth()). 15 | Use(middleware.SessionAuth()). 16 | Use(middleware.PasswordExpired()) 17 | baseApi := v1.ApiGroupApp.BaseApi 18 | { 19 | cmdRouter.GET("/base/os", baseApi.LoadDashboardOsInfo) 20 | cmdRouter.GET("/base/:ioOption/:netOption", baseApi.LoadDashboardBaseInfo) 21 | cmdRouter.POST("/current", baseApi.LoadDashboardCurrentInfo) 22 | cmdRouter.POST("/system/restart/:operation", baseApi.SystemRestart) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /backend/router/ro_group.go: -------------------------------------------------------------------------------- 1 | package router 2 | 3 | import ( 4 | v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1" 5 | "github.com/1Panel-dev/1Panel/backend/middleware" 6 | "github.com/gin-gonic/gin" 7 | ) 8 | 9 | type WebsiteGroupRouter struct { 10 | } 11 | 12 | func (a *WebsiteGroupRouter) InitRouter(Router *gin.RouterGroup) { 13 | groupRouter := Router.Group("groups") 14 | groupRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth()).Use(middleware.PasswordExpired()) 15 | 16 | baseApi := v1.ApiGroupApp.BaseApi 17 | { 18 | groupRouter.POST("", baseApi.CreateGroup) 19 | groupRouter.POST("/del", baseApi.DeleteGroup) 20 | groupRouter.POST("/update", baseApi.UpdateGroup) 21 | groupRouter.POST("/search", baseApi.ListGroup) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /backend/router/ro_log.go: -------------------------------------------------------------------------------- 1 | package router 2 | 3 | import ( 4 | v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1" 5 | "github.com/1Panel-dev/1Panel/backend/middleware" 6 | 7 | "github.com/gin-gonic/gin" 8 | ) 9 | 10 | type LogRouter struct{} 11 | 12 | func (s *LogRouter) InitRouter(Router *gin.RouterGroup) { 13 | operationRouter := Router.Group("logs") 14 | operationRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth()).Use(middleware.PasswordExpired()) 15 | baseApi := v1.ApiGroupApp.BaseApi 16 | { 17 | operationRouter.POST("/login", baseApi.GetLoginLogs) 18 | operationRouter.POST("/operation", baseApi.GetOperationLogs) 19 | operationRouter.POST("/clean", baseApi.CleanLogs) 20 | operationRouter.GET("/system/files", baseApi.GetSystemFiles) 21 | operationRouter.POST("/system", baseApi.GetSystemLogs) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /backend/router/ro_mcp.go: -------------------------------------------------------------------------------- 1 | package router 2 | 3 | import ( 4 | v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1" 5 | "github.com/1Panel-dev/1Panel/backend/middleware" 6 | "github.com/gin-gonic/gin" 7 | ) 8 | 9 | type McpServerRouter struct { 10 | } 11 | 12 | func (m *McpServerRouter) InitRouter(Router *gin.RouterGroup) { 13 | mcpRouter := Router.Group("mcp") 14 | mcpRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth()).Use(middleware.PasswordExpired()) 15 | 16 | baseApi := v1.ApiGroupApp.BaseApi 17 | { 18 | mcpRouter.POST("/search", baseApi.PageMcpServers) 19 | mcpRouter.POST("/server", baseApi.CreateMcpServer) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /backend/router/ro_nginx.go: -------------------------------------------------------------------------------- 1 | package router 2 | 3 | import ( 4 | v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1" 5 | "github.com/1Panel-dev/1Panel/backend/middleware" 6 | "github.com/gin-gonic/gin" 7 | ) 8 | 9 | type NginxRouter struct { 10 | } 11 | 12 | func (a *NginxRouter) InitRouter(Router *gin.RouterGroup) { 13 | groupRouter := Router.Group("openresty") 14 | groupRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth()).Use(middleware.PasswordExpired()) 15 | 16 | baseApi := v1.ApiGroupApp.BaseApi 17 | { 18 | groupRouter.GET("", baseApi.GetNginx) 19 | groupRouter.POST("/scope", baseApi.GetNginxConfigByScope) 20 | groupRouter.POST("/update", baseApi.UpdateNginxConfigByScope) 21 | groupRouter.GET("/status", baseApi.GetNginxStatus) 22 | groupRouter.POST("/file", baseApi.UpdateNginxFile) 23 | groupRouter.POST("/clear", baseApi.ClearNginxProxyCache) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /backend/router/ro_process.go: -------------------------------------------------------------------------------- 1 | package router 2 | 3 | import ( 4 | v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1" 5 | "github.com/1Panel-dev/1Panel/backend/middleware" 6 | "github.com/gin-gonic/gin" 7 | ) 8 | 9 | type ProcessRouter struct { 10 | } 11 | 12 | func (f *ProcessRouter) InitRouter(Router *gin.RouterGroup) { 13 | processRouter := Router.Group("process") 14 | processRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth()).Use(middleware.PasswordExpired()) 15 | baseApi := v1.ApiGroupApp.BaseApi 16 | { 17 | processRouter.GET("/ws", baseApi.ProcessWs) 18 | processRouter.POST("/stop", baseApi.StopProcess) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /backend/router/ro_router.go: -------------------------------------------------------------------------------- 1 | package router 2 | 3 | import "github.com/gin-gonic/gin" 4 | 5 | type CommonRouter interface { 6 | InitRouter(Router *gin.RouterGroup) 7 | } 8 | -------------------------------------------------------------------------------- /backend/router/ro_terminal.go: -------------------------------------------------------------------------------- 1 | package router 2 | 3 | import ( 4 | v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1" 5 | "github.com/1Panel-dev/1Panel/backend/middleware" 6 | 7 | "github.com/gin-gonic/gin" 8 | ) 9 | 10 | type TerminalRouter struct{} 11 | 12 | func (s *TerminalRouter) InitRouter(Router *gin.RouterGroup) { 13 | terminalRouter := Router.Group("terminals"). 14 | Use(middleware.JwtAuth()). 15 | Use(middleware.SessionAuth()). 16 | Use(middleware.PasswordExpired()) 17 | baseApi := v1.ApiGroupApp.BaseApi 18 | { 19 | terminalRouter.GET("", baseApi.WsSsh) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /backend/router/ro_website_acme_account.go: -------------------------------------------------------------------------------- 1 | package router 2 | 3 | import ( 4 | v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1" 5 | "github.com/1Panel-dev/1Panel/backend/middleware" 6 | "github.com/gin-gonic/gin" 7 | ) 8 | 9 | type WebsiteAcmeAccountRouter struct { 10 | } 11 | 12 | func (a *WebsiteAcmeAccountRouter) InitRouter(Router *gin.RouterGroup) { 13 | groupRouter := Router.Group("websites/acme") 14 | groupRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth()).Use(middleware.PasswordExpired()) 15 | 16 | baseApi := v1.ApiGroupApp.BaseApi 17 | { 18 | groupRouter.POST("/search", baseApi.PageWebsiteAcmeAccount) 19 | groupRouter.POST("", baseApi.CreateWebsiteAcmeAccount) 20 | groupRouter.POST("/del", baseApi.DeleteWebsiteAcmeAccount) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /backend/router/ro_website_ca.go: -------------------------------------------------------------------------------- 1 | package router 2 | 3 | import ( 4 | v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1" 5 | "github.com/1Panel-dev/1Panel/backend/middleware" 6 | "github.com/gin-gonic/gin" 7 | ) 8 | 9 | type WebsiteCARouter struct { 10 | } 11 | 12 | func (a *WebsiteCARouter) InitRouter(Router *gin.RouterGroup) { 13 | groupRouter := Router.Group("websites/ca") 14 | groupRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth()).Use(middleware.PasswordExpired()) 15 | 16 | baseApi := v1.ApiGroupApp.BaseApi 17 | { 18 | groupRouter.POST("/search", baseApi.PageWebsiteCA) 19 | groupRouter.POST("", baseApi.CreateWebsiteCA) 20 | groupRouter.POST("/del", baseApi.DeleteWebsiteCA) 21 | groupRouter.POST("/obtain", baseApi.ObtainWebsiteCA) 22 | groupRouter.POST("/renew", baseApi.RenewWebsiteCA) 23 | groupRouter.GET("/:id", baseApi.GetWebsiteCA) 24 | groupRouter.POST("/download", baseApi.DownloadCAFile) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /backend/router/ro_website_dns_account.go: -------------------------------------------------------------------------------- 1 | package router 2 | 3 | import ( 4 | v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1" 5 | "github.com/1Panel-dev/1Panel/backend/middleware" 6 | "github.com/gin-gonic/gin" 7 | ) 8 | 9 | type WebsiteDnsAccountRouter struct { 10 | } 11 | 12 | func (a *WebsiteDnsAccountRouter) InitRouter(Router *gin.RouterGroup) { 13 | groupRouter := Router.Group("websites/dns") 14 | groupRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth()).Use(middleware.PasswordExpired()) 15 | 16 | baseApi := v1.ApiGroupApp.BaseApi 17 | { 18 | groupRouter.POST("/search", baseApi.PageWebsiteDnsAccount) 19 | groupRouter.POST("", baseApi.CreateWebsiteDnsAccount) 20 | groupRouter.POST("/update", baseApi.UpdateWebsiteDnsAccount) 21 | groupRouter.POST("/del", baseApi.DeleteWebsiteDnsAccount) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /backend/router/ro_website_ssl.go: -------------------------------------------------------------------------------- 1 | package router 2 | 3 | import ( 4 | v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1" 5 | "github.com/1Panel-dev/1Panel/backend/middleware" 6 | "github.com/gin-gonic/gin" 7 | ) 8 | 9 | type WebsiteSSLRouter struct { 10 | } 11 | 12 | func (a *WebsiteSSLRouter) InitRouter(Router *gin.RouterGroup) { 13 | groupRouter := Router.Group("websites/ssl") 14 | groupRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth()).Use(middleware.PasswordExpired()) 15 | 16 | baseApi := v1.ApiGroupApp.BaseApi 17 | { 18 | groupRouter.POST("/search", baseApi.PageWebsiteSSL) 19 | groupRouter.POST("", baseApi.CreateWebsiteSSL) 20 | groupRouter.POST("/resolve", baseApi.GetDNSResolve) 21 | groupRouter.POST("/del", baseApi.DeleteWebsiteSSL) 22 | groupRouter.GET("/website/:websiteId", baseApi.GetWebsiteSSLByWebsiteId) 23 | groupRouter.GET("/:id", baseApi.GetWebsiteSSLById) 24 | groupRouter.POST("/update", baseApi.UpdateWebsiteSSL) 25 | groupRouter.POST("/upload", baseApi.UploadWebsiteSSL) 26 | groupRouter.POST("/obtain", baseApi.ApplyWebsiteSSL) 27 | groupRouter.POST("/download", baseApi.DownloadWebsiteSSL) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /backend/server/init.go: -------------------------------------------------------------------------------- 1 | //go:build !xpack 2 | 3 | package server 4 | 5 | func InitOthers() { 6 | } 7 | -------------------------------------------------------------------------------- /backend/utils/ai_tools/gpu/common/gpu_info.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | type GpuInfo struct { 4 | CudaVersion string `json:"cudaVersion"` 5 | DriverVersion string `json:"driverVersion"` 6 | Type string `json:"type"` 7 | 8 | GPUs []GPU `json:"gpu"` 9 | } 10 | 11 | type GPU struct { 12 | Index uint `json:"index"` 13 | ProductName string `json:"productName"` 14 | PersistenceMode string `json:"persistenceMode"` 15 | BusID string `json:"busID"` 16 | DisplayActive string `json:"displayActive"` 17 | ECC string `json:"ecc"` 18 | FanSpeed string `json:"fanSpeed"` 19 | 20 | Temperature string `json:"temperature"` 21 | PerformanceState string `json:"performanceState"` 22 | PowerDraw string `json:"powerDraw"` 23 | MaxPowerLimit string `json:"maxPowerLimit"` 24 | MemUsed string `json:"memUsed"` 25 | MemTotal string `json:"memTotal"` 26 | GPUUtil string `json:"gpuUtil"` 27 | ComputeMode string `json:"computeMode"` 28 | MigMode string `json:"migMode"` 29 | Processes []Process `json:"processes"` 30 | } 31 | 32 | type Process struct { 33 | Pid string `json:"pid"` 34 | Type string `json:"type"` 35 | ProcessName string `json:"processName"` 36 | UsedMemory string `json:"usedMemory"` 37 | } 38 | -------------------------------------------------------------------------------- /backend/utils/captcha/captcha.go: -------------------------------------------------------------------------------- 1 | package captcha 2 | 3 | import ( 4 | "strings" 5 | 6 | "github.com/1Panel-dev/1Panel/backend/app/dto" 7 | "github.com/1Panel-dev/1Panel/backend/constant" 8 | "github.com/mojocn/base64Captcha" 9 | ) 10 | 11 | var store = base64Captcha.DefaultMemStore 12 | 13 | func VerifyCode(codeID string, code string) error { 14 | if codeID == "" { 15 | return constant.ErrCaptchaCode 16 | } 17 | vv := store.Get(codeID, true) 18 | vv = strings.TrimSpace(vv) 19 | code = strings.TrimSpace(code) 20 | 21 | if strings.EqualFold(vv, code) { 22 | return nil 23 | } 24 | return constant.ErrCaptchaCode 25 | } 26 | 27 | func CreateCaptcha() (*dto.CaptchaResponse, error) { 28 | var driverString base64Captcha.DriverString 29 | driverString.Source = "1234567890QWERTYUPLKJHGFDSAZXCVBNMqwertyupkjhgfdsazxcvbnm" 30 | driverString.Width = 120 31 | driverString.Height = 50 32 | driverString.NoiseCount = 0 33 | driverString.Length = 4 34 | driverString.Fonts = []string{"RitaSmith.ttf", "actionj.ttf", "chromohv.ttf"} 35 | driver := driverString.ConvertFonts() 36 | c := base64Captcha.NewCaptcha(driver, store) 37 | id, b64s, _, err := c.Generate() 38 | if err != nil { 39 | return nil, err 40 | } 41 | return &dto.CaptchaResponse{ 42 | CaptchaID: id, 43 | ImagePath: b64s, 44 | }, nil 45 | } 46 | -------------------------------------------------------------------------------- /backend/utils/cloud_storage/client/helper.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/1Panel-dev/1Panel/backend/global" 7 | ) 8 | 9 | func loadParamFromVars(key string, vars map[string]interface{}) string { 10 | if _, ok := vars[key]; !ok { 11 | if key != "bucket" && key != "port" { 12 | global.LOG.Errorf("load param %s from vars failed, err: not exist!", key) 13 | } 14 | return "" 15 | } 16 | 17 | return fmt.Sprintf("%v", vars[key]) 18 | } 19 | -------------------------------------------------------------------------------- /backend/utils/compose/compose.go: -------------------------------------------------------------------------------- 1 | package compose 2 | 3 | import ( 4 | "github.com/1Panel-dev/1Panel/backend/utils/cmd" 5 | ) 6 | 7 | func Pull(filePath string) (string, error) { 8 | stdout, err := cmd.Execf("docker-compose -f %s pull", filePath) 9 | return stdout, err 10 | } 11 | 12 | func Up(filePath string) (string, error) { 13 | stdout, err := cmd.Execf("docker-compose -f %s up -d", filePath) 14 | return stdout, err 15 | } 16 | 17 | func Down(filePath string) (string, error) { 18 | stdout, err := cmd.Execf("docker-compose -f %s down --remove-orphans", filePath) 19 | return stdout, err 20 | } 21 | 22 | func Start(filePath string) (string, error) { 23 | stdout, err := cmd.Execf("docker-compose -f %s start", filePath) 24 | return stdout, err 25 | } 26 | 27 | func Stop(filePath string) (string, error) { 28 | stdout, err := cmd.Execf("docker-compose -f %s stop", filePath) 29 | return stdout, err 30 | } 31 | 32 | func Restart(filePath string) (string, error) { 33 | stdout, err := cmd.Execf("docker-compose -f %s restart", filePath) 34 | return stdout, err 35 | } 36 | 37 | func Operate(filePath, operation string) (string, error) { 38 | stdout, err := cmd.Execf("docker-compose -f %s %s", filePath, operation) 39 | return stdout, err 40 | } 41 | -------------------------------------------------------------------------------- /backend/utils/copier/copier.go: -------------------------------------------------------------------------------- 1 | package copier 2 | 3 | import ( 4 | "encoding/json" 5 | 6 | "github.com/pkg/errors" 7 | ) 8 | 9 | func Copy(to, from interface{}) error { 10 | b, err := json.Marshal(from) 11 | if err != nil { 12 | return errors.Wrap(err, "marshal from data err") 13 | } 14 | if err = json.Unmarshal(b, to); err != nil { 15 | return errors.Wrap(err, "unmarshal to data err") 16 | } 17 | return nil 18 | } 19 | -------------------------------------------------------------------------------- /backend/utils/env/env.go: -------------------------------------------------------------------------------- 1 | package env 2 | 3 | import ( 4 | "fmt" 5 | "github.com/joho/godotenv" 6 | "os" 7 | "sort" 8 | "strconv" 9 | "strings" 10 | ) 11 | 12 | func Write(envMap map[string]string, filename string) error { 13 | content, err := Marshal(envMap) 14 | if err != nil { 15 | return err 16 | } 17 | file, err := os.Create(filename) 18 | if err != nil { 19 | return err 20 | } 21 | defer file.Close() 22 | _, err = file.WriteString(content + "\n") 23 | if err != nil { 24 | return err 25 | } 26 | return file.Sync() 27 | } 28 | 29 | func Marshal(envMap map[string]string) (string, error) { 30 | lines := make([]string, 0, len(envMap)) 31 | for k, v := range envMap { 32 | if d, err := strconv.Atoi(v); err == nil { 33 | lines = append(lines, fmt.Sprintf(`%s=%d`, k, d)) 34 | } else { 35 | lines = append(lines, fmt.Sprintf(`%s="%s"`, k, v)) 36 | } 37 | } 38 | sort.Strings(lines) 39 | return strings.Join(lines, "\n"), nil 40 | } 41 | 42 | func GetEnvValueByKey(envPath, key string) (string, error) { 43 | envMap, err := godotenv.Read(envPath) 44 | if err != nil { 45 | return "", err 46 | } 47 | value, ok := envMap[key] 48 | if !ok { 49 | return "", fmt.Errorf("key %s not found in %s", key, envPath) 50 | } 51 | return value, nil 52 | } 53 | -------------------------------------------------------------------------------- /backend/utils/files/archiver.go: -------------------------------------------------------------------------------- 1 | package files 2 | 3 | import ( 4 | "github.com/1Panel-dev/1Panel/backend/buserr" 5 | "github.com/1Panel-dev/1Panel/backend/constant" 6 | "github.com/1Panel-dev/1Panel/backend/utils/cmd" 7 | ) 8 | 9 | type ShellArchiver interface { 10 | Extract(filePath, dstDir string, secret string) error 11 | Compress(sourcePaths []string, dstFile string, secret string) error 12 | } 13 | 14 | func NewShellArchiver(compressType CompressType) (ShellArchiver, error) { 15 | switch compressType { 16 | case Tar: 17 | if err := checkCmdAvailability("tar"); err != nil { 18 | return nil, err 19 | } 20 | return NewTarArchiver(compressType), nil 21 | case TarGz: 22 | return NewTarGzArchiver(), nil 23 | case Zip: 24 | if err := checkCmdAvailability("zip"); err != nil { 25 | return nil, err 26 | } 27 | return NewZipArchiver(), nil 28 | default: 29 | return nil, buserr.New("unsupported compress type") 30 | } 31 | } 32 | 33 | func checkCmdAvailability(cmdStr string) error { 34 | if cmd.Which(cmdStr) { 35 | return nil 36 | } 37 | return buserr.WithName(constant.ErrCmdNotFound, cmdStr) 38 | } 39 | -------------------------------------------------------------------------------- /backend/utils/files/tar.go: -------------------------------------------------------------------------------- 1 | package files 2 | 3 | import ( 4 | "fmt" 5 | "github.com/1Panel-dev/1Panel/backend/utils/cmd" 6 | ) 7 | 8 | type TarArchiver struct { 9 | Cmd string 10 | CompressType CompressType 11 | } 12 | 13 | func NewTarArchiver(compressType CompressType) ShellArchiver { 14 | return &TarArchiver{ 15 | Cmd: "tar", 16 | CompressType: compressType, 17 | } 18 | } 19 | 20 | func (t TarArchiver) Extract(FilePath string, dstDir string, secret string) error { 21 | return cmd.ExecCmd(fmt.Sprintf("%s %s \"%s\" -C \"%s\"", t.Cmd, t.getOptionStr("extract"), FilePath, dstDir)) 22 | } 23 | 24 | func (t TarArchiver) Compress(sourcePaths []string, dstFile string, secret string) error { 25 | return nil 26 | } 27 | 28 | func (t TarArchiver) getOptionStr(Option string) string { 29 | switch t.CompressType { 30 | case Tar: 31 | if Option == "compress" { 32 | return "cvf" 33 | } else { 34 | return "xf" 35 | } 36 | } 37 | return "" 38 | } 39 | -------------------------------------------------------------------------------- /backend/utils/firewall/client.go: -------------------------------------------------------------------------------- 1 | package firewall 2 | 3 | import ( 4 | "github.com/1Panel-dev/1Panel/backend/buserr" 5 | "github.com/1Panel-dev/1Panel/backend/constant" 6 | "github.com/1Panel-dev/1Panel/backend/utils/cmd" 7 | "github.com/1Panel-dev/1Panel/backend/utils/firewall/client" 8 | ) 9 | 10 | type FirewallClient interface { 11 | Name() string // ufw firewalld 12 | Start() error 13 | Stop() error 14 | Restart() error 15 | Reload() error 16 | Status() (string, error) // running not running 17 | Version() (string, error) 18 | 19 | ListPort() ([]client.FireInfo, error) 20 | ListForward() ([]client.FireInfo, error) 21 | ListAddress() ([]client.FireInfo, error) 22 | 23 | Port(port client.FireInfo, operation string) error 24 | RichRules(rule client.FireInfo, operation string) error 25 | PortForward(info client.Forward, operation string) error 26 | 27 | EnableForward() error 28 | } 29 | 30 | func NewFirewallClient() (FirewallClient, error) { 31 | firewalld := cmd.Which("firewalld") 32 | ufw := cmd.Which("ufw") 33 | 34 | if firewalld && ufw { 35 | return nil, buserr.New(constant.ErrFirewallBoth) 36 | } 37 | 38 | if firewalld { 39 | return client.NewFirewalld() 40 | } 41 | if ufw { 42 | return client.NewUfw() 43 | } 44 | return nil, buserr.New(constant.ErrFirewallNone) 45 | } 46 | -------------------------------------------------------------------------------- /backend/utils/geo/geo.go: -------------------------------------------------------------------------------- 1 | package geo 2 | 3 | import ( 4 | "github.com/1Panel-dev/1Panel/backend/global" 5 | "github.com/oschwald/maxminddb-golang" 6 | "net" 7 | "path" 8 | ) 9 | 10 | type Location struct { 11 | En string `maxminddb:"en"` 12 | Zh string `maxminddb:"zh"` 13 | } 14 | 15 | type LocationRes struct { 16 | Iso string `maxminddb:"iso"` 17 | Country Location `maxminddb:"country"` 18 | Latitude float64 `maxminddb:"latitude"` 19 | Longitude float64 `maxminddb:"longitude"` 20 | Province Location `maxminddb:"province"` 21 | } 22 | 23 | func GetIPLocation(ip, lang string) (string, error) { 24 | geoPath := path.Join(global.CONF.System.BaseDir, "1panel", "geo", "GeoIP.mmdb") 25 | reader, err := maxminddb.Open(geoPath) 26 | if err != nil { 27 | return "", err 28 | } 29 | var geoLocation LocationRes 30 | ipNet := net.ParseIP(ip) 31 | err = reader.Lookup(ipNet, &geoLocation) 32 | if err != nil { 33 | return "", err 34 | } 35 | if lang == "zh" { 36 | return geoLocation.Country.Zh + " " + geoLocation.Province.Zh, nil 37 | } 38 | return geoLocation.Country.En + " " + geoLocation.Province.En, nil 39 | } 40 | -------------------------------------------------------------------------------- /backend/utils/ini_conf/ini.go: -------------------------------------------------------------------------------- 1 | package ini_conf 2 | 3 | import "gopkg.in/ini.v1" 4 | 5 | func GetIniValue(filePath, Group, Key string) (string, error) { 6 | cfg, err := ini.Load(filePath) 7 | if err != nil { 8 | return "", err 9 | } 10 | service, err := cfg.GetSection(Group) 11 | if err != nil { 12 | return "", err 13 | } 14 | startKey, err := service.GetKey(Key) 15 | if err != nil { 16 | return "", err 17 | } 18 | return startKey.Value(), nil 19 | } 20 | -------------------------------------------------------------------------------- /backend/utils/mfa/mfa.go: -------------------------------------------------------------------------------- 1 | package mfa 2 | 3 | import ( 4 | "bytes" 5 | "encoding/base64" 6 | "strconv" 7 | "time" 8 | 9 | "github.com/1Panel-dev/1Panel/backend/global" 10 | "github.com/skip2/go-qrcode" 11 | "github.com/xlzd/gotp" 12 | ) 13 | 14 | const secretLength = 16 15 | 16 | type Otp struct { 17 | Secret string `json:"secret"` 18 | QrImage string `json:"qrImage"` 19 | } 20 | 21 | func GetOtp(username, title string, interval int) (otp Otp, err error) { 22 | secret := gotp.RandomSecret(secretLength) 23 | otp.Secret = secret 24 | totp := gotp.NewTOTP(secret, 6, interval, nil) 25 | uri := totp.ProvisioningUri(username, title) 26 | subImg, err := qrcode.Encode(uri, qrcode.Medium, 256) 27 | dist := make([]byte, 3000) 28 | base64.StdEncoding.Encode(dist, subImg) 29 | index := bytes.IndexByte(dist, 0) 30 | baseImage := dist[0:index] 31 | otp.QrImage = "data:image/png;base64," + string(baseImage) 32 | return 33 | } 34 | 35 | func ValidCode(code, intervalStr, secret string) bool { 36 | interval, err := strconv.Atoi(intervalStr) 37 | if err != nil { 38 | global.LOG.Errorf("type conversion failed, err: %v", err) 39 | return false 40 | } 41 | totp := gotp.NewTOTP(secret, 6, interval, nil) 42 | now := time.Now().Unix() 43 | prevTime := now - int64(interval) 44 | return totp.Verify(code, now) || totp.Verify(code, prevTime) 45 | } 46 | -------------------------------------------------------------------------------- /backend/utils/nginx/components/comment.go: -------------------------------------------------------------------------------- 1 | package components 2 | 3 | type Comment struct { 4 | Detail string 5 | Line int 6 | } 7 | 8 | func (c *Comment) GetName() string { 9 | return "" 10 | } 11 | 12 | func (c *Comment) GetParameters() []string { 13 | return []string{} 14 | } 15 | 16 | func (c *Comment) GetBlock() IBlock { 17 | return nil 18 | } 19 | 20 | func (c *Comment) GetComment() string { 21 | return c.Detail 22 | } 23 | 24 | func (c *Comment) GetLine() int { 25 | return c.Line 26 | } 27 | -------------------------------------------------------------------------------- /backend/utils/nginx/components/config.go: -------------------------------------------------------------------------------- 1 | package components 2 | 3 | type Config struct { 4 | *Block 5 | FilePath string 6 | } 7 | 8 | func (c *Config) FindServers() []*Server { 9 | var servers []*Server 10 | directives := c.Block.FindDirectives("server") 11 | for _, directive := range directives { 12 | servers = append(servers, directive.(*Server)) 13 | } 14 | return servers 15 | } 16 | 17 | func (c *Config) FindHttp() *Http { 18 | var http *Http 19 | directives := c.Block.FindDirectives("http") 20 | if len(directives) > 0 { 21 | http = directives[0].(*Http) 22 | } 23 | 24 | return http 25 | } 26 | 27 | var repeatKeys = map[string]struct { 28 | }{ 29 | "limit_conn": {}, 30 | "limit_conn_zone": {}, 31 | "set": {}, 32 | "if": {}, 33 | "proxy_set_header": {}, 34 | "location": {}, 35 | "include": {}, 36 | "sub_filter": {}, 37 | "add_header": {}, 38 | "error_page": {}, 39 | } 40 | 41 | func IsRepeatKey(key string) bool { 42 | if _, ok := repeatKeys[key]; ok { 43 | return true 44 | } 45 | return false 46 | } 47 | -------------------------------------------------------------------------------- /backend/utils/nginx/components/directive.go: -------------------------------------------------------------------------------- 1 | package components 2 | 3 | type Directive struct { 4 | Line int 5 | Block IBlock 6 | Name string 7 | Comment string 8 | Parameters []string 9 | } 10 | 11 | func (d *Directive) GetComment() string { 12 | return d.Comment 13 | } 14 | 15 | func (d *Directive) GetName() string { 16 | return d.Name 17 | } 18 | 19 | func (d *Directive) GetParameters() []string { 20 | return d.Parameters 21 | } 22 | 23 | func (d *Directive) GetBlock() IBlock { 24 | return d.Block 25 | } 26 | 27 | func (d *Directive) GetLine() int { 28 | return d.Line 29 | } 30 | -------------------------------------------------------------------------------- /backend/utils/nginx/components/statement.go: -------------------------------------------------------------------------------- 1 | package components 2 | 3 | type IBlock interface { 4 | GetDirectives() []IDirective 5 | FindDirectives(directiveName string) []IDirective 6 | RemoveDirective(name string, params []string) 7 | UpdateDirective(name string, params []string) 8 | GetComment() string 9 | GetLine() int 10 | GetCodeBlock() string 11 | } 12 | 13 | type IDirective interface { 14 | GetName() string 15 | GetParameters() []string 16 | GetBlock() IBlock 17 | GetComment() string 18 | GetLine() int 19 | } 20 | -------------------------------------------------------------------------------- /backend/utils/nginx/parser/flag/flag.go: -------------------------------------------------------------------------------- 1 | package flag 2 | 3 | type Type int 4 | 5 | const ( 6 | EOF Type = iota 7 | Eol 8 | Keyword 9 | QuotedString 10 | Variable 11 | BlockStart 12 | BlockEnd 13 | Semicolon 14 | Comment 15 | Illegal 16 | Regex 17 | LuaCode 18 | ) 19 | 20 | var ( 21 | FlagName = map[Type]string{ 22 | QuotedString: "QuotedString", 23 | EOF: "Eof", 24 | Keyword: "Keyword", 25 | Variable: "Variable", 26 | BlockStart: "BlockStart", 27 | BlockEnd: "BlockEnd", 28 | Semicolon: "Semicolon", 29 | Comment: "Comment", 30 | Illegal: "Illegal", 31 | Regex: "Regex", 32 | } 33 | ) 34 | 35 | func (tt Type) String() string { 36 | return FlagName[tt] 37 | } 38 | 39 | type Flag struct { 40 | Type Type 41 | Literal string 42 | Line int 43 | Column int 44 | } 45 | 46 | func (t Flag) Lit(literal string) Flag { 47 | t.Literal = literal 48 | return t 49 | } 50 | 51 | type Flags []Flag 52 | 53 | func (t Flag) Is(typ Type) bool { 54 | return t.Type == typ 55 | } 56 | 57 | func (t Flag) IsParameterEligible() bool { 58 | return t.Is(Keyword) || t.Is(QuotedString) || t.Is(Variable) || t.Is(Regex) 59 | } 60 | -------------------------------------------------------------------------------- /backend/utils/redis/redis.go: -------------------------------------------------------------------------------- 1 | package redis 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/1Panel-dev/1Panel/backend/global" 7 | "github.com/go-redis/redis" 8 | ) 9 | 10 | type DBInfo struct { 11 | Address string `json:"address"` 12 | Port uint `json:"port"` 13 | Password string `json:"password"` 14 | } 15 | 16 | func NewRedisClient(conn DBInfo) (*redis.Client, error) { 17 | client := redis.NewClient(&redis.Options{ 18 | Addr: fmt.Sprintf("%s:%v", conn.Address, conn.Port), 19 | Password: conn.Password, 20 | DB: 0, 21 | }) 22 | 23 | if _, err := client.Ping().Result(); err != nil { 24 | global.LOG.Errorf("check redis conn failed, err: %v", err) 25 | return client, err 26 | } 27 | return client, nil 28 | } 29 | -------------------------------------------------------------------------------- /backend/utils/websocket/client.go: -------------------------------------------------------------------------------- 1 | package websocket 2 | 3 | import ( 4 | "github.com/gorilla/websocket" 5 | ) 6 | 7 | type Client struct { 8 | ID string 9 | Socket *websocket.Conn 10 | Msg chan []byte 11 | } 12 | 13 | func NewWsClient(ID string, socket *websocket.Conn) *Client { 14 | return &Client{ 15 | ID: ID, 16 | Socket: socket, 17 | Msg: make(chan []byte, 100), 18 | } 19 | } 20 | 21 | func (c *Client) Read() { 22 | defer func() { 23 | close(c.Msg) 24 | }() 25 | for { 26 | _, message, err := c.Socket.ReadMessage() 27 | if err != nil { 28 | return 29 | } 30 | ProcessData(c, message) 31 | } 32 | } 33 | 34 | func (c *Client) Write() { 35 | defer func() { 36 | c.Socket.Close() 37 | }() 38 | for { 39 | message, ok := <-c.Msg 40 | if !ok { 41 | return 42 | } 43 | _ = c.Socket.WriteMessage(websocket.TextMessage, message) 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /ci/script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | command -v wget >/dev/null || { 4 | echo "wget not found, please install it and try again ." 5 | exit 1 6 | } 7 | 8 | if [ ! -f "1pctl" ]; then 9 | wget https://github.com/1Panel-dev/installer/raw/main/1pctl 10 | fi 11 | 12 | if [ ! -f "install.sh" ]; then 13 | wget https://github.com/1Panel-dev/installer/raw/main/install.sh 14 | fi 15 | 16 | if [ ! -d "initscript" ]; then 17 | mkdir -p initscript && cd initscript 18 | for file in 1panel.service 1paneld.init 1paneld.openrc 1paneld.procd; do 19 | wget -q https://github.com/1Panel-dev/installer/raw/main/initscript/$file 20 | done 21 | cd .. 22 | fi 23 | 24 | if [ ! -d "lang" ]; then 25 | mkdir -p lang && cd lang 26 | for lang in en fa pt-BR ru zh; do 27 | wget -q https://github.com/1Panel-dev/installer/raw/main/lang/$lang.sh 28 | done 29 | cd .. 30 | fi 31 | 32 | if [ ! -f "GeoIP.mmdb" ]; then 33 | wget https://resource.fit2cloud.com/1panel/package/geo/GeoIP.mmdb 34 | fi 35 | 36 | chmod 755 1pctl install.sh 37 | -------------------------------------------------------------------------------- /cmd/server/app/app_config.go: -------------------------------------------------------------------------------- 1 | package app 2 | 3 | import ( 4 | _ "embed" 5 | ) 6 | 7 | //go:embed app_config.yml 8 | var Config []byte 9 | 10 | //go:embed logo.png 11 | var Logo []byte 12 | 13 | //go:embed app_param.yml 14 | var Param []byte 15 | -------------------------------------------------------------------------------- /cmd/server/app/app_config.yml: -------------------------------------------------------------------------------- 1 | additionalProperties: 2 | key: # The application's key, limited to English, used to create a folder in Linux 3 | name: # Application name 4 | tags: 5 | - Tool # Application tags, multiple tags are allowed. Refer to the tag list below 6 | shortDescZh: # Application description in Chinese, no more than 30 characters 7 | shortDescEn: # Application description in English 8 | type: tool # Application type, different from application category, only one is allowed. Refer to the type list below 9 | crossVersionUpdate: # Whether cross-major-version upgrades are supported 10 | limit: # Application installation limit, 0 means no limit 11 | website: # Official website address 12 | github: # GitHub address 13 | document: # Documentation address 14 | -------------------------------------------------------------------------------- /cmd/server/app/app_param.yml: -------------------------------------------------------------------------------- 1 | additionalProperties: 2 | formFields: 3 | - default: 8080 4 | edit: true 5 | envKey: PANEL_APP_PORT_HTTP 6 | labelEn: Port 7 | labelZh: 端口 8 | required: true 9 | rule: paramPort 10 | type: number 11 | -------------------------------------------------------------------------------- /cmd/server/app/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1Panel-dev/1Panel/6ae150b64ec4ef5026a14f0ec79f7014e414d2ff/cmd/server/app/logo.png -------------------------------------------------------------------------------- /cmd/server/cmd/version.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/1Panel-dev/1Panel/backend/configs" 7 | "github.com/1Panel-dev/1Panel/backend/i18n" 8 | "github.com/1Panel-dev/1Panel/cmd/server/conf" 9 | "gopkg.in/yaml.v3" 10 | 11 | "github.com/spf13/cobra" 12 | ) 13 | 14 | func init() { 15 | RootCmd.AddCommand(versionCmd) 16 | } 17 | 18 | var versionCmd = &cobra.Command{ 19 | Use: "version", 20 | RunE: func(cmd *cobra.Command, args []string) error { 21 | i18n.UseI18nForCmd(language) 22 | if !isRoot() { 23 | fmt.Println(i18n.GetMsgWithMapForCmd("SudoHelper", map[string]interface{}{"cmd": "sudo 1pctl version"})) 24 | return nil 25 | } 26 | db, err := loadDBConn() 27 | if err != nil { 28 | return err 29 | } 30 | version := getSettingByKey(db, "SystemVersion") 31 | 32 | fmt.Println(i18n.GetMsgByKeyForCmd("SystemVersion") + version) 33 | config := configs.ServerConfig{} 34 | if err := yaml.Unmarshal(conf.AppYaml, &config); err != nil { 35 | return fmt.Errorf("unmarshal conf.App.Yaml failed, err: %v", err) 36 | } else { 37 | fmt.Println(i18n.GetMsgByKeyForCmd("SystemMode") + config.System.Mode) 38 | } 39 | return nil 40 | }, 41 | } 42 | -------------------------------------------------------------------------------- /cmd/server/conf/app.yaml: -------------------------------------------------------------------------------- 1 | system: 2 | db_file: 1Panel.db 3 | base_dir: /opt 4 | mode: dev 5 | repo_url: https://resource.1panel.pro 6 | app_repo: https://apps.1panel.pro 7 | is_demo: false 8 | is_intl: true 9 | port: 9999 10 | username: admin 11 | password: admin123 12 | 13 | log: 14 | level: debug 15 | time_zone: Asia/Shanghai 16 | log_name: 1Panel 17 | log_suffix: .log 18 | max_backup: 10 19 | -------------------------------------------------------------------------------- /cmd/server/conf/conf.go: -------------------------------------------------------------------------------- 1 | package conf 2 | 3 | import _ "embed" 4 | 5 | //go:embed app.yaml 6 | var AppYaml []byte 7 | -------------------------------------------------------------------------------- /cmd/server/docs/swagger.go: -------------------------------------------------------------------------------- 1 | package docs 2 | 3 | import _ "embed" 4 | 5 | //go:embed swagger.json 6 | var SwaggerJson []byte 7 | -------------------------------------------------------------------------------- /cmd/server/mcp/compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | mcp-server: 3 | image: supercorp/supergateway:latest 4 | container_name: ${CONTAINER_NAME} 5 | restart: unless-stopped 6 | ports: 7 | - "${HOST_IP}:${PANEL_APP_PORT_HTTP}:${PANEL_APP_PORT_HTTP}" 8 | command: [ 9 | "--stdio", "${COMMAND}", 10 | "--port", "${PANEL_APP_PORT_HTTP}", 11 | "--baseUrl", "${BASE_URL}", 12 | "--ssePath", "${SSE_PATH}", 13 | "--messagePath", "${SSE_PATH}/messages" 14 | ] 15 | networks: 16 | - 1panel-network 17 | networks: 18 | 1panel-network: 19 | external: true -------------------------------------------------------------------------------- /cmd/server/mcp/mcp.go: -------------------------------------------------------------------------------- 1 | package mcp 2 | 3 | import ( 4 | _ "embed" 5 | ) 6 | 7 | //go:embed compose.yml 8 | var DefaultMcpCompose []byte 9 | -------------------------------------------------------------------------------- /cmd/server/nginx_conf/404.html: -------------------------------------------------------------------------------- 1 | 2 |