mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-01-29 18:59:04 +01:00
Merge pull request #1139 from master3395/v2.3.5-dev
Internal Upgrader + Latest PHPMyAdmin
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
# coding=utf-8
|
||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||
import json
|
||||
from django.shortcuts import HttpResponse, render
|
||||
import json
|
||||
import re
|
||||
from loginSystem.models import Administrator
|
||||
|
||||
class secMiddleware:
|
||||
|
||||
HIGH = 0
|
||||
LOW = 1
|
||||
|
||||
@@ -107,7 +106,7 @@ class secMiddleware:
|
||||
")") > -1 \
|
||||
or value.find("'") > -1 or value.find("[") > -1 or value.find("]") > -1 or value.find(
|
||||
"{") > -1 or value.find("}") > -1 \
|
||||
or value.find(":") > -1 or value.find("<") > -1 or value.find(">") > -1:
|
||||
or value.find(":") > -1 or value.find("<") >-1 or value.find(">") > -1:
|
||||
logging.writeToFile(request.body)
|
||||
final_dic = {
|
||||
'error_message': "Data supplied is not accepted, following characters are not allowed in the input ` $ & ( ) [ ] { } ; : ‘ < >.",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,36 @@
|
||||
{% extends "baseTemplate/index.html" %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Version Management - CyberPanel" %}*{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% load static %}
|
||||
|
||||
<style>
|
||||
/* Add these styles for the buttons and select dropdown */
|
||||
.button-style,
|
||||
#branchSelect {
|
||||
background-color: rgb(62, 72, 85);
|
||||
color: #fff;
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
/* Apply these styles when hovering over the buttons or select dropdown */
|
||||
.button-style:hover,
|
||||
#branchSelect:hover {
|
||||
background-color: darken(rgb(62, 72, 85), 10%);
|
||||
}
|
||||
|
||||
/* Add these styles for the textarea */
|
||||
textarea {
|
||||
background-color: rgb(62, 72, 85);
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="container">
|
||||
<div id="page-title">
|
||||
<h2>{% trans "Version Management" %}</h2>
|
||||
@@ -12,7 +38,7 @@
|
||||
</div>
|
||||
{% if Notecheck %}
|
||||
<div class="alert alert-info">
|
||||
<p style="color:red; font-weight: bold ;">{% trans "Note: Latest commit does not match, please upgrade CyberPanel." %}</p>
|
||||
<p style="color:red; font-weight: bold;">{% trans "Note: Latest commit does not match, please upgrade CyberPanel." %}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -22,10 +48,45 @@
|
||||
CyberPanel
|
||||
</h3>
|
||||
<div ng-controller="versionManagment" class="example-box-wrapper">
|
||||
<form action="{% url 'upgrade_cyberpanel' %}" method="post">
|
||||
{% csrf_token %}
|
||||
<button type="submit">Upgrade CyberPanel</button>
|
||||
<div class="form-group">
|
||||
<label for="branchSelect">{% trans "Select Branch:" %}</label>
|
||||
<select id="branchSelect" class="button-style"></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" onclick="upgradeCyberPanel()" class="button-style">{% trans "Upgrade CyberPanel to selected branch" %}</button>
|
||||
<button type="submit" onclick="refreshPage()" class="button-style line-over">{% trans "Refresh page" %}</button>
|
||||
</div>
|
||||
|
||||
<form action="/" class="form-horizontal bordered-row">
|
||||
<!-- Existing Commit Information -->
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label" style="margin: 0px!important; padding: 0px!important;">{% trans "Current Version:" %}  </label>
|
||||
<div class="current-pack col-sm-9" style="margin: 0px!important; padding: 0px!important;">{{ currentVersion }}</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label" style="margin: 0px!important; padding: 0px!important;">{% trans "Build:" %}  </label>
|
||||
<div class="current-pack col-sm-9" style="margin: 0px!important; padding: 0px!important;">{{ build }}</div>
|
||||
<label class="col-sm-3 control-label" style="margin: 0px!important; padding: 0px!important;">{% trans "Current Commit:" %}  </label>
|
||||
<div class="current-pack col-sm-9" style="margin: 0px!important; padding: 0px!important;">{{ Currentcomt }}</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label" style="margin: 0px!important; padding: 0px!important;">{% trans "Latest Version:" %}  </label>
|
||||
<div class="current-pack col-sm-9" style="margin: 0px!important; padding: 0px!important;">{{ latestVersion }}</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label" style="margin: 0px!important; padding: 0px!important;">{% trans "Latest Build:" %}  </label>
|
||||
<div class="current-pack col-sm-9" style="margin: 0px!important; padding: 0px!important;">{{ latestBuild }}</div>
|
||||
<label class="col-sm-3 control-label" style="margin: 0px!important; padding: 0px!important;">{% trans "Latest Commit:" %}  </label>
|
||||
<div class="current-pack col-sm-9" style="margin: 0px!important; padding: 0px!important;">{{ latestcomit }}</div>
|
||||
</div>
|
||||
|
||||
<!-- New Upgrade Progress Log Section -->
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label" style="margin: 0px!important; padding: 0px!important;">{% trans "Upgrade Progress Log:" %}</label>
|
||||
<div id="upgradeProgressLog" class="current-pack col-sm-9" style="margin: 0px!important; padding: 0px!important;"></div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div ng-hide="upgradelogBox" class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<textarea ng-model="upgradeLog" rows="30" class="form-control">{{ logs }}</textarea>
|
||||
@@ -34,47 +95,121 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<div class panel-body>
|
||||
<h3 class="title-hero">
|
||||
CyberPanel
|
||||
</h3>
|
||||
<div ng-controller="versionManagment" class="example-box-wrapper">
|
||||
<form action="/" class="form-horizontal bordered-row">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label " style="margin: 0px!important; padding: 0px!important;">{% trans "Current Version:" %}  </label>
|
||||
<div class="current-pack col-sm-9" style="margin: 0px!important; padding: 0px!important;">{{ currentVersion }} </div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label " style="margin: 0px!important; padding: 0px!important;">{% trans "Build:" %}  </label>
|
||||
<div class="current-pack col-sm-9" style="margin: 0px!important; padding: 0px!important;">{{ build }} </div>
|
||||
<label class="col-sm-3 control-label " style="margin: 0px!important; padding: 0px!important;">{% trans "Current Commit:" %}  </label>
|
||||
<div class="current-pack col-sm-9" style="margin: 0px!important; padding: 0px!important;">{{ Currentcomt }} </div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label " style="margin: 0px!important; padding: 0px!important;">{% trans "Latest Version:" %}  </label>
|
||||
<div class="current-pack col-sm-9" style="margin: 0px!important; padding: 0px!important;">{{ latestVersion }} </div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label " style="margin: 0px!important; padding: 0px!important;">{% trans "Latest Build:" %}  </label>
|
||||
<div class="current-pack col-sm-9" style="margin: 0px!important; padding: 0px!important;">{{ latestBuild }} </div>
|
||||
<label class="col-sm-3 control-label " style="margin: 0px!important; padding: 0px!important;">{% trans "Latest Commit:" %}  </label>
|
||||
<div class="current-pack col-sm-9" style="margin: 0px!important; padding: 0px!important;">{{ latestcomit }} </div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="upgradelogBox" class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<textarea ng-model="upgradeLog" rows="30" class="form-control">{{ logs }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
<script>
|
||||
// Function to populate the branch dropdown
|
||||
function populateBranches(branches) {
|
||||
var branchSelect = document.getElementById("branchSelect");
|
||||
branches.forEach((branch) => {
|
||||
var option = document.createElement("option");
|
||||
option.value = branch;
|
||||
option.text = branch;
|
||||
branchSelect.appendChild(option);
|
||||
});
|
||||
}
|
||||
|
||||
function getBranches(url, branches, page) {
|
||||
if (!page) page = 1;
|
||||
fetch(url + '?page=' + page)
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
if (data.length === 0) {
|
||||
populateBranches(branches);
|
||||
} else {
|
||||
const branchNames = data.map(branch => branch.name);
|
||||
branches = branches.concat(branchNames);
|
||||
getBranches(url, branches, page + 1);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error fetching branches: ' + error);
|
||||
});
|
||||
}
|
||||
|
||||
// Call the function to get all branches
|
||||
getBranches('https://api.github.com/repos/usmannasir/cyberpanel/branches', [], 1);
|
||||
|
||||
function upgradeCyberPanel() {
|
||||
try {
|
||||
var selectedBranch = document.getElementById("branchSelect").value;
|
||||
|
||||
// Use the shell script URL based on the selected branch
|
||||
var shellScriptUrl = `https://raw.githubusercontent.com/usmannasir/cyberpanel/${selectedBranch}/cyberpanel_upgrade.sh`;
|
||||
|
||||
if (confirm("Are you sure you want to upgrade to the selected branch from the remote script?")) {
|
||||
// Use fetch to trigger a server-side action (execute shell script)
|
||||
fetch('/upgrade', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
scriptUrl: shellScriptUrl,
|
||||
}),
|
||||
})
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to start upgrade. HTTP status ${response.status}`);
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
// Log the response from the server
|
||||
console.log('Upgrade response:', data);
|
||||
|
||||
// Check if the progress value is defined and a finite number before setting it on the progress bar
|
||||
if (typeof data.progress !== 'undefined' && isFinite(data.progress)) {
|
||||
var upgradeProgressLog = document.getElementById("upgradeProgressLog");
|
||||
upgradeProgressLog.innerText = 'Upgrade Progress: ' + data.progress + '%';
|
||||
// You may also update other UI elements based on the response data
|
||||
} else {
|
||||
console.error('Invalid progress value received from the server:', data.progress);
|
||||
var upgradeProgressLog = document.getElementById("upgradeProgressLog");
|
||||
upgradeProgressLog.innerText = 'Upgrade failed. Invalid progress value received from the server.';
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Upgrade failed. Error starting upgrade:', error);
|
||||
alert('Upgrade failed. Error starting upgrade. Check the console for details.');
|
||||
});
|
||||
|
||||
// Download and execute the upgrade script using wget
|
||||
fetch(shellScriptUrl)
|
||||
.then(response => response.text())
|
||||
.then(scriptContent => {
|
||||
// Create a Blob from the script content
|
||||
var blob = new Blob([scriptContent], { type: 'text/plain' });
|
||||
|
||||
// Create a temporary URL for the Blob
|
||||
var scriptUrl = URL.createObjectURL(blob);
|
||||
|
||||
// Create an invisible iframe to trigger the download
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.style.display = 'none';
|
||||
iframe.src = scriptUrl;
|
||||
document.body.appendChild(iframe);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Failed to download upgrade script:', error);
|
||||
alert('Failed to download upgrade script. Check the console for details.');
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('An unexpected error occurred:', error);
|
||||
|
||||
// Additional error handling
|
||||
alert('An unexpected error occurred during the upgrade. Check the console for details.');
|
||||
|
||||
// Log detailed error information
|
||||
console.error('Detailed error information:', error);
|
||||
}
|
||||
}
|
||||
|
||||
function refreshPage() {
|
||||
location.reload();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
@@ -6,7 +6,7 @@ urlpatterns = [
|
||||
url(r'^getSystemStatus$',views.getSystemStatus, name='getSystemInformation'),
|
||||
url(r'^getAdminStatus',views.getAdminStatus, name='getSystemInformation'),
|
||||
url(r'^getLoadAverage',views.getLoadAverage, name='getLoadAverage'),
|
||||
url(r'^versionManagment',views.versionManagement, name='versionManagment'),
|
||||
url(r'^versionManagment',views.versionManagment, name='versionManagment'),
|
||||
url(r'^design', views.design, name='design'),
|
||||
url(r'^getthemedata', views.getthemedata, name='getthemedata'),
|
||||
|
||||
@@ -15,9 +15,4 @@ urlpatterns = [
|
||||
url(r'^UpgradeStatus',views.upgradeStatus, name='UpgradeStatus'),
|
||||
url(r'^upgradeVersion',views.upgradeVersion, name='upgradeVersion'),
|
||||
|
||||
# Add this URL pattern for 'upgrade_cyberpanel'
|
||||
url(r'upgrade_cyberpanel', views.upgrade_cyberpanel, name='upgrade_cyberpanel'),
|
||||
url(r'UpgradeStatus', views.upgradeStatus, name='UpgradeStatus'),
|
||||
url(r'upgradeVersion', views.upgradeVersion, name='upgradeVersion'),
|
||||
|
||||
]
|
||||
@@ -1,23 +1,27 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from django.shortcuts import render, redirect
|
||||
from django.http import HttpResponse, JsonResponse
|
||||
from django.http import HttpResponse
|
||||
from plogical.getSystemInformation import SystemInformation
|
||||
import json
|
||||
from loginSystem.views import loadLoginPage
|
||||
from .models import version
|
||||
import requests
|
||||
import subprocess
|
||||
import shlex
|
||||
import os
|
||||
import json
|
||||
from plogical.getSystemInformation import SystemInformation
|
||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||
import plogical.CyberCPLogFileWriter as logging
|
||||
from plogical.acl import ACLManager
|
||||
from manageServices.models import PDNSStatus
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from plogical.processUtilities import ProcessUtilities
|
||||
from plogical.httpProc import httpProc
|
||||
|
||||
# Create your views here.
|
||||
|
||||
VERSION = '2.3'
|
||||
BUILD = 4
|
||||
|
||||
|
||||
@ensure_csrf_cookie
|
||||
def renderBase(request):
|
||||
template = 'baseTemplate/homePage.html'
|
||||
@@ -27,6 +31,7 @@ def renderBase(request):
|
||||
proc = httpProc(request, template, finaData)
|
||||
return proc.render()
|
||||
|
||||
|
||||
@ensure_csrf_cookie
|
||||
def versionManagement(request):
|
||||
getVersion = requests.get('https://cyberpanel.net/version.txt')
|
||||
@@ -73,14 +78,13 @@ def upgrade_cyberpanel(request):
|
||||
except Exception as e:
|
||||
response_data = {'success': False, 'message': 'An error occurred during the upgrade: ' + str(e)}
|
||||
|
||||
return JsonResponse(response_data)
|
||||
|
||||
@ensure_csrf_cookie
|
||||
def getAdminStatus(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(val)
|
||||
|
||||
|
||||
if os.path.exists('/home/cyberpanel/postfix'):
|
||||
currentACL['emailAsWhole'] = 1
|
||||
else:
|
||||
@@ -111,6 +115,7 @@ def getAdminStatus(request):
|
||||
except KeyError:
|
||||
return HttpResponse("Can not get admin Status")
|
||||
|
||||
|
||||
def getSystemStatus(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
@@ -121,6 +126,7 @@ def getSystemStatus(request):
|
||||
except KeyError:
|
||||
return HttpResponse("Can not get admin Status")
|
||||
|
||||
|
||||
def getLoadAverage(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
@@ -136,7 +142,53 @@ def getLoadAverage(request):
|
||||
except KeyError:
|
||||
return HttpResponse("Not allowed.")
|
||||
|
||||
|
||||
@ensure_csrf_cookie
|
||||
def versionManagment(request):
|
||||
## Get latest version
|
||||
|
||||
getVersion = requests.get('https://cyberpanel.net/version.txt')
|
||||
latest = getVersion.json()
|
||||
latestVersion = latest['version']
|
||||
latestBuild = latest['build']
|
||||
|
||||
## Get local version
|
||||
|
||||
currentVersion = VERSION
|
||||
currentBuild = str(BUILD)
|
||||
|
||||
u = "https://api.github.com/repos/usmannasir/cyberpanel/commits?sha=v%s.%s" % (latestVersion, latestBuild)
|
||||
logging.CyberCPLogFileWriter.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
|
||||
|
||||
# command ="git fetch -C /usr/local/CyberCP/"
|
||||
# output = ProcessUtilities.outputExecutioner(command)
|
||||
#
|
||||
# command ="git -C /usr/local/CyberCP/ log %s..%s --pretty=oneline | wc -l" % ( Currentcomt, latestcomit)
|
||||
# output = ProcessUtilities.outputExecutioner(command)
|
||||
#
|
||||
# numCommits = output.rstrip("\n")
|
||||
|
||||
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()
|
||||
|
||||
|
||||
def upgrade(request):
|
||||
try:
|
||||
admin = request.session['userID']
|
||||
@@ -147,28 +199,38 @@ def upgrade(request):
|
||||
pass
|
||||
|
||||
command = 'wget http://cyberpanel.net/upgrade.py'
|
||||
|
||||
cmd = shlex.split(command)
|
||||
|
||||
res = subprocess.call(cmd)
|
||||
|
||||
vers = version.objects.get(pk=1)
|
||||
from plogical.upgrade import Upgrade
|
||||
|
||||
from upgrade import Upgrade
|
||||
|
||||
Upgrade.initiateUpgrade(vers.currentVersion, vers.build)
|
||||
|
||||
adminData = {"upgrade": 1}
|
||||
|
||||
json_data = json.dumps(adminData)
|
||||
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
except KeyError:
|
||||
adminData = {"upgrade": 1, "error_message": "Please login or refresh this page."}
|
||||
json_data = json.dumps(adminData)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
@ensure_csrf_cookie
|
||||
|
||||
def upgradeStatus(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
path = "/usr/local/lscp/logs/upgradeLog"
|
||||
|
||||
try:
|
||||
upgradeLog = open(path, "r").read()
|
||||
except:
|
||||
@@ -178,13 +240,16 @@ def upgradeStatus(request):
|
||||
return HttpResponse(final_json)
|
||||
|
||||
if upgradeLog.find("Upgrade Completed") > -1:
|
||||
|
||||
vers = version.objects.get(pk=1)
|
||||
getVersion = requests.get('https://cyberpanel.net/version.txt')
|
||||
latest = getVersion.json()
|
||||
vers.currentVersion = latest['version']
|
||||
vers.build = latest['build']
|
||||
vers.save()
|
||||
|
||||
os.remove(path)
|
||||
|
||||
final_json = json.dumps({'finished': 1, 'upgradeStatus': 1,
|
||||
'error_message': "None",
|
||||
'upgradeLog': upgradeLog})
|
||||
@@ -194,6 +259,8 @@ def upgradeStatus(request):
|
||||
'error_message': "None",
|
||||
'upgradeLog': upgradeLog})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
except BaseException as msg:
|
||||
final_dic = {'upgradeStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
@@ -203,6 +270,7 @@ def upgradeStatus(request):
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def upgradeVersion(request):
|
||||
try:
|
||||
vers = version.objects.get(pk=1)
|
||||
@@ -216,8 +284,10 @@ def upgradeVersion(request):
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
|
||||
@ensure_csrf_cookie
|
||||
def design(request):
|
||||
### Load Custom CSS
|
||||
try:
|
||||
from baseTemplate.models import CyberPanelCosmetic
|
||||
cosmetic = CyberPanelCosmetic.objects.get(pk=1)
|
||||
@@ -241,8 +311,12 @@ def design(request):
|
||||
cosmetic.save()
|
||||
finalData['saved'] = 1
|
||||
|
||||
####### Fetch sha...
|
||||
|
||||
sha_url = "https://api.github.com/repos/usmannasir/CyberPanel-Themes/commits"
|
||||
|
||||
sha_res = requests.get(sha_url)
|
||||
|
||||
sha = sha_res.json()[0]['sha']
|
||||
|
||||
l = "https://api.github.com/repos/usmannasir/CyberPanel-Themes/git/trees/%s" % sha
|
||||
@@ -259,6 +333,7 @@ def design(request):
|
||||
proc = httpProc(request, template, finalData, 'versionManagement')
|
||||
return proc.render()
|
||||
|
||||
|
||||
def getthemedata(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
@@ -270,9 +345,12 @@ def getthemedata(request):
|
||||
else:
|
||||
return ACLManager.loadErrorJson('reboot', 0)
|
||||
|
||||
#logging.CyberCPLogFileWriter.writeToFile(str(data) + " [themedata]")
|
||||
|
||||
url = "https://raw.githubusercontent.com/usmannasir/CyberPanel-Themes/main/%s/design.css" % data['Themename']
|
||||
|
||||
res = requests.get(url)
|
||||
|
||||
rsult = res.text
|
||||
final_dic = {'status': 1, 'csscontent': rsult}
|
||||
final_json = json.dumps(final_dic)
|
||||
@@ -281,3 +359,4 @@ def getthemedata(request):
|
||||
final_dic = {'status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
BIN
phpmyadmin.zip
BIN
phpmyadmin.zip
Binary file not shown.
Reference in New Issue
Block a user