| | |
| | | import com.gitblit.IStoredSettings; |
| | | import com.gitblit.Keys; |
| | | import com.gitblit.models.UserModel; |
| | | import com.gitblit.transport.ssh.commands.DispatchCommand; |
| | | import com.gitblit.utils.StringUtils; |
| | | |
| | | /** |
| | |
| | | private static class SendMessage implements Command, SessionAware { |
| | | |
| | | private final IStoredSettings settings; |
| | | private SshDaemonClient client; |
| | | private ServerSession session; |
| | | |
| | | private InputStream in; |
| | | private OutputStream out; |
| | |
| | | |
| | | @Override |
| | | public void setSession(final ServerSession session) { |
| | | this.client = session.getAttribute(SshDaemonClient.KEY); |
| | | this.session = session; |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void destroy() { |
| | | this.session = null; |
| | | } |
| | | |
| | | String getMessage() { |
| | | SshDaemonClient client = session.getAttribute(SshDaemonClient.KEY); |
| | | UserModel user = client.getUser(); |
| | | |
| | | StringBuilder msg = new StringBuilder(); |
| | | msg.append("\r\n"); |
| | | msg.append(" Hi "); |
| | | msg.append(user.getDisplayName()); |
| | | msg.append(", you have successfully connected to Gitblit over SSH."); |
| | | msg.append(", you have successfully connected to Gitblit over SSH"); |
| | | msg.append("\r\n"); |
| | | msg.append("with client: "); |
| | | msg.append(session.getClientVersion()); |
| | | msg.append("\r\n"); |
| | | msg.append("\r\n"); |
| | | |
| | |
| | | msg.append("\r\n"); |
| | | msg.append("\r\n"); |
| | | |
| | | // display the core commands |
| | | SshCommandFactory cmdFactory = (SshCommandFactory) session.getFactoryManager().getCommandFactory(); |
| | | DispatchCommand root = cmdFactory.createRootDispatcher(client, ""); |
| | | String usage = root.usage().replace("\n", "\r\n"); |
| | | msg.append(usage); |
| | | |
| | | return msg.toString(); |
| | | } |
| | | |