Ejemplo n.º 1
0
void QtCacheGitPlugin::onParseCommandlineOptionsBegin(QCommandLineParser& p)
{
    QCommandLineOption origin_url("originurl", tr("clone, use and push remote repositry"), "url", "");
    p.addOption(origin_url);

    QCommandLineOption local_branch("localbranch", tr("target branch name"), "name", "");
    p.addOption(local_branch);

    QCommandLineOption remote_branch("remotebranch", tr("remote branch name"), "name", "");
    p.addOption(remote_branch);

    QCommandLineOption commit_message("commitmessage", tr("use this message for commits"), "message", "");
    p.addOption(commit_message);

    QCommandLineOption commit_author("commitauthor", tr("autor name used in git signature"), "name", "");
    p.addOption(commit_author);

    QCommandLineOption commit_email("commitemail", tr("autor email address used in git signature"), "adress", "");
    p.addOption(commit_email);
}
Ejemplo n.º 2
0
bool ControlServer::on_validate(websocketpp::connection_hdl hdl) {
	log_->trace() << log_tag() << BOOST_CURRENT_FUNCTION;

	auto connection_ptr = ws_server_.get_con_from_hdl(hdl);
	auto subprotocols = connection_ptr->get_requested_subprotocols();
	auto origin = connection_ptr->get_origin();

	log_->debug() << log_tag() << "Incoming connection from " << connection_ptr->get_remote_endpoint() << " Origin: " << origin;

	// Restrict access by "Origin" header
	if(!origin.empty()) {   // TODO: Add a way to relax this restriction
		url origin_url(origin);
		if(origin_url.host != "127.0.0.1" && origin_url.host != "::1" && origin_url.host != "localhost")
			return false;
	}

	// Detect loopback
	if(std::find(subprotocols.begin(), subprotocols.end(), "librevaultctl1.0") != subprotocols.end())
		connection_ptr->select_subprotocol("librevaultctl1.0");
	return true;
}