Skip to content

Commit

Permalink
Merge branch 'v2.3.5-dev' into v2.3.5-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir authored Jan 6, 2024
2 parents 9250dc1 + b9f9438 commit 834147b
Show file tree
Hide file tree
Showing 62 changed files with 6,046 additions and 394 deletions.
20 changes: 20 additions & 0 deletions CLManager/CageFS.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,26 @@ def submitCageFSInstall():
writeToFile.write('CLInstalled')
writeToFile.close()



#### mount session save paths

if os.path.exists('/etc/cagefs/cagefs.mp'):

from managePHP.phpManager import PHPManager
php_versions = PHPManager.findPHPVersions()

for php in php_versions:
PHPVers = PHPManager.getPHPString(php)
line = f'@/var/lib/lsphp/session/lsphp{PHPVers},700\n'

WriteToFile = open('/etc/cagefs/cagefs.mp', 'a')
WriteToFile.write(line)
WriteToFile.close()

command = 'cagefsctl --remount-all'
ServerStatusUtil.executioner(command, statusFile)

logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
"Packages successfully installed.[200]\n", 1)

Expand Down
Binary file modified baseTemplate/static/baseTemplate/assets/finalBase/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 43 additions & 74 deletions baseTemplate/templates/baseTemplate/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -217,65 +217,6 @@
title="{% trans 'CPU Load Average' %}" data-placement="bottom">
<span class="badge bg-red" id="load3">{$ three $}</span>
</a>{% endcomment %}

