You are not in a GitHub repository.
Choose one from the pulldown, or Import or Publish one.
"); return null; } return 'https://github.com/' + toks[0] + '/' + toks[1]; } async function importProjectFromGithub(githuburl:string, replaceURL:boolean) { var sess : GHSession; var urlparse = parseGithubURL(githuburl); if (!urlparse) { alertError('Could not parse Github URL.'); return; } // redirect to repo if exists var existing = getRepos()[urlparse.repopath]; if (existing && !confirm("You've already imported " + urlparse.repopath + " -- do you want to replace all local files?")) { return; } // create new store for imported repository setWaitDialog(true); var newstore = createNewPersistentStore(urlparse.repopath); // import into new store setWaitProgress(0.25); var gh = await getGithubService(); return gh.import(githuburl).then( (sess1:GHSession) => { sess = sess1; setWaitProgress(0.75); return gh.pull(githuburl, newstore); }).then( (sess2:GHSession) => { // TODO: only first session has mainPath? // reload repo qs = {repo:sess.repopath}; // file:sess.mainPath, platform:sess.platform_id}; setWaitDialog(false); gaEvent('sync', 'import', githuburl); gotoNewLocation(replaceURL); }).catch( (e) => { setWaitDialog(false); console.log(e); alertError("Could not import " + githuburl + ".
" + e); }); } async function _loginToGithub(e) { var gh = await getGithubService(); gh.login().then(() => { alertInfo("You are signed in to Github."); }).catch( (e) => { alertError("Could not sign in.
" + e); }); } async function _logoutOfGithub(e) { var gh = await getGithubService(); gh.logout().then(() => { alertInfo("You are logged out of Github."); }); } function _importProjectFromGithub(e) { var modal = $("#importGithubModal"); var btn = $("#importGithubButton"); modal.modal('show'); btn.off('click').on('click', () => { var githuburl = $("#importGithubURL").val()+""; modal.modal('hide'); importProjectFromGithub(githuburl, false); }); } function _publishProjectToGithub(e) { if (repo_id) { if (!confirm("This project (" + current_project.mainPath + ") is already bound to a Github repository. Do you want to re-publish to a new repository? (You can instead choose 'Push Changes' to update files in the existing repository.)")) return; } var modal = $("#publishGithubModal"); var btn = $("#publishGithubButton"); $("#githubRepoName").val(getFilenamePrefix(getFilenameForPath(current_project.mainPath))); modal.modal('show'); btn.off('click').on('click', async () => { var name = $("#githubRepoName").val()+""; var desc = $("#githubRepoDesc").val()+""; var priv = $("#githubRepoPrivate").val() == 'private'; var license = $("#githubRepoLicense").val()+""; var sess; if (!name) { alertError("You did not enter a project name."); return; } modal.modal('hide'); setWaitDialog(true); var gh = await getGithubService(); gh.login().then( () => { setWaitProgress(0.25); return gh.publish(name, desc, license, priv); }).then( (_sess) => { sess = _sess; setWaitProgress(0.5); repo_id = qs.repo = sess.repopath; return pushChangesToGithub('initial import from 8bitworkshop.com'); }).then( () => { gaEvent('sync', 'publish', priv?"":name); importProjectFromGithub(sess.url, false); }).catch( (e) => { setWaitDialog(false); console.log(e); alertError("Could not publish GitHub repository: " + e); }); }); } function _pushProjectToGithub(e) { var ghurl = getBoundGithubURL(); if (!ghurl) return; var modal = $("#pushGithubModal"); var btn = $("#pushGithubButton"); modal.modal('show'); btn.off('click').on('click', () => { var commitMsg = $("#githubCommitMsg").val()+""; modal.modal('hide'); pushChangesToGithub(commitMsg); }); } function _pullProjectFromGithub(e) { var ghurl = getBoundGithubURL(); if (!ghurl) return; bootbox.confirm("Pull from repository and replace all local files? Any changes you've made will be overwritten.", async (ok) => { if (ok) { setWaitDialog(true); var gh = await getGithubService(); gh.pull(ghurl).then( (sess:GHSession) => { setWaitDialog(false); projectWindows.updateAllOpenWindows(store); }); } }); } function confirmCommit(sess) : PromiseAre you sure you want to delete this repository (" + ghurl + ") from browser storage?
All changes since last commit will be lost.
Type DELETE to proceed.
", (yes) => {
if (yes.trim().toUpperCase() == "DELETE") {
deleteRepository();
}
});
}
function deleteRepository() {
var ghurl = getBoundGithubURL();
var gh;
setWaitDialog(true);
// delete all keys in storage
store.keys().then((keys:string[]) => {
return Promise.all(keys.map((key) => {
return store.removeItem(key);
}));
}).then(() => {
gh = getGithubService();
return gh.getGithubSession(ghurl);
}).then((sess) => {
// un-bind repo from list
gh.bind(sess, false);
}).then(() => {
setWaitDialog(false);
// leave repository
qs = {repo:'/'};
gotoNewLocation();
});
}
function _shareEmbedLink(e) {
if (current_output == null) {
alertError("Please fix errors before sharing.");
return true;
}
if (!(current_output instanceof Uint8Array)) {
alertError("Can't share a Verilog executable yet. (It's not actually a ROM...)");
return true;
}
loadClipboardLibrary();
loadScript('lib/liblzg.js').then( () => {
// TODO: Module is bad var name (conflicts with MAME)
var lzgrom = compressLZG( window['Module'], Array.from(