-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implement onboarding page to prompt install of helper. * Reorganise extension pages. * Update readme. * Minor fixes.
- Loading branch information
1 parent
3230dbd
commit 386a1dc
Showing
14 changed files
with
206 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!DOCTYPE html> | ||
|
||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<link rel="stylesheet" href="../assets/bootstrap.css" /> | ||
</head> | ||
|
||
<body> | ||
<div class="container"> | ||
<div class="row" id="manual address"> | ||
<div class="col"> | ||
<h3>Actions:</h3> | ||
<ul> | ||
<li><a href="./setup.html" target="_blank">Open setup page</a></li> | ||
</ul> | ||
</div> | ||
</div> | ||
<div class="row" id="manual address"> | ||
<div class="col"> | ||
<h3>Settings:</h3> | ||
<form id="options"> | ||
<div class="form-group"> | ||
<label for="address">Dat gateway Address</label> | ||
<input class="form-control" | ||
type="URI" | ||
id="address" | ||
value="http://localhost:3000" | ||
required pattern="https?:\/\/[^/\?:]+(:[0-9]+)?" /> | ||
</div> | ||
<button class="btn btn-primary" type="submit" >Save</button> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
<script src="./options.js"></script> | ||
</html> |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<!DOCTYPE html> | ||
|
||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<link rel="stylesheet" href="../assets/bootstrap.css" /> | ||
<title>Dat-fox Setup</title> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col"> | ||
<h1>Dat-fox: Dat + Firefox</h1> | ||
<p> | ||
You're almost ready to browse Dat, but first we need to make sure | ||
everything is setup. | ||
</p> | ||
<p>If you didn't already, you need to install the dat-fox helper:</p> | ||
<ul> | ||
<li>Mac/Linux: <code><kdb>curl -o- https://raw.githubusercontent.com/sammacbeth/dat-fox-helper/master/installer.sh | bash</kdb></code></li> | ||
<li>Windows: <a href="https://datfox-sammacbeth.hashbase.io/how-to-install-dat-fox-helper">Manual install instructions.</a></li> | ||
</ul> | ||
<p> | ||
Once dat-fox-helper is installed, click below to test that your browser | ||
can communicate with the helper process. | ||
</p> | ||
<button class="btn btn-primary" id="test">Test</button> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col" id="test-results"> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col invisible" id="ready-to-go"> | ||
<h3>Check Dat out!</h3> | ||
<p> | ||
Now you're ready to browse the P2P web! Here's some sites to get you | ||
started: | ||
</p> | ||
<ul> | ||
<li> | ||
<a href="dat://datfox-sammacbeth.hashbase.io/">The dat-fox blog</a> published | ||
with orkl. | ||
</li> | ||
<li> | ||
Publish your own p2p blog with <a href="dat://orkl-kodedninja.hashbase.io/">orkl</a>, | ||
<a href="dat://solo-kodedninja.hashbase.io">solo</a> or | ||
<a href="dat://pipette-dev-blog-jimpick.hashbase.io/post/introducing-pipette/">Pipette</a>. | ||
Hit the fork button via the green Dat icon in the url bar. | ||
</li> | ||
<li> | ||
Edit any Dats you create in the browser, with <a href="dat://editor-cryptic.hashbase.io/">this editor</a>. | ||
</li> | ||
<li> | ||
And more... A more comprehensive list of dat sites is available from | ||
the <a href="dat://beakerbrowser.com">Beaker Browser</a> team on <a href="https://github.com/beakerbrowser/explore">Github</a> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
<script src="./setup.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
|
||
const { bridge, resetBridge } = browser.extension.getBackgroundPage(); | ||
|
||
const button = document.getElementById('test'); | ||
const testResults = document.getElementById('test-results'); | ||
|
||
function createCheckAlert() { | ||
const elem = document.createElement('div'); | ||
elem.setAttribute('class', 'alert alert-primary'); | ||
elem.setAttribute('role', 'alert'); | ||
return elem; | ||
} | ||
|
||
async function testGateway(setLabel) { | ||
setLabel('Attempting to start gateway...'); | ||
const port = await resetBridge(); | ||
setLabel(`Successfully started dat gateway at localhost:${port}.`); | ||
return true; | ||
} | ||
|
||
async function testVersion(setLabel) { | ||
setLabel('Checking helper version...'); | ||
const version = await bridge.postMessage({ action: 'getVersion' }); | ||
const wantedVersion = '0.0.5'; | ||
if (version < wantedVersion) { | ||
setLabel(`Helper version ${version} not up-to-date. Latest is ${wantedVersion}`); | ||
return false; | ||
} | ||
setLabel(`Helper version ${version} up-to-date`); | ||
return true; | ||
} | ||
|
||
button.onclick = async () => { | ||
button.innerText = 'Testing...'; | ||
button.setAttribute('disabled', true); | ||
testResults.innerHTML = ''; | ||
const bridgeCheck = createCheckAlert(); | ||
bridgeCheck.innerHTML = '<p>Checking helper connection</p><ul id="results"></ul>'; | ||
testResults.appendChild(bridgeCheck); | ||
const resultList = document.getElementById('results'); | ||
|
||
const tests = [testGateway, testVersion]; | ||
let failure = false; | ||
for (let i = 0; i < tests.length; i++) { | ||
const test = tests[i]; | ||
const testElem = document.createElement('li'); | ||
resultList.appendChild(testElem); | ||
try { | ||
const res = await test((label) => testElem.innerText = label); | ||
if (!res) { | ||
failure = true; | ||
break; | ||
} | ||
} catch(e) { | ||
testElem.innerText = `${testElem.innerText} ${e}`; | ||
failure = true; | ||
break; | ||
} | ||
} | ||
|
||
if (failure) { | ||
bridgeCheck.setAttribute('class', 'alert alert-danger'); | ||
} else { | ||
bridgeCheck.setAttribute('class', 'alert alert-success'); | ||
document.getElementById('ready-to-go').setAttribute('class', 'col visible'); | ||
} | ||
|
||
button.removeAttribute('disabled'); | ||
button.innerText = 'Test'; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters