Skip to content

Commit

Permalink
Fix prefix (#12)
Browse files Browse the repository at this point in the history
* testing cors again, now with js headers! (#1)

Co-authored-by: ctih <nevalaonni@proton.me>

* added error handling

* Error handling on register (#2)

* testing cors again, now with js headers!

* added error handling

---------

Co-authored-by: ctih <nevalaonni@proton.me>

* made some clear changes for users that dont know shi

* handled errors more!

* added some new styles

* added something

* fixed the 'Undefined.frii.site' when user does not have a domain, or does not exist

* Merge branch 'master' of https://github.com/ctih1/frii.site-frontend into error-handling

* git is horrible and i want to kill myself

* removed .frii.site if it existed in domain

---------

Co-authored-by: ctih <nevalaonni@proton.me>
  • Loading branch information
ctih1 and ctih committed Mar 5, 2024
1 parent 3cde932 commit f459382
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions account/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ var record_type_field;
var changedDomains = new Map();
var current_record;

function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}

function isLoggedIn() {
var TOKEN = localStorage.getItem("TOKEN");
var statusCode
Expand All @@ -39,7 +35,6 @@ function isLoggedIn() {

function changed(from) {
changedDomains.set(from.parentNode.parentNode.children[0].textContent,from.value)
console.log(changedDomains);
}

function addDomain(domain, ipv4, true_domain, type) {
Expand All @@ -66,6 +61,10 @@ async function saveCustomDomain(element) {
var values = element.parentNode.parentNode; // the values of each field.
var type = values.children[0].children[0].children[0].textContent.trim();
var content = values.children[1].children[0].value;
var isCompleteDomain = content.indexOf('frii.site')!==-1;
if(isCompleteDomain) {
content = content.replace('.frii.site',"");
}
var value = values.children[2].children[0].value;
if(type!==undefined&&content!==undefined&&value!==undefined){
var creds = {
Expand Down Expand Up @@ -104,13 +103,16 @@ async function saveCustomDomain(element) {
}
});
}
console.log(type,content,value);
}

async function deleteDomain(element) {
var values = element.parentNode.parentNode; // the values of each field. var type = values.children[0].children[0].children[0].textContent.trim();
var domain = values.children[1].innerHTML;

var isCompleteDomain = domain.indexOf('frii.site')!==-1;
if(isCompleteDomain) {
domain = domain.replace('.frii.site',"");
}
var creds = {
"domain": domain,
"TOKEN": localStorage.getItem("TOKEN")
Expand Down Expand Up @@ -241,13 +243,10 @@ async function getDomains() {
.then(response => response.json()).then(data => {
domains = new Map(Object.entries(data));
})
console.log(domains.size);
if(domains.size===0) {
window.location.href="../register/index.html";
}
for( var [key,value] of domains ){
console.log(domains);
console.log(value["type"]===undefined);
if(value["type"]!==undefined) {
addDomain(key,value["ip"],value["true-domain"], value["type"]);
}
Expand All @@ -265,6 +264,5 @@ function createNewField() {

function changeDropdown(element) {
record_dd = document.getElementById("record-dropdown");
console.log(element);
record_dd.innerHTML = element.textContent;
}

0 comments on commit f459382

Please sign in to comment.