| | |
| | | import com.gitblit.Constants.FederationToken;
|
| | | import com.gitblit.models.FederationModel;
|
| | | import com.gitblit.models.FederationProposal;
|
| | | import com.gitblit.models.FederationSet;
|
| | | import com.gitblit.models.RepositoryModel;
|
| | | import com.gitblit.models.UserModel;
|
| | | import com.gitblit.utils.ByteFormat;
|
| | | import com.gitblit.utils.FederationUtils;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.JsonUtils;
|
| | |
| | | model.origin = config.getString("remote", "origin", "url");
|
| | | }
|
| | | r.close();
|
| | | if (getBoolean(Keys.web.showRepositorySizes, true)) {
|
| | | ByteFormat byteFormat = new ByteFormat();
|
| | | model.size = byteFormat.format(calculateSize(model)); |
| | | }
|
| | | return model;
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * Returns the list of federation sets.
|
| | | * |
| | | * @return list of federation sets
|
| | | */
|
| | | public List<FederationSet> getFederationSets(String gitblitUrl) {
|
| | | List<FederationSet> list = new ArrayList<FederationSet>();
|
| | | // generate standard tokens
|
| | | for (FederationToken type : FederationToken.values()) {
|
| | | FederationSet fset = new FederationSet(type.toString(), type, getFederationToken(type));
|
| | | fset.repositories = getRepositories(gitblitUrl, fset.token);
|
| | | list.add(fset);
|
| | | }
|
| | | // generate tokens for federation sets
|
| | | for (String set : settings.getStrings(Keys.federation.sets)) {
|
| | | FederationSet fset = new FederationSet(set, FederationToken.REPOSITORIES,
|
| | | getFederationToken(set));
|
| | | fset.repositories = getRepositories(gitblitUrl, fset.token);
|
| | | list.add(fset);
|
| | | }
|
| | | return list;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Returns the list of possible federation tokens for this Gitblit instance.
|
| | | *
|
| | | * @return list of federation tokens
|
| | |
| | | });
|
| | | for (File file : files) {
|
| | | String json = com.gitblit.utils.FileUtils.readContent(file, null);
|
| | | FederationProposal proposal = JsonUtils.fromJsonString(json, FederationProposal.class);
|
| | | FederationProposal proposal = JsonUtils.fromJsonString(json,
|
| | | FederationProposal.class);
|
| | | list.add(proposal);
|
| | | }
|
| | | }
|