InPanel 1.2.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. inpanel/__init__.py +29 -0
  2. inpanel/acme.py +289 -0
  3. inpanel/aliyuncs.py +269 -0
  4. inpanel/app.py +514 -0
  5. inpanel/apt.py +223 -0
  6. inpanel/base.py +200 -0
  7. inpanel/config.py +139 -0
  8. inpanel/data/config.ini +29 -0
  9. inpanel/data/history +5 -0
  10. inpanel/data/runlogs.ini +12 -0
  11. inpanel/data/update_info.ini +4 -0
  12. inpanel/dnf.py +225 -0
  13. inpanel/lib/__init__.py +9 -0
  14. inpanel/lib/async_process.py +98 -0
  15. inpanel/lib/filelock.py +82 -0
  16. inpanel/lib/magic.py +233 -0
  17. inpanel/lib/pxssh.py +310 -0
  18. inpanel/lib/pyDes.py +867 -0
  19. inpanel/mod/__init__.py +0 -0
  20. inpanel/mod/apt.py +316 -0
  21. inpanel/mod/certificate.py +268 -0
  22. inpanel/mod/config.py +372 -0
  23. inpanel/mod/cron.py +315 -0
  24. inpanel/mod/disk.py +322 -0
  25. inpanel/mod/dnf.py +239 -0
  26. inpanel/mod/file.py +722 -0
  27. inpanel/mod/firewall.py +199 -0
  28. inpanel/mod/firewall_base.py +137 -0
  29. inpanel/mod/firewall_firewalld.py +170 -0
  30. inpanel/mod/firewall_iptables.py +176 -0
  31. inpanel/mod/firewall_macos.py +213 -0
  32. inpanel/mod/firewall_ufw.py +128 -0
  33. inpanel/mod/ftp.py +231 -0
  34. inpanel/mod/httpd.py +1205 -0
  35. inpanel/mod/lighttpd.py +26 -0
  36. inpanel/mod/login.py +98 -0
  37. inpanel/mod/mysql.py +577 -0
  38. inpanel/mod/named.py +26 -0
  39. inpanel/mod/nginx.py +2327 -0
  40. inpanel/mod/package.py +33 -0
  41. inpanel/mod/package_apt.py +62 -0
  42. inpanel/mod/package_base.py +77 -0
  43. inpanel/mod/package_dnf.py +62 -0
  44. inpanel/mod/package_map.py +366 -0
  45. inpanel/mod/package_yum.py +64 -0
  46. inpanel/mod/php.py +289 -0
  47. inpanel/mod/process.py +291 -0
  48. inpanel/mod/proftpd.py +26 -0
  49. inpanel/mod/pureftpd.py +26 -0
  50. inpanel/mod/query.py +108 -0
  51. inpanel/mod/server.py +1319 -0
  52. inpanel/mod/service.py +262 -0
  53. inpanel/mod/setting.py +228 -0
  54. inpanel/mod/shell.py +78 -0
  55. inpanel/mod/ssh.py +280 -0
  56. inpanel/mod/system.py +220 -0
  57. inpanel/mod/task.py +1337 -0
  58. inpanel/mod/ufw.py +14 -0
  59. inpanel/mod/user.py +306 -0
  60. inpanel/mod/vsftpd.py +67 -0
  61. inpanel/mod/yum.py +243 -0
  62. inpanel/plugins/__init__.py +10 -0
  63. inpanel/plugins/__pycache__/__init__.cpython-313.pyc +0 -0
  64. inpanel/plugins/acme/static/index.html +10 -0
  65. inpanel/plugins/acme/static/index.js +13 -0
  66. inpanel/plugins/shadowsocks-libev/__pycache__/info.cpython-313.pyc +0 -0
  67. inpanel/plugins/shadowsocks-libev/info.py +73 -0
  68. inpanel/plugins/shadowsocks-libev/static/index.html +70 -0
  69. inpanel/plugins/shadowsocks-libev/static/index.js +18 -0
  70. inpanel/public/css/global.css +138 -0
  71. inpanel/public/favicon.ico +0 -0
  72. inpanel/public/images/alipay.jpg +0 -0
  73. inpanel/public/images/loading.gif +0 -0
  74. inpanel/public/images/weixin.jpg +0 -0
  75. inpanel/public/index.html +94 -0
  76. inpanel/public/js/controllers/controllers.js +566 -0
  77. inpanel/public/js/controllers/database.js +590 -0
  78. inpanel/public/js/controllers/ecs.js +624 -0
  79. inpanel/public/js/controllers/file.js +940 -0
  80. inpanel/public/js/controllers/plugins.js +105 -0
  81. inpanel/public/js/controllers/service.js +1460 -0
  82. inpanel/public/js/controllers/site.js +1241 -0
  83. inpanel/public/js/controllers/utils.js +2319 -0
  84. inpanel/public/js/core.js +221 -0
  85. inpanel/public/js/directives.js +784 -0
  86. inpanel/public/js/filters.js +395 -0
  87. inpanel/public/js/services.js +257 -0
  88. inpanel/public/lib/angular/1.0.2/angular-resource.min.js +10 -0
  89. inpanel/public/lib/angular/1.0.2/angular.min.js +158 -0
  90. inpanel/public/lib/bootstrap/css/bootstrap-theme.css +587 -0
  91. inpanel/public/lib/bootstrap/css/bootstrap-theme.css.map +1 -0
  92. inpanel/public/lib/bootstrap/css/bootstrap-theme.min.css +6 -0
  93. inpanel/public/lib/bootstrap/css/bootstrap-theme.min.css.map +1 -0
  94. inpanel/public/lib/bootstrap/css/bootstrap.css +6757 -0
  95. inpanel/public/lib/bootstrap/css/bootstrap.css.map +1 -0
  96. inpanel/public/lib/bootstrap/css/bootstrap.min.css +6 -0
  97. inpanel/public/lib/bootstrap/css/bootstrap.min.css.map +1 -0
  98. inpanel/public/lib/bootstrap/fonts/glyphicons-halflings-regular.eot +0 -0
  99. inpanel/public/lib/bootstrap/fonts/glyphicons-halflings-regular.svg +288 -0
  100. inpanel/public/lib/bootstrap/fonts/glyphicons-halflings-regular.ttf +0 -0
  101. inpanel/public/lib/bootstrap/fonts/glyphicons-halflings-regular.woff +0 -0
  102. inpanel/public/lib/bootstrap/fonts/glyphicons-halflings-regular.woff2 +0 -0
  103. inpanel/public/lib/bootstrap/img/glyphicons-halflings-white.png +0 -0
  104. inpanel/public/lib/bootstrap/img/glyphicons-halflings.png +0 -0
  105. inpanel/public/lib/bootstrap/js/bootstrap.js +2377 -0
  106. inpanel/public/lib/bootstrap/js/bootstrap.min.js +7 -0
  107. inpanel/public/lib/bootstrap/js/npm.js +13 -0
  108. inpanel/public/lib/codemirror/codemirror-compressed.js +1 -0
  109. inpanel/public/lib/codemirror/codemirror.css +173 -0
  110. inpanel/public/lib/jquery/jquery-1.12.4.min.js +5 -0
  111. inpanel/public/lib/md5/md5.js +379 -0
  112. inpanel/public/lib/md5/md5.min.js +1 -0
  113. inpanel/public/partials/database/index.html +172 -0
  114. inpanel/public/partials/database/mysql/dbedit.html +462 -0
  115. inpanel/public/partials/database/mysql/dbnew.html +348 -0
  116. inpanel/public/partials/database/mysql/useredit.html +310 -0
  117. inpanel/public/partials/database/mysql/usernew.html +97 -0
  118. inpanel/public/partials/directives/message.html +20 -0
  119. inpanel/public/partials/directives/navbar.html +25 -0
  120. inpanel/public/partials/directives/selector.html +57 -0
  121. inpanel/public/partials/directives/srvbase.html +72 -0
  122. inpanel/public/partials/directives/srvext.html +34 -0
  123. inpanel/public/partials/directives/srvfile.html +23 -0
  124. inpanel/public/partials/directives/srvinstall.html +34 -0
  125. inpanel/public/partials/directives/srvlog.html +23 -0
  126. inpanel/public/partials/directives/srvminiop.html +28 -0
  127. inpanel/public/partials/directives/srvuninstall.html +38 -0
  128. inpanel/public/partials/directives/srvupdate.html +30 -0
  129. inpanel/public/partials/ecs/account.html +156 -0
  130. inpanel/public/partials/ecs/ecs.html +198 -0
  131. inpanel/public/partials/ecs/index.html +40 -0
  132. inpanel/public/partials/ecs/setings.html +459 -0
  133. inpanel/public/partials/file/file.html +501 -0
  134. inpanel/public/partials/file/trash.html +95 -0
  135. inpanel/public/partials/ftp.html +36 -0
  136. inpanel/public/partials/log.html +83 -0
  137. inpanel/public/partials/login.html +79 -0
  138. inpanel/public/partials/logout.html +22 -0
  139. inpanel/public/partials/main.html +534 -0
  140. inpanel/public/partials/plugins/index.html +55 -0
  141. inpanel/public/partials/plugins/plugins.html +13 -0
  142. inpanel/public/partials/secure.html +13 -0
  143. inpanel/public/partials/service/apache.html +147 -0
  144. inpanel/public/partials/service/cron.html +71 -0
  145. inpanel/public/partials/service/index.html +293 -0
  146. inpanel/public/partials/service/iptables.html +40 -0
  147. inpanel/public/partials/service/lighttpd.html +63 -0
  148. inpanel/public/partials/service/mariadb.html +113 -0
  149. inpanel/public/partials/service/memcache.html +36 -0
  150. inpanel/public/partials/service/minio.html +44 -0
  151. inpanel/public/partials/service/mongodb.html +44 -0
  152. inpanel/public/partials/service/mysql.html +113 -0
  153. inpanel/public/partials/service/named.html +61 -0
  154. inpanel/public/partials/service/nginx.html +296 -0
  155. inpanel/public/partials/service/ntp.html +40 -0
  156. inpanel/public/partials/service/php.html +250 -0
  157. inpanel/public/partials/service/proftpd.html +59 -0
  158. inpanel/public/partials/service/pureftpd.html +59 -0
  159. inpanel/public/partials/service/redis.html +40 -0
  160. inpanel/public/partials/service/samba.html +58 -0
  161. inpanel/public/partials/service/sendmail.html +40 -0
  162. inpanel/public/partials/service/ssh.html +186 -0
  163. inpanel/public/partials/service/tomcat.html +65 -0
  164. inpanel/public/partials/service/vsftpd.html +195 -0
  165. inpanel/public/partials/setting.html +299 -0
  166. inpanel/public/partials/site/apache/site.html +277 -0
  167. inpanel/public/partials/site/index.html +344 -0
  168. inpanel/public/partials/site/nginx/site.html +558 -0
  169. inpanel/public/partials/sorry.html +19 -0
  170. inpanel/public/partials/storage/autofm.html +103 -0
  171. inpanel/public/partials/storage/backup.html +42 -0
  172. inpanel/public/partials/storage/index.html +360 -0
  173. inpanel/public/partials/storage/migrate.html +93 -0
  174. inpanel/public/partials/storage/movedata.html +98 -0
  175. inpanel/public/partials/storage/remote.html +77 -0
  176. inpanel/public/partials/utils/cron.html +486 -0
  177. inpanel/public/partials/utils/firewall.html +266 -0
  178. inpanel/public/partials/utils/index.html +193 -0
  179. inpanel/public/partials/utils/network.html +118 -0
  180. inpanel/public/partials/utils/process.html +239 -0
  181. inpanel/public/partials/utils/repository.html +373 -0
  182. inpanel/public/partials/utils/shell.html +28 -0
  183. inpanel/public/partials/utils/ssl.html +319 -0
  184. inpanel/public/partials/utils/time.html +109 -0
  185. inpanel/public/partials/utils/user.html +359 -0
  186. inpanel/public/robots.txt +2 -0
  187. inpanel/remote.py +109 -0
  188. inpanel/templates/file/preview.html +34 -0
  189. inpanel/templates/index.html +93 -0
  190. inpanel/utils.py +282 -0
  191. inpanel/web.py +1811 -0
  192. inpanel/yum.py +756 -0
  193. inpanel-1.2.1.dist-info/METADATA +399 -0
  194. inpanel-1.2.1.dist-info/RECORD +198 -0
  195. inpanel-1.2.1.dist-info/WHEEL +5 -0
  196. inpanel-1.2.1.dist-info/entry_points.txt +2 -0
  197. inpanel-1.2.1.dist-info/licenses/LICENSE +30 -0
  198. inpanel-1.2.1.dist-info/top_level.txt +1 -0
