Commit e6e9c566 authored by Ivanq's avatar Ivanq

Fork via 'siteClone' command

parent 25fa18d5
......@@ -42,10 +42,6 @@
</a>
</main>
<div class="info">
<a class="button button-blue" href="../repo/new/">New repo</a>
</div>
<div class="info">
<p>
<b>Default Git Center Repo</b> is a template for creating repositories. It cannot be accessed directly and only supports forking.
......
......@@ -46,6 +46,7 @@
<script type="text/javascript" src="js/ZeroFrame.js"></script>
<script type="text/javascript" src="js/ZeroPage.js"></script>
<script type="text/javascript" src="js/repo.js"></script>
<script type="text/javascript" src="js/main.js"></script>
</body>
</html>
\ No newline at end of file
......@@ -11,5 +11,7 @@ zeroPage.getSiteInfo()
let button = document.getElementById("create_repository");
button.classList.remove("button-disabled");
button.classList.add("button-blue");
button.href = "repo/new/";
button.onclick = () => {
Repository.createRepo(zeroPage);
};
});
\ No newline at end of file
......@@ -128,6 +128,9 @@ class Repository {
return this.signContent("site");
});
}
fork() {
return this.zeroPage.cmd("siteClone", [this.address])
}
// Git actions
getFiles(branch, dir) {
......@@ -779,4 +782,8 @@ class Repository {
date.getDate()
);
}
};
Repository.createRepo = zeroPage => {
return zeroPage.cmd("siteClone", ["1RepoXU8bQE9m7ssNwL4nnxBnZVejHCc6"]);
};
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<title>Fork a repository - Git Center</title>
<meta charset="utf-8">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<base href="" target="_top" id="base">
<script>base.href = document.location.href.replace("/media", "").replace("index.html", "").replace(/[&?]wrapper=False/, "").replace(/[&?]wrapper_nonce=[A-Za-z0-9]+/, "")</script>
<link rel="stylesheet" type="text/css" href="../../css/main.css">
<link rel="stylesheet" type="text/css" href="../../css/buttons.css">
<link rel="stylesheet" type="text/css" href="../../css/header.css">
<link rel="stylesheet" type="text/css" href="../../css/content.css">
</head>
<body>
<header class="header">
<a href="../..">
<img src="../../img/logo-white.svg" class="header-logo">
<div class="header-name">Git Center</div>
</a>
<a href="../../index/">
<div class="header-item">Repository Index</div>
</a>
<a href="../../myrepos/">
<div class="header-item">My Repos</div>
</a>
<a href="../../workflow/">
<div class="header-item">Git Center workflow</div>
</a>
<a href="../../support/">
<div class="header-item">Support</div>
</a>
</header>
<main class="content">
<h1>Fork a repository</h1>
<p>
Unfortunately, ZeroNet doesn't offer an easy way to do that. So, please return to <b>ZeroHello</b> and clone <b id="title"></b>.
</p>
<div class="center">
<a class="button button-big" href="/">Visit ZeroHello</a>
</div>
</main>
<script type="text/javascript" src="../../js/ZeroFrame.js"></script>
<script type="text/javascript" src="../../js/ZeroPage.js"></script>
<script type="text/javascript" src="../../js/ZeroFS.js"></script>
<script type="text/javascript" src="../../js/ZeroAuth.js"></script>
<script type="text/javascript" src="../../js/ZeroDB.js"></script>
<script type="text/javascript" src="../../js/pako.js"></script>
<script type="text/javascript" src="../../js/sha.js"></script>
<script type="text/javascript" src="../../js/git.js"></script>
<script type="text/javascript" src="../../js/repo.js"></script>
<script type="text/javascript" src="../js/user_common.js"></script>
<script type="text/javascript" src="../js/common.js"></script>
<script type="text/javascript" src="js/main.js"></script>
</body>
</html>
\ No newline at end of file
if(address == "1RepoXU8bQE9m7ssNwL4nnxBnZVejHCc6") {
location.href = "../new/";
}
repo.addMerger()
.then(() => {
return repo.getContent();
})
.then(content => {
document.getElementById("title").textContent = content.title;
});
\ No newline at end of file
......@@ -43,7 +43,9 @@ function showTitle(title) {
});
}
function showHeader(level) {
document.getElementById("fork").href = "../".repeat(level) + "fork/?" + address;
document.getElementById("fork").onclick = () => {
repo.fork();
};
let publish = document.getElementById("publish");
zeroPage.isSignable("merged-GitCenter/" + address + "/content.json")
......
<!DOCTYPE html>
<html>
<head>
<title>Create a repository - Git Center</title>
<meta charset="utf-8">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<base href="" target="_top" id="base">
<script>base.href = document.location.href.replace("/media", "").replace("index.html", "").replace(/[&?]wrapper=False/, "").replace(/[&?]wrapper_nonce=[A-Za-z0-9]+/, "")</script>
<link rel="stylesheet" type="text/css" href="../../css/main.css">
<link rel="stylesheet" type="text/css" href="../../css/buttons.css">
<link rel="stylesheet" type="text/css" href="../../css/header.css">
<link rel="stylesheet" type="text/css" href="../../css/content.css">
</head>
<body>
<header class="header">
<a href="../..">
<img src="../../img/logo-white.svg" class="header-logo">
<div class="header-name">Git Center</div>
</a>
<a href="../../index/">
<div class="header-item">Repository Index</div>
</a>
<a href="../../myrepos/">
<div class="header-item">My Repos</div>
</a>
<a href="../../workflow/">
<div class="header-item">Git Center workflow</div>
</a>
<a href="../../support/">
<div class="header-item">Support</div>
</a>
</header>
<main class="content">
<h1>Create a repository</h1>
<p>
Unfortunately, ZeroNet doesn't offer an easy way to do that. So, please return to <b>ZeroHello</b> and clone <b>Default Git Center Repo</b>.
</p>
<div class="center">
<a class="button button-big" href="/">Visit ZeroHello</a>
</div>
</main>
</body>
</html>
\ No newline at end of file
......@@ -55,7 +55,7 @@
<h2>Creating a repo</h2>
<p>
Git Center repositories are just sites. ZeroNet doesn't offer a simple way to clone a zite, so please <a href="/">go to ZeroHello</a> and clone <b>Default Git Center Repo</b> (it should be under <b>MERGED: GIT CENTER</b> group)
Git Center repositories are just sites. To create a repo, press <a class="button button-blue">Create a repository</a> on the home page and accept cloning.
</p>
<p>
After cloning you will be redirected back to Git Center and installation progress will begin. It can ask you to log in to ZeroID if you haven't done it yet. Installation usually doesn't take much time.
......@@ -145,6 +145,9 @@
<p>
To let people speak about some project, Git Center added support for issues. You can see them on <b>Issues</b> tab, create them by pressing <a class="button button-blue">New issue</a> and then comment it. Other people can post comments then.
</p>
<p>
You can also have pull requests. If people fork your repository and then create a pull request with a reference to that fork you can accept these requests and manually merge it. Git Center uses ZeroNet functions and has to implement <code>git</code> using JavaScript, so merging would be really difficult.
</p>
</div>
</body>
</html>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment