add editor for single configs

This commit is contained in:
Jakob 2021-11-12 17:47:00 +01:00
parent b4881b8c7c
commit 430ae9d48b
6 changed files with 7503 additions and 29 deletions

View file

@ -15,6 +15,7 @@ For more information, see the website of the tool itself: https://dns.notjakob.c
- Eli Grey for [FileSaver.js](https://github.com/eligrey/FileSaver.js)
- uuidjs for the [UUID JavaScript library](https://github.com/uuidjs/uuid)
- Nathan Rajlich for [plist.js](https://github.com/TooTallNate/plist.js)
- Paul Miller for [his excellent article](https://paulmillr.com/posts/encrypted-dns/) and the [premade profiles](https://github.com/paulmillr/encrypted-dns)
- W3schools for [w3.css](https://www.w3schools.com/w3css/)
- nitrohorse for [encrypted-dns.party](https://encrypted-dns.party) and the profiles hosted there

View file

@ -22,14 +22,17 @@
<a href="index.html" class="w3-bar-item w3-button w3-green w3-mobile">About</a>
<a href="tool.html" class="w3-bar-item w3-button w3-mobile">Tool</a>
<a href="finalize.html" class="w3-bar-item w3-button w3-mobile">Finalize</a>
<a href="https://github.com/fyr77/dns-mobileconfig" class="w3-bar-item w3-button w3-right w3-black w3-mobile">GitHub</a>
<a href="https://github.com/fyr77/dns-mobileconfig"
class="w3-bar-item w3-button w3-right w3-black w3-mobile">GitHub</a>
<a href="legal.html" class="w3-bar-item w3-button w3-right w3-black w3-mobile">Legal</a>
<a href="https://encrypted-dns.party/" class="w3-bar-item w3-button w3-right w3-blue-grey w3-mobile">Encrypted DNS Party</a>
<a href="https://encrypted-dns.party/" class="w3-bar-item w3-button w3-right w3-blue-grey w3-mobile">Encrypted
DNS Party</a>
</div>
<br>
<p><b>If the tool does not work, please clear your cache and/or reload the webpages!</b> I am continuously updating this tool, but the changes might not load in your browser unless you clear your cache.</p>
<p><b>If the tool does not work, please clear your cache and/or reload the webpages!</b> I am continuously updating
this tool, but the changes might not load in your browser unless you clear your cache.</p>
<h3>What is this?</h3>
<p>This website allows you to create configuration profiles for your Apple device to use the new built-in encrypted
@ -46,8 +49,9 @@
An app off the App Store might do what it should, sure. But it also might capture data inbetween and negate the
privacy advantage that DoH and DoT bring.</p>
<h3>How do I use this?</h3>
<p>Visit this website using you Apple device and navigate to the tool. Then, select a pre-made configuration or
enter your own settings and click/tap "Download profile". Then, open the downloaded file using the "Files" app.
<p>Visit this website using your Apple device and navigate to the tool. Then, upload a pre-made configuration or
enter your own settings and click/tap "Add to profile". When you're done adding configurations, open the
"Finalize" page to download the finished file. Then, open the downloaded file using the "Files" app.
<br>
Your device will ask you a few times, be sure to accept the warnings.<br>
<b>The generated profiles are not signed. This is normal.</b></p>

7391
js/plist.js Normal file

File diff suppressed because it is too large Load diff

View file

@ -15,30 +15,35 @@ function getCookie(cname) {
}
function addToList() {
var runningNo = getCookie("runningNo");
if (getCookie("runningNo") == "") {
runningNo = 0;
if (document.getElementById("serverUrl").value.includes(":")) {
alert("Entering custom ports (e.g. :853) is not supported. Please remove it.");
}
else {
var runningNo = getCookie("runningNo");
if (getCookie("runningNo") == "") {
runningNo = 0;
}
var d = new Date();
d.setTime(d.getTime() + (86400000)); //expires in 24h
var expires = "expires="+ d.toUTCString();
document.cookie = runningNo + "provName=" + encodeURIComponent(document.getElementById("provName").value) + ";" + expires + ";path=/; SameSite=Strict; Secure";
document.cookie = runningNo + "doh=" + document.getElementById("doh").checked + ";" + expires + ";path=/; SameSite=Strict; Secure";
document.cookie = runningNo + "dns1v4=" + document.getElementById("dns1v4").value + ";" + expires + ";path=/; SameSite=Strict; Secure";
document.cookie = runningNo + "dns2v4=" + document.getElementById("dns2v4").value + ";" + expires + ";path=/; SameSite=Strict; Secure";
document.cookie = runningNo + "dns1v6=" + document.getElementById("dns1v6").value + ";" + expires + ";path=/; SameSite=Strict; Secure";
document.cookie = runningNo + "dns2v6=" + document.getElementById("dns2v6").value + ";" + expires + ";path=/; SameSite=Strict; Secure";
document.cookie = runningNo + "serverUrl=" + document.getElementById("serverUrl").value + ";" + expires + ";path=/; SameSite=Strict; Secure";
document.cookie = runningNo + "exclWifi=" + encodeURIComponent(document.getElementById("exclWifi").value) + ";" + expires + ";path=/; SameSite=Strict; Secure";
document.cookie = runningNo + "useWifi=" + document.getElementById("useWifi").checked + ";" + expires + ";path=/; SameSite=Strict; Secure";
document.cookie = runningNo + "useCell=" + document.getElementById("useCell").checked + ";" + expires + ";path=/; SameSite=Strict; Secure";
document.cookie = runningNo + "lockProfile=" + document.getElementById("lockProfile").checked + ";" + expires + ";path=/; SameSite=Strict; Secure";
var d = new Date();
d.setTime(d.getTime() + (86400000)); //expires in 24h
var expires = "expires="+ d.toUTCString();
document.cookie = runningNo + "provName=" + encodeURIComponent(document.getElementById("provName").value) + ";" + expires + ";path=/; SameSite=Strict; Secure";
document.cookie = runningNo + "doh=" + document.getElementById("doh").checked + ";" + expires + ";path=/; SameSite=Strict; Secure";
document.cookie = runningNo + "dns1v4=" + document.getElementById("dns1v4").value + ";" + expires + ";path=/; SameSite=Strict; Secure";
document.cookie = runningNo + "dns2v4=" + document.getElementById("dns2v4").value + ";" + expires + ";path=/; SameSite=Strict; Secure";
document.cookie = runningNo + "dns1v6=" + document.getElementById("dns1v6").value + ";" + expires + ";path=/; SameSite=Strict; Secure";
document.cookie = runningNo + "dns2v6=" + document.getElementById("dns2v6").value + ";" + expires + ";path=/; SameSite=Strict; Secure";
document.cookie = runningNo + "serverUrl=" + document.getElementById("serverUrl").value + ";" + expires + ";path=/; SameSite=Strict; Secure";
document.cookie = runningNo + "exclWifi=" + encodeURIComponent(document.getElementById("exclWifi").value) + ";" + expires + ";path=/; SameSite=Strict; Secure";
document.cookie = runningNo + "useWifi=" + document.getElementById("useWifi").checked + ";" + expires + ";path=/; SameSite=Strict; Secure";
document.cookie = runningNo + "useCell=" + document.getElementById("useCell").checked + ";" + expires + ";path=/; SameSite=Strict; Secure";
document.cookie = runningNo + "lockProfile=" + document.getElementById("lockProfile").checked + ";" + expires + ";path=/; SameSite=Strict; Secure";
runningNo = runningNo + 1;
document.cookie = "runningNo=" + runningNo + ";" + expires + ";path=/; SameSite=Strict; Secure";
window.location.href = "finalize.html";
runningNo = runningNo + 1;
document.cookie = "runningNo=" + runningNo + ";" + expires + ";path=/; SameSite=Strict; Secure";
window.location.href = "finalize.html";
}
}
function switchToHTTPS() {
@ -77,6 +82,77 @@ function getDataFromUpload() {
}
function handleProfileText(uploadedProfile) {
//TODO
//Important: Handle missing info in file: alert and abort!
var profile = plist.parse(uploadedProfile);
console.log(profile);
//Name
document.getElementById("provName").value = profile.PayloadDisplayName;
//Protocol and URL/ServerName
if (profile.PayloadContent[0].DNSSettings.DNSProtocol == "HTTPS") {
document.getElementById("doh").checked = true;
document.getElementById("serverUrl").value = profile.PayloadContent[0].DNSSettings.ServerURL;
}
else if(profile.PayloadContent[0].DNSSettings.DNSProtocol == "TLS") {
document.getElementById("dot").checked = true;
document.getElementById("serverUrl").value = profile.PayloadContent[0].DNSSettings.ServerName;
}
//ServerAddresses, if applicable
const serverAddresses = profile.PayloadContent[0].DNSSettings.ServerAddresses;
if (serverAddresses) {
var dns4count = 0;
var dns6count = 0;
for (let index = 0; index < serverAddresses.length; index++) {
if (serverAddresses[index].includes(":")) {
if (dns6count == 0) {
document.getElementById("dns1v6").value = serverAddresses[index];
}
else {
document.getElementById("dns2v6").value = serverAddresses[index];
}
dns6count++;
}
else if (serverAddresses[index].includes(".")) {
if (dns4count == 0) {
document.getElementById("dns1v4").value = serverAddresses[index];
}
else {
document.getElementById("dns2v4").value = serverAddresses[index];
}
dns4count++;
}
}
}
//Profile locked?
document.getElementById("lockProfile").checked = profile.PayloadContent[0].ProhibitDisablement;
//Allow Wi-Fi and Cellular, check for excluded SSIDs
profile.PayloadContent[0].OnDemandRules.forEach(rule => {
if (rule.InterfaceTypeMatch == "WiFi") {
if (rule.Action == "Connect") {
document.getElementById("useWifi").checked = true;
}
else {
document.getElementById("useWifi").checked = false;
}
}
else if (rule.InterfaceTypeMatch == "Cellular") {
if (rule.Action == "Connect") {
document.getElementById("useCell").checked = true;
}
else {
document.getElementById("useCell").checked = false;
}
}
else if (rule.SSIDMatch) {
rule.SSIDMatch.forEach(ssid => {
if (document.getElementById("exclWifi").value != "") {
document.getElementById("exclWifi").value += ", "
}
document.getElementById("exclWifi").value += ssid;
});
}
});
}

View file

@ -26,6 +26,7 @@
<ul>
<li>Eli Grey: <a href="https://github.com/eligrey/FileSaver.js" target="_blank">FileSaver.js</a>, <a href="https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md">MIT License</a></li>
<li>uuidjs: <a href="https://github.com/uuidjs/uuid">UUID JavaScript library</a>, <a href="https://github.com/uuidjs/uuid/blob/master/LICENSE.md">MIT License</a></li>
<li>plist.js: <a href="https://github.com/TooTallNate/plist.js">PLIST JavaScript library</a>, <a href="https://github.com/TooTallNate/plist.js/blob/master/LICENSE">MIT License</a></li>
<li>Paul Miller: <a href="https://github.com/paulmillr/encrypted-dns">encrypted-dns</a> (reference), <a href="https://github.com/paulmillr/encrypted-dns/blob/master/LICENSE">The Unlicense</a></li>
<li>w3schools.com: <a href="https://www.w3schools.com/w3css/">w3.css</a>, Public Domain</li>
</ul>

View file

@ -9,6 +9,7 @@
<link rel="stylesheet" href="css/form.css">
<link rel="stylesheet" href="css/dark-mode.css">
<script src="js/uuidv4.min.js"></script>
<script src="js/plist.js"></script>
<script src="js/tool.js"></script>
</head>