{# <div class="dropdown" id="dashnav-btn">#}
{# <a href="#" data-toggle="dropdown" data-placement="bottom"#}
{# class="popover-button-header tooltip-button" title="{% trans 'Dashboard Quick Menu' %}">#}
{# <i class="glyph-icon icon-linecons-cog"></i>#}
{# </a>#}
{# <div class="dropdown-menu float-right">#}
{# <div class="box-sm">#}
{# <div class="pad5T pad5B pad10L pad10R dashboard-buttons clearfix">#}
{# <a href="{% url 'loadWebsitesHome' %}"#}
{# class="btn vertical-button remove-border btn-info" title="{% trans '' %}">#}
{# <span class="glyph-icon icon-separator-vertical pad0A medium">#}
{# <i class="glyph-icon icon-dashboard opacity-80 font-size-20"></i>#}
{# </span>#}
{# {% trans "Websites" %}#}
{# </a>#}
{# <a href="{% url 'packagesHome' %}"#}
{# class="btn vertical-button remove-border btn-danger"#}
{# title="{% trans '' %}">#}
{# <span class="glyph-icon icon-separator-vertical pad0A medium">#}
{# <i class="glyph-icon icon-tags opacity-80 font-size-20"></i>#}
{# </span>#}
{# {% trans "Packages" %}#}
{# </a>#}
{# <a href="{% url 'dnsHome' %}" class="btn vertical-button remove-border btn-purple"#}
{# title="{% trans '' %}">#}
{# <span class="glyph-icon icon-separator-vertical pad0A medium">#}
{# <i class="glyph-icon icon-fire opacity-80 font-size-20"></i>#}
{# </span>#}
{# {% trans "DNS" %}#}
{# </a>#}
{# <a href="{% url 'loadFTPHome' %}"#}
{# class="btn vertical-button remove-border btn-azure"#}
{# title="{% trans '' %}">#}
{# <span class="glyph-icon icon-separator-vertical pad0A medium">#}
{# <i class="glyph-icon icon-bar-chart-o opacity-80 font-size-20"></i>#}
{# </span>#}
{# {% trans "FTP" %}#}
{# </a>#}
{# <a href="{% url 'loadTuningHome' %}"#}
{# class="btn vertical-button remove-border btn-yellow" title="{% trans '' %}">#}
{# <span class="glyph-icon icon-separator-vertical pad0A medium">#}
{# <i class="glyph-icon icon-laptop opacity-80 font-size-20"></i>#}
{# </span>#}
{# {% trans "Tuning" %}#}
{# </a>#}
{# <a href="{% url 'serverStatusHome' %}"#}
{# class="btn vertical-button remove-border btn-warning" title="{% trans '' %}">#}
{# <span class="glyph-icon icon-separator-vertical pad0A medium">#}
{# <i class="glyph-icon icon-code opacity-80 font-size-20"></i>#}
{# </span>#}
{# {% trans "Status" %}#}
{# </a>#}
{##}
{# </div>#}
{##}
{# </div>#}
{# </div>#}
{# </div>#}
<a class="header-btn" target="_blank"
href="https://www.youtube.com/channel/UCS6sgUWEhaFl1TO238Ck0xw?sub_confirmation=1"
title="{% trans 'Youtube Channel' %}">
Expand Down Expand Up @@ -430,6 +371,35 @@
</li>


<!-------------Docker Sites--------------------------->
<li id="sidebar-menu-item-dockersite">
<a href="#" title="{% trans 'Dockersite' %}">
<div class="glyph-icon icon-globe" title="{% trans 'Docker Apps' %}"></div>
<span>{% trans "Docker Apps" %}</span>
</a>
<div class="sidebar-submenu">

<ul>
<li><a href="{% url 'CreateDockersite' %}"
><span>{% trans "Create Docker Apps" %}</span></a>
</li>
<li><a href="{% url 'ListDockerSites' %}"
><span>{% trans "List Docker Apps" %}</span></a>
</li>
{# {% if admin or createWebsite %}#}
<li><a href="{% url 'CreateDockerPackage' %}"
><span>{% trans "Docker Packages" %}</span></a>
</li>
{# {% endif %}#}
<li><a href="{% url 'AssignPackage' %}"
><span>{% trans "Assign Package" %}</span></a>
</li>
</ul>

</div><!-- .sidebar-submenu -->
</li>


<li id="sidebar-menu-item-websites">
<a href="{% url 'loadWebsitesHome' %}" title="{% trans 'Websites' %}">
<div class="glyph-icon icon-globe" title="{% trans 'Websites' %}"></div>
Expand Down Expand Up @@ -824,6 +794,18 @@
{% if admin %}

<li class="header"><span>{% trans "Server" %}</span></li>

<li>
<a href="{% url 'MysqlManager' %}"
title="{% trans 'Root File Manager' %}">
<i class="glyph-icon icon-database"
title="{% trans 'MySQL Manager' %}"
data-original-title=".icon-cloud-upload" aria-describedby="tooltip896208"></i>
<span>{% trans "MySQL Manager" %}</span>
<span class="bs-label badge-warning">{% trans "NEW" %}</span>
</a>
</li>

<li id="sidebar-menu-item-root-file-manager">
<a href="{% url 'Filemanager' %}"
title="{% trans 'Root File Manager' %}">
Expand All @@ -836,21 +818,6 @@



{# <li>#}
{# <a href="#" title="{% trans 'Terminal' %}">#}
{# <i class="glyph-icon icon-linecons-fire"></i>#}
{# <span>{% trans "Web Terminal" %}</span>#}
{# <span class="bs-label badge-yellow">{% trans "NEW" %}</span>#}
{# </a>#}
{# <div class="sidebar-submenu">#}
{##}
{# <ul>#}
{# <li><a href="{% url 'terminal' %}"#}
{# title="{% trans 'Web Based Terminal' %}"><span>{% trans "Terminal" %}</span></a>#}
{# </li>#}
{# </ul>#}
{# </div><!-- .sidebar-submenu -->#}
{# </li>#}

<li id="sidebar-menu-item-cloudlinux">
<a href="#" title="{% trans 'CloudLinux' %}">
Expand Down Expand Up @@ -1148,6 +1115,8 @@
</ul><!-- #sidebar-menu -->
</div>
</div>


<div id="page-content-wrapper">
<div id="page-content">

Expand Down
47 changes: 47 additions & 0 deletions baseTemplate/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,53 @@ def renderBase(request):
return proc.render()


@ensure_csrf_cookie
def versionManagement(request):
getVersion = requests.get('https://cyberpanel.net/version.txt')
latest = getVersion.json()
latestVersion = latest['version']
latestBuild = latest['build']

currentVersion = VERSION
currentBuild = str(BUILD)

u = "https://api.github.com/repos/usmannasir/cyberpanel/commits?sha=v%s.%s" % (latestVersion, latestBuild)
logging.writeToFile(u)
r = requests.get(u)
latestcomit = r.json()[0]['sha']

command = "git -C /usr/local/CyberCP/ rev-parse HEAD"
output = ProcessUtilities.outputExecutioner(command)

Currentcomt = output.rstrip("\n")
notechk = True

if Currentcomt == latestcomit:
notechk = False


template = 'baseTemplate/versionManagment.html'
finalData = {'build': currentBuild, 'currentVersion': currentVersion, 'latestVersion': latestVersion,
'latestBuild': latestBuild, 'latestcomit': latestcomit, "Currentcomt": Currentcomt, "Notecheck": notechk}

proc = httpProc(request, template, finalData, 'versionManagement')
return proc.render()

@ensure_csrf_cookie
def upgrade_cyberpanel(request):
if request.method == 'POST':
try:
upgrade_command = 'sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh)'
result = subprocess.run(upgrade_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)

if result.returncode == 0:
response_data = {'success': True, 'message': 'CyberPanel upgrade completed successfully.'}
else:
response_data = {'success': False, 'message': 'CyberPanel upgrade failed. Error output: ' + result.stderr}
except Exception as e:
response_data = {'success': False, 'message': 'An error occurred during the upgrade: ' + str(e)}


def getAdminStatus(request):
try:
val = request.session['userID']
Expand Down
2 changes: 1 addition & 1 deletion cli/cliParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def prepareArguments(self):
## Database Arguments

parser.add_argument('--dbName', help='Database name.')
parser.add_argument('--dbUsername', help='Datbase username.')
parser.add_argument('--dbUsername', help='Database username.')
parser.add_argument('--dbPassword', help='Database password.')
parser.add_argument('--databaseWebsite', help='Database website.')

Expand Down
15 changes: 4 additions & 11 deletions cli/cyberPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,11 @@ def listWebsitesJson(self):

websites = Websites.objects.all()
ipFile = "/etc/cyberpanel/machineIP"
f = open(ipFile)
ipData = f.read()
with open(ipFile, 'r') as f:
ipData = f.read()
ipAddress = ipData.split('\n', 1)[0]

json_data = "["
checker = 0
json_data = []

for items in websites:
if items.state == 0:
Expand All @@ -134,14 +133,8 @@ def listWebsitesJson(self):
state = "Active"
dic = {'domain': items.domain, 'adminEmail': items.adminEmail, 'ipAddress': ipAddress,
'admin': items.admin.userName, 'package': items.package.packageName, 'state': state}
json_data.append(dic)

if checker == 0:
json_data = json_data + json.dumps(dic)
checker = 1
else:
json_data = json_data + ',' + json.dumps(dic)

json_data = json_data + ']'
final_json = json.dumps(json_data)
print(final_json)

Expand Down
10 changes: 5 additions & 5 deletions cloudAPI/cloudManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1070,11 +1070,11 @@ def showStatus(self, request):

def fetchRam(self, request):
try:
request.session['userID'] = self.admin.pk
currentACL = ACLManager.loadedACL(self.admin.pk)

if currentACL['admin'] == 0:
return self.ajaxPre(0, 'Only administrators can see MySQL status.')
# request.session['userID'] = self.admin.pk
# currentACL = ACLManager.loadedACL(self.admin.pk)
#
# if currentACL['admin'] == 0:
# return self.ajaxPre(0, 'Only administrators can see MySQL status.')

# if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu:
# return self.ajaxPre(0, 'This feature is currently only available on CentOS.')
Expand Down
Loading

0 comments on commit 834147b

Please sign in to comment.