usmannasir
2024-03-26 17:58:29 +04:00
5 changed files with 124 additions and 5 deletions

View File

@@ -223,6 +223,8 @@ class DNSManager:
fetchType = 'AAAA'
elif currentSelection == 'cNameRecord':
fetchType = 'CNAME'
elif currentSelection == 'httpsRecord':
fetchType = 'HTTPS'
elif currentSelection == 'mxRecord':
fetchType = 'MX'
elif currentSelection == 'txtRecord':
@@ -355,7 +357,21 @@ class DNSManager:
recordContentCNAME = data['recordContentCNAME'] ## IP or pointing value
DNS.createDNSRecord(zone, value, recordType, recordContentCNAME, 0, ttl)
elif recordType == "HTTPS":
if recordName == "@":
value = zoneDomain
## re.match
elif match(r'([1-9][0-9]{0,5})\s([\da-z\.-]+\.[a-z\.]{2,12}|[\d\.]+)([\/:?=&#]{1}[\da-z\.-]+)*[\/\?]?\s?(alpn=[\da-z,-]+)?\s?(ipv4hint=[\d.,]+)?\s?(ipv6hint=[\da-zA-Z:,]+)?', recordName,
M | I):
value = recordName
else:
value = recordName + "." + zoneDomain
recordContentHTTPS = data['recordContentHTTPS'] ## ## valid value with priority, cname link or domain and alpn and ipv4, ipv6 hints
DNS.createDNSRecord(zone, value, recordType, recordContentHTTPS, 0, ttl)
elif recordType == "SPF":
if recordName == "@":
@@ -743,6 +759,8 @@ class DNSManager:
fetchType = 'AAAA'
elif currentSelection == 'cNameRecord':
fetchType = 'CNAME'
elif currentSelection == 'httpsRecord':
fetchType = 'HTTPS'
elif currentSelection == 'mxRecord':
fetchType = 'MX'
elif currentSelection == 'txtRecord':
@@ -949,6 +967,21 @@ class DNSManager:
DNS.createDNSRecordCloudFlare(cf, zone, value, recordType, recordContentCNAME, 0, ttl)
elif recordType == "HTTPS":
if recordName == "@":
value = zoneDomain
## re.match
elif match(r'([1-9][0-9]{0,5})\s([\da-z\.-]+\.[a-z\.]{2,12}|[\d\.]+)([\/:?=&#]{1}[\da-z\.-]+)*[\/\?]?\s?(alpn=[\da-z,-]+)?\s?(ipv4hint=[\d.,]+)?\s?(ipv6hint=[\da-zA-Z:,]+)?', recordName,
M | I):
value = recordName
else:
value = recordName + "." + zoneDomain
recordContentHTTPS = data['recordContentHTTPS'] ## valid value with priority, cname link or domain and alpn and ipv4, ipv6 hints
DNS.createDNSRecordCloudFlare(cf, zone, value, recordType, recordContentHTTPS, 0, ttl)
elif recordType == "SPF":
if recordName == "@":
@@ -1396,4 +1429,4 @@ def main():
ftp.ResetDNSConfigurations()
if __name__ == "__main__":
main()
main()

View File