inpanel/apt.py ADDED
@@ -0,0 +1,223 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (c) 2020-2026 Jackson Dou
4
+ # All rights reserved.
5
+ #
6
+ # InPanel is distributed under the terms of The New BSD License.
7
+ # The full license can be found in 'LICENSE'.
8
+
9
+ '''Module for APT(Advanced Packaging Tool) Repository Data'''
10
+
11
+ apt_sources = {
12
+ 'debian': {
13
+ '10': {
14
+ 'buster': {
15
+ 'main': 'deb http://deb.debian.org/debian/ buster main',
16
+ 'contrib': 'deb http://deb.debian.org/debian/ buster contrib',
17
+ 'non-free': 'deb http://deb.debian.org/debian/ buster non-free',
18
+ 'updates': 'deb http://deb.debian.org/debian/ buster-updates main contrib non-free',
19
+ 'security': 'deb http://security.debian.org/debian-security buster/updates main contrib non-free'
20
+ }
21
+ },
22
+ '11': {
23
+ 'bullseye': {
24
+ 'main': 'deb http://deb.debian.org/debian/ bullseye main',
25
+ 'contrib': 'deb http://deb.debian.org/debian/ bullseye contrib',
26
+ 'non-free': 'deb http://deb.debian.org/debian/ bullseye non-free',
27
+ 'non-free-firmware': 'deb http://deb.debian.org/debian/ bullseye non-free-firmware',
28
+ 'updates': 'deb http://deb.debian.org/debian/ bullseye-updates main contrib non-free non-free-firmware',
29
+ 'security': 'deb http://security.debian.org/debian-security bullseye-security main contrib non-free non-free-firmware'
30
+ }
31
+ },
32
+ '12': {
33
+ 'bookworm': {
34
+ 'main': 'deb http://deb.debian.org/debian/ bookworm main',
35
+ 'contrib': 'deb http://deb.debian.org/debian/ bookworm contrib',
36
+ 'non-free': 'deb http://deb.debian.org/debian/ bookworm non-free',
37
+ 'non-free-firmware': 'deb http://deb.debian.org/debian/ bookworm non-free-firmware',
38
+ 'updates': 'deb http://deb.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware',
39
+ 'security': 'deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware',
40
+ 'backports': 'deb http://deb.debian.org/debian/ bookworm-backports main contrib non-free non-free-firmware'
41
+ }
42
+ },
43
+ '13': {
44
+ 'trixie': {
45
+ 'main': 'deb http://deb.debian.org/debian/ trixie main',
46
+ 'contrib': 'deb http://deb.debian.org/debian/ trixie contrib',
47
+ 'non-free': 'deb http://deb.debian.org/debian/ trixie non-free',
48
+ 'non-free-firmware': 'deb http://deb.debian.org/debian/ trixie non-free-firmware',
49
+ 'updates': 'deb http://deb.debian.org/debian/ trixie-updates main contrib non-free non-free-firmware',
50
+ 'security': 'deb http://security.debian.org/debian-security trixie-security main contrib non-free non-free-firmware',
51
+ 'backports': 'deb http://deb.debian.org/debian/ trixie-backports main contrib non-free non-free-firmware'
52
+ }
53
+ }
54
+ },
55
+ 'ubuntu': {
56
+ '18.04': {
57
+ 'bionic': {
58
+ 'main': 'deb http://archive.ubuntu.com/ubuntu/ bionic main restricted',
59
+ 'universe': 'deb http://archive.ubuntu.com/ubuntu/ bionic universe',
60
+ 'multiverse': 'deb http://archive.ubuntu.com/ubuntu/ bionic multiverse',
61
+ 'updates': 'deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse',
62
+ 'security': 'deb http://security.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse',
63
+ 'backports': 'deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse'
64
+ }
65
+ },
66
+ '20.04': {
67
+ 'focal': {
68
+ 'main': 'deb http://archive.ubuntu.com/ubuntu/ focal main restricted',
69
+ 'universe': 'deb http://archive.ubuntu.com/ubuntu/ focal universe',
70
+ 'multiverse': 'deb http://archive.ubuntu.com/ubuntu/ focal multiverse',
71
+ 'updates': 'deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse',
72
+ 'security': 'deb http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse',
73
+ 'backports': 'deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse'
74
+ }
75
+ },
76
+ '22.04': {
77
+ 'jammy': {
78
+ 'main': 'deb http://archive.ubuntu.com/ubuntu/ jammy main restricted',
79
+ 'universe': 'deb http://archive.ubuntu.com/ubuntu/ jammy universe',
80
+ 'multiverse': 'deb http://archive.ubuntu.com/ubuntu/ jammy multiverse',
81
+ 'updates': 'deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse',
82
+ 'security': 'deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse',
83
+ 'backports': 'deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse'
84
+ }
85
+ },
86
+ '24.04': {
87
+ 'noble': {
88
+ 'main': 'deb http://archive.ubuntu.com/ubuntu/ noble main restricted',
89
+ 'universe': 'deb http://archive.ubuntu.com/ubuntu/ noble universe',
90
+ 'multiverse': 'deb http://archive.ubuntu.com/ubuntu/ noble multiverse',
91
+ 'updates': 'deb http://archive.ubuntu.com/ubuntu/ noble-updates main restricted universe multiverse',
92
+ 'security': 'deb http://security.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse',
93
+ 'backports': 'deb http://archive.ubuntu.com/ubuntu/ noble-backports main restricted universe multiverse'
94
+ }
95
+ }
96
+ }
97
+ }
98
+
99
+ apt_mirrors = {
100
+ 'aliyun': {
101
+ 'debian': 'deb http://mirrors.aliyun.com/debian/ $release main contrib non-free non-free-firmware',
102
+ 'debian-updates': 'deb http://mirrors.aliyun.com/debian/ $release-updates main contrib non-free non-free-firmware',
103
+ 'debian-security': 'deb http://mirrors.aliyun.com/debian-security/ $release-security main contrib non-free non-free-firmware',
104
+ 'debian-backports': 'deb http://mirrors.aliyun.com/debian/ $release-backports main contrib non-free non-free-firmware',
105
+ 'ubuntu': 'deb http://mirrors.aliyun.com/ubuntu/ $codename main restricted universe multiverse',
106
+ 'ubuntu-updates': 'deb http://mirrors.aliyun.com/ubuntu/ $codename-updates main restricted universe multiverse',
107
+ 'ubuntu-security': 'deb http://mirrors.aliyun.com/ubuntu/ $codename-security main restricted universe multiverse',
108
+ 'ubuntu-backports': 'deb http://mirrors.aliyun.com/ubuntu/ $codename-backports main restricted universe multiverse'
109
+ },
110
+ 'ustc': {
111
+ 'debian': 'deb https://mirrors.ustc.edu.cn/debian/ $release main contrib non-free non-free-firmware',
112
+ 'debian-updates': 'deb https://mirrors.ustc.edu.cn/debian/ $release-updates main contrib non-free non-free-firmware',
113
+ 'debian-security': 'deb https://mirrors.ustc.edu.cn/debian-security/ $release-security main contrib non-free non-free-firmware',
114
+ 'debian-backports': 'deb https://mirrors.ustc.edu.cn/debian/ $release-backports main contrib non-free non-free-firmware',
115
+ 'ubuntu': 'deb https://mirrors.ustc.edu.cn/ubuntu/ $codename main restricted universe multiverse',
116
+ 'ubuntu-updates': 'deb https://mirrors.ustc.edu.cn/ubuntu/ $codename-updates main restricted universe multiverse',
117
+ 'ubuntu-security': 'deb https://mirrors.ustc.edu.cn/ubuntu/ $codename-security main restricted universe multiverse',
118
+ 'ubuntu-backports': 'deb https://mirrors.ustc.edu.cn/ubuntu/ $codename-backports main restricted universe multiverse'
119
+ },
120
+ 'tsinghua': {
121
+ 'debian': 'deb https://mirrors.tuna.tsinghua.edu.cn/debian/ $release main contrib non-free non-free-firmware',
122
+ 'debian-updates': 'deb https://mirrors.tuna.tsinghua.edu.cn/debian/ $release-updates main contrib non-free non-free-firmware',
123
+ 'debian-security': 'deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ $release-security main contrib non-free non-free-firmware',
124
+ 'debian-backports': 'deb https://mirrors.tuna.tsinghua.edu.cn/debian/ $release-backports main contrib non-free non-free-firmware',
125
+ 'ubuntu': 'deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ $codename main restricted universe multiverse',
126
+ 'ubuntu-updates': 'deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ $codename-updates main restricted universe multiverse',
127
+ 'ubuntu-security': 'deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ $codename-security main restricted universe multiverse',
128
+ 'ubuntu-backports': 'deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ $codename-backports main restricted universe multiverse'
129
+ }
130
+ }
131
+
132
+ apt_pkg_alias = {
133
+ 'nginx': ['nginx', 'nginx-full', 'nginx-light', 'nginx-extras'],
134
+ 'tomcat': ['tomcat9', 'tomcat10'],
135
+ 'apache': ['apache2'],
136
+ 'lighttpd': ['lighttpd'],
137
+ 'vsftpd': ['vsftpd'],
138
+ 'mysql': ['mysql-server', 'mariadb-server', 'default-mysql-server'],
139
+ 'mariadb': ['mariadb-server'],
140
+ 'redis': ['redis-server'],
141
+ 'memcache': ['memcached'],
142
+ 'mongodb': ['mongodb-org'],
143
+ 'php': ['php', 'php8.1', 'php8.2', 'php8.3'],
144
+ 'sendmail': ['sendmail'],
145
+ 'ssh': ['openssh-server'],
146
+ 'iptables': ['iptables'],
147
+ 'cron': ['cron'],
148
+ 'ntp': ['chrony'],
149
+ 'bind': ['bind9'],
150
+ 'docker': ['docker-ce'],
151
+ 'pureftpd': ['pure-ftpd'],
152
+ 'proftpd': ['proftpd-basic'],
153
+ 'GeoIP': ['geoip-database'],
154
+ 'mono': ['mono-devel'],
155
+ 'ntfs-3g': ['ntfs-3g'],
156
+ 'davfs2': ['davfs2'],
157
+ 'nfs': ['nfs-kernel-server'],
158
+ 'cifs': ['cifs-utils'],
159
+ 'samba': ['samba']
160
+ }
161
+
162
+ apt_pkg_relatives = {
163
+ 'nginx': {
164
+ 'nginx': {'default': True, 'base': True},
165
+ 'nginx-full': {'default': False, 'isext': True},
166
+ 'nginx-light': {'default': False, 'isext': True},
167
+ 'nginx-extras': {'default': False, 'isext': True},
168
+ 'nginx-core': {'default': True, 'base': True}
169
+ },
170
+ 'apache2': {
171
+ 'apache2': {'default': True, 'base': True},
172
+ 'apache2-dev': {'default': False, 'isext': True},
173
+ 'libapache2-mod-ssl': {'default': True, 'isext': True},
174
+ 'apache2-utils': {'default': False, 'isext': True}
175
+ },
176
+ 'mariadb-server': {
177
+ 'mariadb-server': {'default': True, 'base': True},
178
+ 'mariadb-client': {'default': True, 'base': True},
179
+ 'mariadb-common': {'default': True, 'base': True}
180
+ },
181
+ 'redis-server': {
182
+ 'redis-server': {'default': True, 'base': True},
183
+ 'redis-tools': {'default': False, 'isext': True}
184
+ },
185
+ 'memcached': {
186
+ 'memcached': {'default': True, 'base': True},
187
+ 'libmemcached-tools': {'default': False, 'isext': True}
188
+ },
189
+ 'php': {
190
+ 'php': {'default': True, 'base': True},
191
+ 'php-cli': {'default': True},
192
+ 'php-common': {'default': True, 'base': True},
193
+ 'php-fpm': {'default': True},
194
+ 'php-gd': {'default': True, 'isext': True},
195
+ 'php-mbstring': {'default': True, 'isext': True},
196
+ 'php-mysql': {'default': True, 'isext': True},
197
+ 'php-pdo': {'default': True},
198
+ 'php-soap': {'default': False, 'isext': True},
199
+ 'php-xml': {'default': True, 'isext': True},
200
+ 'php-zip': {'default': False, 'isext': True},
201
+ 'php-dev': {'default': False, 'isext': True}
202
+ },
203
+ 'php8.2': {
204
+ 'php8.2': {'default': True, 'base': True},
205
+ 'php8.2-cli': {'default': True},
206
+ 'php8.2-common': {'default': True, 'base': True},
207
+ 'php8.2-fpm': {'default': True},
208
+ 'php8.2-gd': {'default': True, 'isext': True},
209
+ 'php8.2-mbstring': {'default': True, 'isext': True},
210
+ 'php8.2-mysql': {'default': True, 'isext': True},
211
+ 'php8.2-pdo': {'default': True},
212
+ 'php8.2-soap': {'default': False, 'isext': True},
213
+ 'php8.2-xml': {'default': True, 'isext': True},
214
+ 'php8.2-zip': {'default': False, 'isext': True},
215
+ 'php8.2-dev': {'default': False, 'isext': True}
216
+ },
217
+ 'docker-ce': {
218
+ 'docker-ce': {'default': True, 'base': True},
219
+ 'docker-ce-cli': {'default': True, 'base': True},
220
+ 'containerd.io': {'default': True, 'base': True},
221
+ 'docker-compose-plugin': {'default': False, 'isext': True}
222
+ }
223
+ }
inpanel/base.py ADDED
@@ -0,0 +1,200 @@
1
+ # -*- coding: utf-8 -*-
2
+ '''The InPanel Base Information'''
3
+ # Copyright (c) 2017-2026 Jackson Dou
4
+ # All rights reserved.
5
+ #
6
+ # InPanel is distributed under the terms of the (new) BSD License.
7
+ # The full license can be found in 'LICENSE'.
8
+
9
+ import sys
10
+ import os
11
+ from pathlib import Path
12
+ from platform import mac_ver, platform, uname, win32_ver
13
+
14
+ pyproject_path = Path(__file__).parent.parent / 'pyproject.toml'
15
+ if pyproject_path.exists():
16
+ with open(pyproject_path, 'r', encoding='utf-8') as f:
17
+ for line in f:
18
+ if line.startswith('version ='):
19
+ __version__ = line.split('=')[1].strip().strip('"').strip("'")
20
+ break
21
+ else:
22
+ __version__ = '1.2.0'
23
+ else:
24
+ try:
25
+ from importlib.metadata import version, PackageNotFoundError
26
+ try:
27
+ __version__ = version('InPanel')
28
+ except PackageNotFoundError:
29
+ __version__ = '1.2.0'
30
+ except ImportError:
31
+ try:
32
+ from pkg_resources import get_distribution, DistributionNotFound
33
+ try:
34
+ __version__ = get_distribution('InPanel').version
35
+ except DistributionNotFound:
36
+ __version__ = '1.2.0'
37
+ except ImportError:
38
+ __version__ = '1.2.0'
39
+ __author__ = 'Jackson Dou'
40
+ __license__ = 'BSD'
41
+
42
+ app_name = 'InPanel'
43
+ releasetime = '2026-07-xx'
44
+ DEBUG = True
45
+ COMMENTFLAG = '#INPANEL#'
46
+ GENBY = 'AUTOMATICALLY GENERATED BY INPANEL'
47
+
48
+ # 版本信息
49
+ version_info = {
50
+ 'name' : app_name,
51
+ 'changelog' : 'https://inpanel.org/changelog.html',
52
+ 'releasetime' : releasetime,
53
+ 'version' : __version__
54
+ }
55
+
56
+ # 链接信息
57
+ app_api = {
58
+ 'latest' : 'https://api.inpanel.org/?s=latest',
59
+ 'site_packages' : 'https://api.inpanel.org/?s=site_packages',
60
+ 'download_package' : 'https://api.inpanel.org/?s=site_packages&a=download'
61
+ }
62
+
63
+ if hasattr(sys, 'frozen') and hasattr(sys, '_MEIPASS'):
64
+ run_type = 'binary'
65
+ root_path = sys._MEIPASS
66
+ execfile = '/usr/bin/inpanel'
67
+ config_path = '/etc/inpanel/'
68
+ config_file = '/etc/inpanel/config.ini'
69
+ runlogs_path = '/etc/inpanel/runlogs.ini'
70
+ update_info_path = '/etc/inpanel/update_info.ini'
71
+ history_path = '/etc/inpanel/history.txt'
72
+ logging_path = '/var/log/inpanel/'
73
+ logfile = '/var/log/inpanel/main.log'
74
+ logerror = '/var/log/inpanel/error.log'
75
+ pidfile = '/var/run/inpanel.pid'
76
+ else:
77
+ package_dir = Path(__file__).parent.resolve()
78
+ if package_dir.parts[-2] == 'site-packages' or 'dist-packages' in str(package_dir):
79
+ run_type = 'system'
80
+ root_path = str(package_dir)
81
+ execfile = '/usr/bin/inpanel'
82
+ config_path = '/etc/inpanel/'
83
+ config_file = '/etc/inpanel/config.ini'
84
+ runlogs_path = '/etc/inpanel/runlogs.ini'
85
+ update_info_path = '/etc/inpanel/update_info.ini'
86
+ history_path = '/etc/inpanel/history.txt'
87
+ logging_path = '/var/log/inpanel/'
88
+ logfile = '/var/log/inpanel/main.log'
89
+ logerror = '/var/log/inpanel/error.log'
90
+ pidfile = '/var/run/inpanel.pid'
91
+ else:
92
+ run_type = 'source'
93
+ root_path = str(Path(__file__).parent.resolve())
94
+ execfile = str(Path(root_path) / 'app.py')
95
+ config_path = str(Path(root_path) / 'data')
96
+ config_file = str(Path(root_path) / 'data' / 'config.ini')
97
+ runlogs_path = str(Path(root_path) / 'data' / 'runlogs.ini')
98
+ update_info_path = str(Path(root_path) / 'data' / 'update_info.ini')
99
+ history_path = str(Path(root_path) / 'data' / 'history.txt')
100
+ logging_path = str(Path(root_path) / 'data')
101
+ logfile = str(Path(root_path) / 'data' / 'main.log')
102
+ logerror = str(Path(root_path) / 'data' / 'error.log')
103
+ pidfile = str(Path(root_path) / 'data' / 'inpanel.pid')
104
+
105
+
106
+ kernel_name, hostname, kernel_release, kernel_version, machine, processor = uname()
107
+
108
+ try:
109
+ from mod.system import (
110
+ get_os_title,
111
+ get_os_name,
112
+ get_os_version,
113
+ get_os_version_major,
114
+ get_os_family,
115
+ get_os_id,
116
+ get_os_release as system_get_os_release,
117
+ )
118
+
119
+ os_title = get_os_title()
120
+ os_name = get_os_name()
121
+ os_version = get_os_version()
122
+ os_versint = get_os_version_major()
123
+ os_platform = platform()
124
+
125
+ except ImportError:
126
+ # 发行名称,如:CentOS release 8.0
127
+ os_title = 'Unknown'
128
+ # 发行名称,如:macOS
129
+ os_name = 'Unknown'
130
+ # 发行版本号,如:11.5.2
131
+ os_version = ''
132
+ # 发行版本整数,如:11
133
+ os_versint = 0
134
+ os_platform = platform()
135
+ # 根据内核名称判断
136
+ if kernel_name == 'Darwin':
137
+ os_name = 'macOS'
138
+ os_version, _, _ = mac_ver()
139
+ os_versint = int(os_version.split('.')[0]) if os_version else 0
140
+ os_title = 'macOS ' + os_version
141
+ elif kernel_name == 'Windows':
142
+ os_name = 'Windows'
143
+ os_version, _, _ = win32_ver()
144
+ os_title = 'Windows ' + os_version
145
+ os_versint = int(os_version.split('.')[0]) if os_version else 0
146
+ elif kernel_name == 'Linux':
147
+ if 'Ubuntu' in kernel_version:
148
+ os_name = 'Ubuntu'
149
+ if Path('/etc/issue').exists():
150
+ with open('/etc/issue', 'r', encoding='utf-8') as f:
151
+ line = f.readlines(1)
152
+ os_title = line[0].replace('\\n', '').replace('\\l', '').strip()
153
+ os_version = os_title.split()[1]
154
+ os_versint = int(os_version.split('.')[0])
155
+ else:
156
+ if '.el8.' in kernel_release:
157
+ os_name = 'CentOS'
158
+ os_versint = 8
159
+ os_title = 'CentOS 8'
160
+ elif '.el7.' in kernel_release:
161
+ os_name = 'CentOS'
162
+ os_versint = 7
163
+ os_title = 'CentOS 7'
164
+ elif '.el6.' in kernel_release:
165
+ os_name = 'CentOS'
166
+ os_versint = 6
167
+ os_title = 'CentOS 6'
168
+ elif '.el5.' in kernel_release:
169
+ os_name = 'CentOS'
170
+ os_versint = 5
171
+ os_title = 'CentOS 5'
172
+
173
+ server_info = {
174
+ 'os_title' : os_title, # 系统名称全称
175
+ 'os_name' : os_name, # 发行名称
176
+ 'os_version' : os_version, # 发行版本(全)
177
+ 'os_versint' : os_versint, # 发行版本(主版本号)
178
+ 'os_platform' : os_platform,
179
+ 'hostname' : hostname, # 主机名
180
+ 'kernel_name' : kernel_name, # 内核类型
181
+ 'kernel_release': kernel_release, # 内核编号
182
+ 'kernel_version': kernel_version, # 内核版本信息
183
+ 'machine' : machine, # arch x86_64
184
+ 'processor' : processor
185
+ }
186
+
187
+ __all__ = [
188
+ '__version__', 'DEBUG', 'app_api', 'app_name', 'config_path',
189
+ 'run_type', 'config_file', 'root_path', 'COMMENTFLAG', 'GENBY', 'execfile',
190
+ 'releasetime', 'version_info', 'server_info', 'os_name', 'os_title',
191
+ 'os_version', 'os_versint', 'os_platform', 'kernel_name', 'kernel_release',
192
+ 'kernel_version', 'hostname', 'machine', 'runlogs_path', 'update_info_path',
193
+ 'history_path', 'logfile', 'logerror', 'pidfile', 'processor'
194
+ ]
195
+
196
+ if __name__ == '__main__':
197
+ print(uname())
198
+ print(mac_ver())
199
+ print(platform())
200
+ print(server_info)
inpanel/config.py ADDED
@@ -0,0 +1,139 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+
4
+ import sys
5
+ import logging
6
+ from pathlib import Path
7
+
8
+
9
+ def _init_logging():
10
+ logging.basicConfig(
11
+ level=logging.INFO,
12
+ format='%(asctime)s - %(levelname)s - config.py - %(message)s',
13
+ handlers=[
14
+ logging.StreamHandler()
15
+ ]
16
+ )
17
+ return logging.getLogger(__name__)
18
+
19
+
20
+ def main(args=None):
21
+ if args is None:
22
+ args = sys.argv[1:]
23
+
24
+ logger = _init_logging()
25
+
26
+ if len(args) < 1:
27
+ print('''Usage: inpanel config <action> [section] [option] [value]
28
+
29
+ Actions:
30
+ get section option Get config value
31
+ set section option value Set config value
32
+ list List all configs
33
+ reset Reset to default config
34
+ init Initialize config file
35
+
36
+ Examples:
37
+ inpanel config get server port
38
+ inpanel config set server port 14433
39
+ inpanel config list
40
+ inpanel config init''')
41
+ sys.exit(1)
42
+
43
+ from .base import config_file
44
+ from .mod.config import load_config
45
+
46
+ action = args[0]
47
+ logger.info(f'Config action: {action}')
48
+
49
+ if action == 'init':
50
+ logger.info(f'Initializing config file at: {config_file}')
51
+ Path(config_file).parent.mkdir(parents=True, exist_ok=True)
52
+ config = load_config(config_file)
53
+ logger.info(f'Config file created successfully')
54
+ print(f'Config file created at: {config_file}')
55
+ sys.exit(0)
56
+
57
+ if action == 'list':
58
+ logger.info('Listing all configurations')
59
+ config = load_config(config_file)
60
+ config_list = config.get_config_list()
61
+ sections = [sec['section'] for sec in config_list]
62
+ logger.info(f'Found {len(sections)} sections: {sections}')
63
+ for sec in config_list:
64
+ print(f'[{sec["section"]}]')
65
+ for opt, val in sec['option'].items():
66
+ display_val = '***HIDDEN***' if opt == 'password' else val
67
+ print(f' {opt} = {display_val}')
68
+ print()
69
+ sys.exit(0)
70
+
71
+ if action == 'reset':
72
+ logger.info('Resetting config to default')
73
+ config = load_config(config_file)
74
+ for sec in config.get_section_list():
75
+ config.remove_section(sec)
76
+ config.update()
77
+ config = load_config(config_file)
78
+ logger.info('Config reset completed')
79
+ print('Config reset to default')
80
+ sys.exit(0)
81
+
82
+ if len(args) < 3:
83
+ logger.error('Missing arguments for get/set action')
84
+ print('Error: Missing arguments')
85
+ sys.exit(1)
86
+
87
+ section = args[1]
88
+ option = args[2]
89
+
90
+ logger.info(f'Processing {action} action for [{section}].{option}')
91
+
92
+ config = load_config(config_file)
93
+
94
+ if action == 'get':
95
+ value = config.get(section, option)
96
+ if value is not None:
97
+ display_val = '***HIDDEN***' if option == 'password' else value
98
+ logger.info(f'Got [{section}].{option} = {display_val}')
99
+ print(value)
100
+ else:
101
+ logger.error(f'Option "{option}" not found in section "{section}"')
102
+ print(f'Error: Option "{option}" not found in section "{section}"')
103
+ sys.exit(1)
104
+
105
+ elif action == 'set':
106
+ if len(args) < 4:
107
+ logger.error('Missing value for set action')
108
+ print('Error: Missing value')
109
+ sys.exit(1)
110
+ value = args[3]
111
+
112
+ if section == 'auth' and option == 'password':
113
+ logger.info('Setting auth.password, generating hash')
114
+ from hashlib import md5
115
+ from hmac import new as hmac_new
116
+ from .utils import randstr
117
+ key = md5(randstr().encode('utf-8')).hexdigest()
118
+ pwd = hmac_new(key.encode('utf-8'), value.encode('utf-8'), md5).hexdigest()
119
+ value = '%s:%s' % (pwd, key)
120
+ logger.info(f'Password hash generated, key length: {len(key)}, hash length: {len(pwd)}')
121
+
122
+ result = config.set(section, option, value)
123
+ if result:
124
+ display_val = '***HIDDEN***' if option == 'password' else value
125
+ logger.info(f'Successfully set [{section}].{option} = {display_val}')
126
+ print(f'Successfully set {section}.{option}')
127
+ else:
128
+ logger.error(f'Failed to set [{section}].{option}')
129
+ print(f'Error: Failed to set {section}.{option}')
130
+ sys.exit(1)
131
+
132
+ else:
133
+ logger.error(f'Unknown action: {action}')
134
+ print(f'Unknown action: {action}')
135
+ sys.exit(1)
136
+
137
+
138
+ if __name__ == '__main__':
139
+ main()
@@ -0,0 +1,29 @@
1
+ [server]
2
+ ip = *
3
+ port = 14433
4
+ forcehttps = off
5
+ sslkey = /Users/jksdou/Projects/inpanel/inpanel-v1.2.0/inpanel/data/certificate/inpanel.key
6
+ sslcrt = /Users/jksdou/Projects/inpanel/inpanel-v1.2.0/inpanel/data/certificate/inpanel.crt
7
+
8
+ [auth]
9
+ username = admin
10
+ password = a17351f4e092ba7d87a7a90c170a5cf6:1bdf574a782e8f006676ee1225743a6b
11
+ passwordcheck = on
12
+ accesskey =
13
+ accesskeyenable = off
14
+
15
+ [runtime]
16
+ mode = prod
17
+ loginlock = off
18
+ loginfails = 0
19
+ loginlockexpire = 0
20
+
21
+ [time]
22
+ timezone =
23
+
24
+ [ecs]
25
+ accounts =
26
+
27
+ [inpanel]
28
+ instance name = Access key
29
+
inpanel/data/history ADDED
@@ -0,0 +1,5 @@
1
+ /etc
2
+ /data/project,test
3
+ /etc/nginx
4
+ /home/test
5
+ /var/www
@@ -0,0 +1,12 @@
1
+ [file]
2
+ lastdir = /Users/jksdou
3
+ lastfile =
4
+
5
+ [history]
6
+ paths = /backup/2024,01,01
7
+ /data/project,test
8
+ /etc/nginx
9
+ /home/test
10
+ /var/www
11
+ /etc
12
+
@@ -0,0 +1,4 @@
1
+ [update]
2
+ lastcheck = 1234567890
3
+ updateinfo = {"version": "1.2.1"}
4
+