Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions archive/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Archive</title>
<link rel="icon" type="image/png" href="../favicon.ico">

<!-- Firebase -->
<script src="../firebase-8.3.1/firebase-app.js"></script>
<script src="../firebase-8.3.1/firebase-auth.js"></script>
<script src="../firebase-8.3.1/firebase-database.js"></script>

<style>
html { height: 100%; }
body { margin: 0; height: 100%; }
#ref_list {
display: block;
}
</style>
</head>

<body onload="init()">
<div id="ref_list"></div>
<script>
function initList() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was actually thinking that we make past interviews harder to find rather than easier.

With this change it would technically be possible for a candidate to find old interviews more easily (if they could guess /archive as an interesting path) if I'm understanding it correctly.

Copy link
Copy Markdown
Contributor Author

@danielmawhirter danielmawhirter Apr 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, understood, this is primarily a permission issue then. Here's what I'd like to do:
After a document is first created, anyone who knows the link can read or write it for 2? days. After that, you have to sign in with a Katana login (firebase can do it), then you can read anything (maybe not write).
I'm looking at some documentation to figure out how to do this, does it seem reasonable?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds great!

var ref_list = document.getElementById("ref_list");
var query = firebase.database().ref("public").orderByKey();
query.once("value")
.then(function(snapshot) {
snapshot.forEach(function(childSnapshot) {
var key = childSnapshot.key;
var elem = document.createElement("a");
elem.text = key;
elem.href = "../#" + key;
elem.style.display = "block";
ref_list.appendChild(elem);
});
});
}

function init() {
var firebaseConfig = {
apiKey: "AIzaSyCJ3plB5z_C1oFVUkjI3NgbnEXO5DWAGlM",
authDomain: "katanagraph-interview.firebaseapp.com",
projectId: "katanagraph-interview",
storageBucket: "katanagraph-interview.appspot.com",
messagingSenderId: "71531395473",
appId: "1:71531395473:web:fc5aec90c2baa75fd7c230"
};

var authInitialized = false;
firebase.initializeApp(firebaseConfig);
firebase.auth().onAuthStateChanged((user) => {
if (user && !authInitialized) {
authInitialized = true;
initList();
}
});
firebase.auth().signInAnonymously();
}
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
var firepad = Firepad.fromACE(firepadRef, editor);
firepad.on('ready', function() {
if (editor.getValue() === "") {
session.setValue("Interview " + today() + " <CANDIDATE>\n");
session.setValue("Interview " + today() + "\n");
}
document.getElementById("firepad-container").style.visibility = "visible";
});
Expand Down