Generate Keys class from gitblit.properties as part of build process.
1 files added
44 files modified
| | |
| | | <mkdir dir="${project.build.dir}" />
|
| | | <javac srcdir="${basedir}/src" destdir="${project.build.dir}">
|
| | | <include name="com/gitblit/Build.java" />
|
| | | <include name="com/gitblit/Constants.java" />
|
| | | </javac>
|
| | | <java classpath="${project.build.dir}" classname="com.gitblit.Build" />
|
| | |
|
| | |
| | | </path>
|
| | | <javac destdir="${project.build.dir}">
|
| | | <src path="${basedir}/src" />
|
| | | <src path="${basedir}/contrib" />
|
| | | <classpath refid="master-classpath" />
|
| | | </javac>
|
| | | <copy todir="${project.build.dir}">
|
| | |
| | | #
|
| | |
|
| | | # Allow push/pull over http/https with JGit servlet
|
| | | allowPushPull = true
|
| | | git.allowPushPull = true
|
| | |
|
| | | # Base folder for repositories
|
| | | # Use forward slashes on Windows!!
|
| | | repositoriesFolder = c:/projects/git
|
| | | git.repositoriesFolder = c:/projects/git
|
| | |
|
| | | # Export all repositories
|
| | | # if false, each exported repository must have a .git/git-daemon-export-ok file
|
| | | exportAll = true
|
| | | git.exportAll = true
|
| | |
|
| | | # Search repositories folder for nested repositories
|
| | | nestedRepositories = true
|
| | | git.nestedRepositories = true
|
| | |
|
| | | # The root clone url
|
| | | cloneUrl = https://localhost/git/
|
| | | git.cloneUrl = https://localhost/git/
|
| | |
|
| | | #
|
| | | # Authentication Settings
|
| | | #
|
| | |
|
| | | # Require authentication for http/https push/pull access of git repositories
|
| | | authenticatePushPull = true
|
| | | git.authenticate = true
|
| | |
|
| | | # Require authentication to see the web ui
|
| | | authenticateWebUI = true
|
| | | web.authenticate = true
|
| | |
|
| | | # Simple user realm file to authenticate users for push/pull
|
| | | realmFile = users.properties
|
| | | # Simple user realm file to authenticate users
|
| | | server.realmFile = users.properties
|
| | |
|
| | | #
|
| | | # Server Settings
|
| | | #
|
| | | debugMode = true
|
| | | tempFolder = temp
|
| | | log4jPattern = %-5p %d{MM-dd HH:mm:ss.SSS} %-20.20c{1} %m%n
|
| | | server.debugMode = true
|
| | | server.tempFolder = temp
|
| | | server.log4jPattern = %-5p %d{MM-dd HH:mm:ss.SSS} %-20.20c{1} %m%n
|
| | |
|
| | | # Aggressive heap management will run the garbage collector on every generated
|
| | | # page. This slows down page generation but improves heap consumption.
|
| | | aggressiveHeapManagement = true
|
| | | server.aggressiveHeapManagement = true
|
| | |
|
| | | #
|
| | | # Git:Blit UI Settings
|
| | | #
|
| | | siteName =
|
| | | web.siteName =
|
| | |
|
| | | # If authenticateWebUI=true, users with "admin" role can create repositories,
|
| | | # create users, and edit repository metadata (owner, description, etc)
|
| | | #
|
| | | # If authenticateWebUI=false, any user can execute the aforementioned functions.
|
| | | allowAdministration = true
|
| | | web.allowAdministration = true
|
| | |
|
| | | repositoriesMessage = Welcome to Git:Blit!<br>A quick and easy way to host your own Git repositories.<br>Built with <a href="http://eclipse.org/jgit">JGit</a>, <a href="http://wicket.apache.org">Wicket</a>, <a href="http://code.google.com/p/google-code-prettify/">google-code-prettify</a>, <a href="http://eclipse.org/jetty">Jetty</a>, <a href="http://www.slf4j.org">SLF4J</a>, <a href="http://logging.apache.org/log4j">Log4j</a>, and <a href="http://jcommander.org">JCommander</a>.
|
| | | # This is the message display above the repositories table.
|
| | | # This can point to a file with HTML content.
|
| | | web.repositoriesMessage = Welcome to Git:Blit!<br>A quick and easy way to host your own Git repositories.<br>Built with <a href="http://eclipse.org/jgit">JGit</a>, <a href="http://wicket.apache.org">Wicket</a>, <a href="http://code.google.com/p/google-code-prettify/">google-code-prettify</a>, <a href="http://eclipse.org/jetty">Jetty</a>, <a href="http://www.slf4j.org">SLF4J</a>, <a href="http://logging.apache.org/log4j">Log4j</a>, and <a href="http://jcommander.org">JCommander</a>.
|
| | |
|
| | | # Use the client timezone when formatting dates.
|
| | | # This uses AJAX to determine the browser's timezone and enables Wicket
|
| | | # session management for the connection.
|
| | | useClientTimezone = false
|
| | | web.useClientTimezone = false
|
| | |
|
| | | # Date and Time formats
|
| | | timestampFormat = h:mm a
|
| | |
|
| | | datestampShortFormat = yyyy-MM-dd
|
| | | datestampLongFormat = EEEE, MMMM d, yyyy
|
| | |
|
| | | datetimestampShortFormat = yyyy-MM-dd h:mm a z
|
| | | datetimestampLongFormat = EEEE, MMMM d, yyyy h:mm a z
|
| | | web.datestampShortFormat = yyyy-MM-dd
|
| | | web.datetimestampLongFormat = EEEE, MMMM d, yyyy h:mm a z
|
| | |
|
| | | # Generates a line graph of repository activity over time on the Summary page.
|
| | | # This is a real-time graph so generation may be expensive.
|
| | | generateActivityGraph = true
|
| | | web.generateActivityGraph = true
|
| | |
|
| | | # The number of commits to display on the summary page
|
| | | # Value must exceed 0 else default of 20 is used
|
| | | summaryCommitCount = 20
|
| | | web.summaryCommitCount = 20
|
| | |
|
| | | # The number of tags/heads to display on the summary page
|
| | | # Value must exceed 0 else default of 5 is used
|
| | | summaryRefsCount = 5
|
| | | web.summaryRefsCount = 5
|
| | |
|
| | | # The number of commits to show on each page of a Log
|
| | | # Value must exceed 0 else default of 50 is used
|
| | | logPageCommitCount = 50
|
| | | web.logPageCommitCount = 50
|
| | |
|
| | | # Registered extensions for google-code-prettify
|
| | | prettyPrintExtensions = c cpp cs css htm html java js php pl prefs properties py rb sh sql xml vb
|
| | | web.prettyPrintExtensions = c cpp cs css htm html java js php pl prefs properties py rb sh sql xml vb
|
| | |
|
| | | # Image extensions
|
| | | imageExtensions = bmp jpg gif png |
| | | web.imageExtensions = bmp jpg gif png |
| | |
|
| | | # Registered extensions for binary blobs
|
| | | binaryExtensions = jar pdf tar.gz zip
|
| | | web.binaryExtensions = jar pdf tar.gz zip
|
| | |
|
| | | # Example global regex substitutions
|
| | | regex.global.bug = \\b(Bug:)(\\s*[#]?|-){0,1}(\\d+)\\b!!!<a href="http://somehost/bug/$3">Bug-Id: $3</a>
|
| | | regex.global.changeid = \\b(Change-Id:\\s*)([A-Za-z0-9]*)\\b!!!<a href="http://somehost/changeid/$2">Change-Id: $2</a>
|
| | |
|
| | | # Example per-repository regex substitutions overrides global
|
| | | regex.myrepository.bug = \\b(Bug:)(\\s*[#]?|-){0,1}(\\d+)\\b!!!<a href="http://elsewhere/bug/$3">Bug-Id: $3</a>
|
| | | #regex.myrepository.bug = \\b(Bug:)(\\s*[#]?|-){0,1}(\\d+)\\b!!!<a href="http://elsewhere/bug/$3">Bug-Id: $3</a>
|
| | |
|
| | | # Enable ticgit viewer for all repositories (checks for ticgit branch)
|
| | | ticgit.global = false
|
| | |
|
| | | # Enable ticgit viewer for specified repository (checks for ticgit branch)
|
| | | ticgit.myrepository = true
|
| | | ticgit.ticgit = true
|
| | | #ticgit.myrepository = true
|
| | |
|
| | | #
|
| | | # Jetty Settings
|
| | | #
|
| | |
|
| | | # use NIO connectors. If false, socket connectors will be used.
|
| | | useNio = true
|
| | | server.useNio = true
|
| | |
|
| | | # Standard http port to serve. <= 0 disables this connector.
|
| | | httpPort = 0
|
| | | server.httpPort = 0
|
| | |
|
| | | # Secure/SSL https port to serve. <= 0 disables this connector.
|
| | | httpsPort = 443
|
| | | server.httpsPort = 443
|
| | |
|
| | | # Password for SSL keystore (keystore password and certificate password must match)
|
| | | storePassword = dosomegit
|
| | | server.storePassword = dosomegit
|
| | |
|
| | | # Port for shutdown monitor to listen on.
|
| | | shutdownPort = 8081
|
| | | server.shutdownPort = 8081
|
New file |
| | |
| | | /SettingKeys.java |
| | | /Keys.java |
| | |
| | | import java.io.BufferedInputStream;
|
| | | import java.io.ByteArrayOutputStream;
|
| | | import java.io.File;
|
| | | import java.io.FileInputStream;
|
| | | import java.io.IOException;
|
| | | import java.io.InputStream;
|
| | | import java.io.RandomAccessFile;
|
| | | import java.net.URL;
|
| | | import java.security.MessageDigest;
|
| | | import java.security.NoSuchAlgorithmException;
|
| | | import java.text.MessageFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Collections;
|
| | | import java.util.List;
|
| | | import java.util.Properties;
|
| | |
|
| | | public class Build {
|
| | |
|
| | | public static void main(String... args) {
|
| | | runtime();
|
| | | compiletime();
|
| | | buildSettingKeys();
|
| | | }
|
| | |
|
| | | public static void runtime() {
|
| | |
| | | downloadFromMaven(MavenObject.JUNIT);
|
| | | }
|
| | |
|
| | | public static void buildSettingKeys() {
|
| | | Properties properties = new Properties();
|
| | | try {
|
| | | properties.load(new FileInputStream(Constants.PROPERTIES_FILE));
|
| | | } catch (Throwable t) {
|
| | | t.printStackTrace();
|
| | | }
|
| | | List<String> keys = new ArrayList<String>(properties.stringPropertyNames());
|
| | | Collections.sort(keys);
|
| | |
|
| | | StringBuilder sb = new StringBuilder();
|
| | | sb.append("package com.gitblit;\n");
|
| | | sb.append("\n");
|
| | | sb.append("/*\n");
|
| | | sb.append(" * This class is auto-generated from the properties file.\n");
|
| | | sb.append(" * Do not version control!\n");
|
| | | sb.append(" */\n");
|
| | | sb.append("public final class Keys {\n");
|
| | | sb.append("\n");
|
| | | for (String key : keys) {
|
| | | sb.append(MessageFormat.format("\tpublic static final String {0} = \"{1}\";\n\n", key.replace('.', '_'), key));
|
| | | }
|
| | | sb.append("}");
|
| | | try {
|
| | | File file = new File("src/com/gitblit/Keys.java");
|
| | | file.delete();
|
| | | RandomAccessFile raf = new RandomAccessFile(file, "rw");
|
| | | raf.writeBytes(sb.toString());
|
| | | raf.close();
|
| | | } catch (Throwable t) {
|
| | | t.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * Download a file from a Maven repository.
|
| | | *
|
| | |
| | |
|
| | | public final static String PUSH_ROLE = "push";
|
| | |
|
| | | public final static String PROPERTIES_FILE = "gitblit.properties";
|
| | |
|
| | | public static String getGitBlitVersion() {
|
| | | return NAME + " v" + VERSION;
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | private GitBlit() {
|
| | | repositories = new File(StoredSettings.getString("repositoriesFolder", "repos"));
|
| | | exportAll = StoredSettings.getBoolean("exportAll", true);
|
| | | repositories = new File(StoredSettings.getString(Keys.git_repositoriesFolder, "repos"));
|
| | | exportAll = StoredSettings.getBoolean(Keys.git_exportAll, true);
|
| | | repositoryResolver = new FileResolver(repositories, exportAll);
|
| | | debugMode = StoredSettings.getBoolean("debugMode", false);
|
| | | debugMode = StoredSettings.getBoolean(Keys.server_debugMode, false);
|
| | | }
|
| | |
|
| | | public boolean isDebugMode() {
|
| | |
| | | }
|
| | |
|
| | | public List<String> getRepositoryList() {
|
| | | return JGitUtils.getRepositoryList(repositories, exportAll, StoredSettings.getBoolean("nestedRepositories", true));
|
| | | return JGitUtils.getRepositoryList(repositories, exportAll, StoredSettings.getBoolean(Keys.git_nestedRepositories, true));
|
| | | }
|
| | |
|
| | | public List<RepositoryModel> getRepositories(Request request) {
|
| | |
| | | }
|
| | | if (jc != null) {
|
| | | jc.usage();
|
| | | System.out.println("\nExample:\n java -server -Xmx1024M -jar go-git-go.jar --repos c:\\git --port 80 --securePort 443");
|
| | | System.out.println("\nExample:\n java -server -Xmx1024M -jar gitblit.jar --repos c:\\git --port 80 --securePort 443");
|
| | | }
|
| | | System.exit(0);
|
| | | }
|
| | |
| | | // instantiate GitBlit
|
| | | GitBlit.self();
|
| | |
|
| | | PatternLayout layout = new PatternLayout(StoredSettings.getString("log4jPattern", "%-5p %d{MM-dd HH:mm:ss.SSS} %-20.20c{1} %m%n"));
|
| | | PatternLayout layout = new PatternLayout(StoredSettings.getString(Keys.server_log4jPattern, "%-5p %d{MM-dd HH:mm:ss.SSS} %-20.20c{1} %m%n"));
|
| | | org.apache.log4j.Logger rootLogger = org.apache.log4j.Logger.getRootLogger();
|
| | | rootLogger.addAppender(new ConsoleAppender(layout));
|
| | |
|
| | |
| | | String osversion = System.getProperty("os.version");
|
| | | logger.info("Running on " + osname + " (" + osversion + ")");
|
| | |
|
| | | if (StoredSettings.getBoolean("debugMode", false)) {
|
| | | if (StoredSettings.getBoolean(Keys.server_debugMode, false)) {
|
| | | logger.warn("DEBUG Mode");
|
| | | }
|
| | |
|
| | |
| | | // Git Servlet
|
| | | ServletHolder gitServlet = null;
|
| | | String gitServletPathSpec = "/git/*";
|
| | | if (StoredSettings.getBoolean("allowPushPull", true)) {
|
| | | if (StoredSettings.getBoolean(Keys.git_allowPushPull, true)) {
|
| | | gitServlet = rootContext.addServlet(GitServlet.class, gitServletPathSpec);
|
| | | gitServlet.setInitParameter("base-path", params.repositoriesFolder);
|
| | | gitServlet.setInitParameter("export-all", params.exportAll ? "1" : "0");
|
| | |
| | | public Boolean stop = false;
|
| | |
|
| | | @Parameter(names = { "--temp" }, description = "Server temp folder")
|
| | | public String temp = StoredSettings.getString("tempFolder", "temp");
|
| | | public String temp = StoredSettings.getString(Keys.server_tempFolder, "temp");
|
| | |
|
| | | /*
|
| | | * GIT Servlet Parameters
|
| | | */
|
| | | @Parameter(names = { "--repos" }, description = "Git Repositories Folder")
|
| | | public String repositoriesFolder = StoredSettings.getString("repositoriesFolder", "repos");
|
| | | public String repositoriesFolder = StoredSettings.getString(Keys.git_repositoriesFolder, "repos");
|
| | |
|
| | | @Parameter(names = { "--exportAll" }, description = "Export All Found Repositories")
|
| | | public Boolean exportAll = StoredSettings.getBoolean("exportAll", true);
|
| | | public Boolean exportAll = StoredSettings.getBoolean(Keys.git_exportAll, true);
|
| | |
|
| | | /*
|
| | | * Authentication Parameters
|
| | | */
|
| | | @Parameter(names = { "--authenticatePushPull" }, description = "Authenticate Git Push/Pull access")
|
| | | public Boolean authenticatePushPull = StoredSettings.getBoolean("authenticatePushPull", true);
|
| | | public Boolean authenticatePushPull = StoredSettings.getBoolean(Keys.git_authenticate, true);
|
| | |
|
| | | @Parameter(names = { "--realm" }, description = "Users Realm Hash File")
|
| | | public String realmFile = StoredSettings.getString("realmFile", "users.properties");
|
| | | public String realmFile = StoredSettings.getString(Keys.server_realmFile, "users.properties");
|
| | |
|
| | | /*
|
| | | * JETTY Parameters
|
| | | */
|
| | | @Parameter(names = { "--nio" }, description = "Use NIO Connector else use Socket Connector.")
|
| | | public Boolean useNIO = StoredSettings.getBoolean("useNio", true);
|
| | | public Boolean useNIO = StoredSettings.getBoolean(Keys.server_useNio, true);
|
| | |
|
| | | @Parameter(names = "--port", description = "HTTP port for to serve. (port <= 0 will disable this connector)")
|
| | | public Integer port = StoredSettings.getInteger("httpPort", 80);
|
| | | public Integer port = StoredSettings.getInteger(Keys.server_httpPort, 80);
|
| | |
|
| | | @Parameter(names = "--securePort", description = "HTTPS port to serve. (port <= 0 will disable this connector)")
|
| | | public Integer securePort = StoredSettings.getInteger("httpsPort", 443);
|
| | | public Integer securePort = StoredSettings.getInteger(Keys.server_httpsPort, 443);
|
| | |
|
| | | @Parameter(names = "--storePassword", description = "Password for SSL (https) keystore.")
|
| | | public String storePassword = StoredSettings.getString("storePassword", "");
|
| | | public String storePassword = StoredSettings.getString(Keys.server_storePassword, "");
|
| | |
|
| | | @Parameter(names = "--shutdownPort", description = "Port for Shutdown Monitor to listen on. (port <= 0 will disable this monitor)")
|
| | | public Integer shutdownPort = StoredSettings.getInteger("shutdownPort", 8081);
|
| | | public Integer shutdownPort = StoredSettings.getInteger(Keys.server_shutdownPort, 8081);
|
| | |
|
| | | }
|
| | | } |
| | |
| | | }
|
| | |
|
| | | private static synchronized Properties read() {
|
| | | File file = new File("gitblit.properties");
|
| | | File file = new File(Constants.PROPERTIES_FILE);
|
| | | if (file.exists() && (file.lastModified() > lastread)) {
|
| | | try {
|
| | | properties = new Properties();
|
| | | properties.load(new FileInputStream("gitblit.properties"));
|
| | | properties.load(new FileInputStream(Constants.PROPERTIES_FILE));
|
| | | lastread = file.lastModified();
|
| | | } catch (FileNotFoundException f) {
|
| | | } catch (Throwable t) {
|
| | |
| | | import org.slf4j.LoggerFactory;
|
| | |
|
| | | import com.gitblit.Constants;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.StoredSettings;
|
| | | import com.gitblit.wicket.pages.SummaryPage;
|
| | |
|
| | |
| | | add(new Label("title", getServerName()));
|
| | | }
|
| | | // header
|
| | | String siteName = StoredSettings.getString("siteName", Constants.NAME);
|
| | | String siteName = StoredSettings.getString(Keys.web_siteName, Constants.NAME);
|
| | | if (siteName == null || siteName.trim().length() == 0) {
|
| | | siteName = Constants.NAME;
|
| | | }
|
| | |
| | |
|
| | | // footer
|
| | | User user = null;
|
| | | if (StoredSettings.getBoolean("authenticateWebUI", true)) {
|
| | | if (StoredSettings.getBoolean(Keys.web_authenticate, true)) {
|
| | | user = GitBlitWebSession.get().getUser();
|
| | | add(new Label("userText", "Logout " + user.toString()));
|
| | | } else {
|
| | | add(new Label("userText", ""));
|
| | | }
|
| | | add(new Label("gbVersion", "v" + Constants.VERSION));
|
| | | if (StoredSettings.getBoolean("aggressiveHeapManagement", false)) {
|
| | | if (StoredSettings.getBoolean(Keys.server_aggressiveHeapManagement, false)) {
|
| | | System.gc();
|
| | | }
|
| | | }
|
| | |
|
| | | protected TimeZone getTimeZone() {
|
| | | return StoredSettings.getBoolean("useClientTimezone", false) ? GitBlitWebSession.get().getTimezone() : TimeZone.getDefault();
|
| | | return StoredSettings.getBoolean(Keys.web_useClientTimezone, false) ? GitBlitWebSession.get().getTimezone() : TimeZone.getDefault();
|
| | | }
|
| | |
|
| | | protected String getServerName() {
|
| | |
| | | import org.apache.wicket.request.target.coding.MixedParamUrlCodingStrategy;
|
| | |
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.StoredSettings;
|
| | | import com.gitblit.wicket.pages.BlobDiffPage;
|
| | | import com.gitblit.wicket.pages.BlobPage;
|
| | |
| | | super.init();
|
| | |
|
| | | // Setup page authorization mechanism
|
| | | if (StoredSettings.getBoolean("authenticateWebUI", false)) {
|
| | | if (StoredSettings.getBoolean(Keys.web_authenticate, false)) {
|
| | | AuthorizationStrategy authStrategy = new AuthorizationStrategy();
|
| | | getSecuritySettings().setAuthorizationStrategy(authStrategy);
|
| | | getSecuritySettings().setUnauthorizedComponentInstantiationListener(authStrategy);
|
| | | }
|
| | |
|
| | | // Grab Browser info (like timezone, etc)
|
| | | if (StoredSettings.getBoolean("useClientTimezone", false)) {
|
| | | if (StoredSettings.getBoolean(Keys.web_useClientTimezone, false)) {
|
| | | getRequestCycleSettings().setGatherExtendedBrowserInfo(true);
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | public String getCloneUrl(String repositoryName) {
|
| | | return StoredSettings.getString("cloneUrl", "https://localhost/git/") + repositoryName;
|
| | | return StoredSettings.getString(Keys.git_cloneUrl, "https://localhost/git/") + repositoryName;
|
| | | }
|
| | |
|
| | | public static GitBlitWebApp get() {
|
| | |
| | | public class User {
|
| | |
|
| | | private String username;
|
| | | private char [] password;
|
| | | private String cookie;
|
| | | private boolean canAdmin = false;
|
| | | private boolean canClone = false;
|
| | | private boolean canPush = false;
|
| | |
|
| | | public User(String username, char [] password) {
|
| | | this.username = username;
|
| | | this.password = password;
|
| | | this.cookie = Build.getSHA1((Constants.NAME + username + new String(password)).getBytes());
|
| | | }
|
| | |
|
| | | public void canAdmin(boolean value) {
|
| | |
| | | }
|
| | |
|
| | | public String getCookie() {
|
| | | return Build.getSHA1((Constants.NAME + username + new String(password)).getBytes());
|
| | | return cookie;
|
| | | }
|
| | |
|
| | | public String toString() {
|
| | |
| | | import org.apache.wicket.markup.html.basic.Label;
|
| | | import org.eclipse.jgit.lib.Constants;
|
| | |
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.StoredSettings;
|
| | | import com.gitblit.utils.Utils;
|
| | |
|
| | |
| | | }
|
| | |
|
| | | public static Label createDateLabel(String wicketId, Date date, TimeZone timeZone) {
|
| | | DateFormat df = new SimpleDateFormat(StoredSettings.getString("datestampShortFormat", "MM/dd/yy"));
|
| | | DateFormat df = new SimpleDateFormat(StoredSettings.getString(Keys.web_datestampShortFormat, "MM/dd/yy"));
|
| | | if (timeZone != null) {
|
| | | df.setTimeZone(timeZone);
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | public static Label createTimestampLabel(String wicketId, Date date, TimeZone timeZone) {
|
| | | DateFormat df = new SimpleDateFormat(StoredSettings.getString("datetimestampLongFormat", "EEEE, MMMM d, yyyy h:mm a z"));
|
| | | DateFormat df = new SimpleDateFormat(StoredSettings.getString(Keys.web_datetimestampLongFormat, "EEEE, MMMM d, yyyy h:mm a z"));
|
| | | if (timeZone != null) {
|
| | | df.setTimeZone(timeZone);
|
| | | }
|
| | |
| | |
|
| | | import com.gitblit.utils.JGitUtils;
|
| | |
|
| | |
|
| | | public class PathModel implements Serializable, Comparable<PathModel> {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
| | |
|
| | | import com.gitblit.utils.JGitUtils;
|
| | |
|
| | |
|
| | | public class RefModel implements Serializable, Comparable<RefModel> {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
| | | import org.eclipse.jgit.lib.Repository;
|
| | | import org.eclipse.jgit.revwalk.RevCommit;
|
| | |
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.StoredSettings;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.wicket.LinkPanel;
|
| | | import com.gitblit.wicket.RepositoryPage;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.panels.PathBreadcrumbsPanel;
|
| | |
|
| | |
|
| | | public class BlobPage extends RepositoryPage {
|
| | |
|
| | |
| | |
|
| | | // Map the extensions to types
|
| | | Map<String, Integer> map = new HashMap<String, Integer>();
|
| | | for (String ext : StoredSettings.getStrings("prettyPrintExtensions")) {
|
| | | for (String ext : StoredSettings.getStrings(Keys.web_prettyPrintExtensions)) {
|
| | | map.put(ext.toLowerCase(), 1);
|
| | | }
|
| | | for (String ext : StoredSettings.getStrings("imageExtensions")) {
|
| | | for (String ext : StoredSettings.getStrings(Keys.web_imageExtensions)) {
|
| | | map.put(ext.toLowerCase(), 2);
|
| | | }
|
| | | for (String ext : StoredSettings.getStrings("binaryExtensions")) {
|
| | | for (String ext : StoredSettings.getStrings(Keys.web_binaryExtensions)) {
|
| | | map.put(ext.toLowerCase(), 3);
|
| | | }
|
| | |
|
| | |
| | | import com.gitblit.wicket.RepositoryPage;
|
| | | import com.gitblit.wicket.panels.BranchesPanel;
|
| | |
|
| | |
|
| | | public class BranchesPage extends RepositoryPage {
|
| | |
|
| | | public BranchesPage(PageParameters params) {
|
| | |
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.models.PathModel;
|
| | |
|
| | |
|
| | | public class CommitPage extends RepositoryPage {
|
| | |
|
| | | public CommitPage(PageParameters params) {
|
| | |
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | |
|
| | |
|
| | | public class PatchPage extends WebPage {
|
| | |
|
| | | public PatchPage(PageParameters params) {
|
| | |
| | | import org.eclipse.jgit.revwalk.RevCommit;
|
| | |
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.StoredSettings;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | |
|
| | |
|
| | | public class RawPage extends WebPage {
|
| | |
|
| | |
| | |
|
| | | // Map the extensions to types
|
| | | Map<String, Integer> map = new HashMap<String, Integer>();
|
| | | for (String ext : StoredSettings.getStrings("imageExtensions")) {
|
| | | for (String ext : StoredSettings.getStrings(Keys.web_imageExtensions)) {
|
| | | map.put(ext.toLowerCase(), 2);
|
| | | }
|
| | | for (String ext : StoredSettings.getStrings("binaryExtensions")) {
|
| | | for (String ext : StoredSettings.getStrings(Keys.web_binaryExtensions)) {
|
| | | map.put(ext.toLowerCase(), 3);
|
| | | }
|
| | |
|
| | |
| | | import org.apache.wicket.model.Model;
|
| | |
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.StoredSettings;
|
| | | import com.gitblit.utils.Utils;
|
| | | import com.gitblit.wicket.BasePage;
|
| | |
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.models.RepositoryModel;
|
| | |
|
| | |
|
| | | public class RepositoriesPage extends BasePage {
|
| | |
|
| | | public RepositoriesPage() {
|
| | |
| | | setupPage("", "");
|
| | |
|
| | | boolean showAdmin = false;
|
| | | if (StoredSettings.getBoolean("authenticateWebUI", true)) {
|
| | | boolean allowAdmin = StoredSettings.getBoolean("allowAdministration", false);
|
| | | if (StoredSettings.getBoolean(Keys.web_authenticate, true)) {
|
| | | boolean allowAdmin = StoredSettings.getBoolean(Keys.web_allowAdministration, false);
|
| | | showAdmin = allowAdmin && GitBlitWebSession.get().canAdmin();
|
| | | } else {
|
| | | showAdmin = StoredSettings.getBoolean("allowAdministration", false);
|
| | | showAdmin = StoredSettings.getBoolean(Keys.web_allowAdministration, false);
|
| | | }
|
| | |
|
| | | Fragment adminLinks = new Fragment("adminPanel", "adminLinks", this);
|
| | |
| | | adminLinks.add(new BookmarkablePageLink<Void>("newUser", RepositoriesPage.class));
|
| | | add(adminLinks.setVisible(showAdmin));
|
| | |
|
| | | add(new Label("repositoriesMessage", StoredSettings.getString("repositoriesMessage", "")).setEscapeModelStrings(false));
|
| | | add(new Label("repositoriesMessage", StoredSettings.getString(Keys.web_repositoriesMessage, "")).setEscapeModelStrings(false));
|
| | |
|
| | | List<RepositoryModel> rows = GitBlit.self().getRepositories(getRequest());
|
| | | DataProvider dp = new DataProvider(rows);
|
| | |
| | | import com.codecommit.wicket.ChartProvider;
|
| | | import com.codecommit.wicket.ChartType;
|
| | | import com.codecommit.wicket.IChartData;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.StoredSettings;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.wicket.GitBlitWebApp;
|
| | |
| | | int numCommitsDef = 20;
|
| | | int numRefsDef = 5;
|
| | |
|
| | | int numberCommits = StoredSettings.getInteger("summaryCommitCount", numCommitsDef);
|
| | | int numberCommits = StoredSettings.getInteger(Keys.web_summaryCommitCount, numCommitsDef);
|
| | | if (numberCommits <= 0) {
|
| | | numberCommits = numCommitsDef;
|
| | | }
|
| | |
|
| | | int numberRefs = StoredSettings.getInteger("summaryRefsCount", numRefsDef);
|
| | | int numberRefs = StoredSettings.getInteger(Keys.web_summaryRefsCount, numRefsDef);
|
| | | if (numberRefs <= 0) {
|
| | | numberRefs = numRefsDef;
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | private void insertActivityGraph(List<Metric> metrics) {
|
| | | if (StoredSettings.getBoolean("generateActivityGraph", true)) { |
| | | if (StoredSettings.getBoolean(Keys.web_generateActivityGraph, true)) {
|
| | | IChartData data = getChartData(metrics);
|
| | |
|
| | | ChartProvider provider = new ChartProvider(new Dimension(400, 80), ChartType.LINE, data);
|
| | |
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.models.RefModel;
|
| | |
|
| | |
|
| | | public class TagPage extends RepositoryPage {
|
| | |
|
| | | public TagPage(PageParameters params) {
|
| | |
| | | import com.gitblit.wicket.RepositoryPage;
|
| | | import com.gitblit.wicket.panels.TagsPanel;
|
| | |
|
| | |
|
| | | public class TagsPage extends RepositoryPage {
|
| | |
|
| | | public TagsPage(PageParameters params) {
|
| | |
| | | import com.gitblit.wicket.models.PathModel;
|
| | | import com.gitblit.wicket.panels.PathBreadcrumbsPanel;
|
| | |
|
| | |
|
| | | public class TreePage extends RepositoryPage {
|
| | |
|
| | | public TreePage(PageParameters params) {
|
| | |
| | | // tree page links
|
| | | add(new Label("historyLink", getString("gb.history")));
|
| | | add(new BookmarkablePageLink<Void>("headLink", TreePage.class, WicketUtils.newPathParameter(repositoryName, Constants.HEAD, basePath)));
|
| | |
|
| | |
|
| | | add(new LinkPanel("shortlog", "title", commit.getShortMessage(), CommitPage.class, newCommitParameter()));
|
| | |
|
| | |
| | |
|
| | | import org.apache.wicket.markup.html.panel.Panel;
|
| | |
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.StoredSettings;
|
| | | import com.gitblit.wicket.GitBlitWebSession;
|
| | |
|
| | |
| | | }
|
| | |
|
| | | protected TimeZone getTimeZone() {
|
| | | return StoredSettings.getBoolean("useClientTimezone", false) ? GitBlitWebSession.get().getTimezone() : TimeZone.getDefault();
|
| | | return StoredSettings.getBoolean(Keys.web_useClientTimezone, false) ? GitBlitWebSession.get().getTimezone() : TimeZone.getDefault();
|
| | | }
|
| | | }
|
| | |
| | | import org.eclipse.jgit.lib.Repository;
|
| | | import org.eclipse.jgit.revwalk.RevCommit;
|
| | |
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.StoredSettings;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.wicket.LinkPanel;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.pages.CommitPage;
|
| | | import com.gitblit.wicket.pages.CommitDiffPage;
|
| | | import com.gitblit.wicket.pages.CommitPage;
|
| | | import com.gitblit.wicket.pages.LogPage;
|
| | | import com.gitblit.wicket.pages.SummaryPage;
|
| | | import com.gitblit.wicket.pages.TreePage;
|
| | |
| | | public LogPanel(String wicketId, final String repositoryName, String objectId, Repository r, int limit, int pageOffset) {
|
| | | super(wicketId);
|
| | | boolean pageResults = limit <= 0;
|
| | | int itemsPerPage = StoredSettings.getInteger("logPageCommitCount", 50);
|
| | | int itemsPerPage = StoredSettings.getInteger(Keys.web_logPageCommitCount, 50);
|
| | | if (itemsPerPage <= 1) {
|
| | | itemsPerPage = 50;
|
| | | }
|
| | |
| | | import com.gitblit.wicket.pages.LogPage;
|
| | | import com.gitblit.wicket.pages.TagPage;
|
| | |
|
| | |
|
| | | public class RefsPanel extends Panel {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
| | | ListDataProvider<String> refsDp = new ListDataProvider<String>(refNames);
|
| | | DataView<String> refsView = new DataView<String>("ref", refsDp) {
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | public void populateItem(final Item<String> item) {
|
| | | String entry = item.getModelObject();
|
| | | Component c = null;
|