@@ -170,6 +170,7 @@ app.controller('addModifyDNSRecords', function ($scope, $http) {
// Hide records boxes
$(".aaaaRecord").hide();
$(".cNameRecord").hide();
$(".httpsRecord").hide();
$(".mxRecord").hide();
$(".txtRecord").hide();
$(".spfRecord").hide();
@@ -239,6 +240,12 @@ app.controller('addModifyDNSRecords', function ($scope, $http) {
data.recordContentCNAME = $scope.recordContentCNAME;
data.ttl = $scope.ttl;
data.recordType = type;
} else if (type === "HTTPS") {
data.selectedZone = $scope.selectedZone;
data.recordName = $scope.recordName;
data.recordContentHTTPS = $scope.recordContentHTTPS;
data.ttl = $scope.ttl;
data.recordType = type;
} else if (type === "SPF") {
data.selectedZone = $scope.selectedZone;
data.recordName = $scope.recordName;
@@ -815,6 +822,7 @@ app.controller('addModifyDNSRecordsCloudFlare', function ($scope, $http, $window
// Hide records boxes
$(".aaaaRecord").hide();
$(".cNameRecord").hide();
$(".httpsRecord").hide();
$(".mxRecord").hide();
$(".txtRecord").hide();
$(".spfRecord").hide();
@@ -883,6 +891,12 @@ app.controller('addModifyDNSRecordsCloudFlare', function ($scope, $http, $window
data.recordContentCNAME = $scope.recordContentCNAME;
data.ttl = $scope.ttl;
data.recordType = type;
} else if (type === "HTTPS") {
data.selectedZone = $scope.selectedZone;
data.recordName = $scope.recordName;
data.recordContentHTTPS = $scope.recordContentHTTPS;
data.ttl = $scope.ttl;
data.recordType = type;
} else if (type === "SPF") {
data.selectedZone = $scope.selectedZone;
data.recordName = $scope.recordName;
@@ -1458,4 +1472,5 @@ app.controller('ResetDNSconf', function ($scope, $http, $timeout){
}
}
});
});

View File

@@ -64,6 +64,8 @@
href="">AAAA</a></li>
<li ng-click="fetchRecordsTabs('cNameRecord')" id="cNameRecord"><a
href="">CNAME</a></li>
<li ng-click="fetchRecordsTabs('httpsRecord')" id="httpsRecord"><a
href="">HTTPS</a></li>
<li ng-click="fetchRecordsTabs('mxRecord')" id="mxRecord"><a href="">MX</a></li>
<li ng-click="fetchRecordsTabs('txtRecord')" id="txtRecord"><a href="">TXT</a>
</li>
@@ -158,6 +160,32 @@
<!------------- CNAME Record box ------------->
<!------------- HTTPS Record box ------------->
<div class="col-sm-3 httpsRecord">
<input placeholder="{% trans 'Name' %}" type="text" class="form-control"
ng-model="recordName" required>
</div>
<div class="col-sm-3 httpsRecord">
<input placeholder="{% trans 'TTL' %}" type="number" min="0" max="86400" class="form-control"
ng-model="ttl" required>
</div>
<div class="col-sm-3 httpsRecord">
<input placeholder="{% trans 'Text' %}" type="text" class="form-control"
ng-model="recordContentHTTPS" required>
</div>
<div class="col-sm-3 httpsRecord">
<button style="width: 100%;" type="button" ng-click="addDNSRecord('HTTPS')"
class="btn btn-primary">{% trans "Add" %}</button>
</div>
<!------------- HTTPS Record box ------------->
<!------------- MX Record box ------------->
@@ -187,7 +215,7 @@
class="btn btn-primary">{% trans "Add" %}</button>
</div>
<!------------- CNAME Record box ------------->
<!------------- MX Record box ------------->
<!------------- SPF Record box ------------->

View File

@@ -137,6 +137,9 @@
<li ng-click="fetchRecordsTabs('cNameRecord')"
id="cNameRecord"><a href="">CNAME</a>
</li>
<li ng-click="fetchRecordsTabs('httpsRecord')"
id="httpsRecord"><a href="">HTTPS</a>
</li>
<li ng-click="fetchRecordsTabs('mxRecord')"
id="mxRecord"><a href="">MX</a>
</li>
@@ -254,6 +257,32 @@
<!------------- CNAME Record box ------------->
<!------------- HTTPS Record box ------------->
<div class="col-sm-3 httpsRecord">
<input placeholder="{% trans 'Name' %}" type="text" class="form-control"
ng-model="recordName" required>
</div>
<div class="col-sm-3 httpsRecord">
<input placeholder="{% trans 'TTL' %}" type="number" min="0" max="86400" class="form-control"
ng-model="ttl" required>
</div>
<div class="col-sm-3 httpsRecord">
<input placeholder="{% trans 'Text' %}" type="text" class="form-control"
ng-model="recordContentHTTPS" required>
</div>
<div class="col-sm-3 httpsRecord">
<button style="width: 100%;" type="button" ng-click="addDNSRecord('HTTPS')"
class="btn btn-primary">{% trans "Add" %}</button>
</div>
<!------------- HTTPS Record box ------------->
<!------------- MX Record box ------------->
@@ -288,7 +317,7 @@
class="btn btn-primary">{% trans "Add" %}</button>
</div>
<!------------- CNAME Record box ------------->
<!------------- MX Record box ------------->
<!------------- SPF Record box ------------->

View File

@@ -170,6 +170,7 @@ app.controller('addModifyDNSRecords', function ($scope, $http) {
// Hide records boxes
$(".aaaaRecord").hide();
$(".cNameRecord").hide();
$(".httpsRecord").hide();
$(".mxRecord").hide();
$(".txtRecord").hide();
$(".spfRecord").hide();
@@ -239,6 +240,12 @@ app.controller('addModifyDNSRecords', function ($scope, $http) {
data.recordContentCNAME = $scope.recordContentCNAME;
data.ttl = $scope.ttl;
data.recordType = type;
} else if (type === "HTTPS") {
data.selectedZone = $scope.selectedZone;
data.recordName = $scope.recordName;
data.recordContentHTTPS = $scope.recordContentHTTPS;
data.ttl = $scope.ttl;
data.recordType = type;
} else if (type === "SPF") {
data.selectedZone = $scope.selectedZone;
data.recordName = $scope.recordName;
@@ -815,6 +822,7 @@ app.controller('addModifyDNSRecordsCloudFlare', function ($scope, $http, $window
// Hide records boxes
$(".aaaaRecord").hide();
$(".cNameRecord").hide();
$(".httpsRecord").hide();
$(".mxRecord").hide();
$(".txtRecord").hide();
$(".spfRecord").hide();
@@ -883,6 +891,12 @@ app.controller('addModifyDNSRecordsCloudFlare', function ($scope, $http, $window
data.recordContentCNAME = $scope.recordContentCNAME;
data.ttl = $scope.ttl;
data.recordType = type;
} else if (type === "HTTPS") {
data.selectedZone = $scope.selectedZone;
data.recordName = $scope.recordName;
data.recordContentHTTPS = $scope.recordContentHTTPS;
data.ttl = $scope.ttl;
data.recordType = type;
} else if (type === "SPF") {
data.selectedZone = $scope.selectedZone;
data.recordName = $scope.recordName;
@@ -1308,4 +1322,4 @@ app.controller('addModifyDNSRecordsCloudFlare', function ($scope, $http, $window
});
/* Java script code for CloudFlare */
/* Java script code for CloudFlare */