mirror of https://github.com/zulip/zulip.git
code: Rename flaskbotrc to botserverrc.
This commit is contained in:
parent
91ec0aba09
commit
04d68d2570
|
@ -8,7 +8,7 @@ common.start_and_log_in();
|
||||||
|
|
||||||
// var form_sel = 'form[action^="/json/settings"]';
|
// var form_sel = 'form[action^="/json/settings"]';
|
||||||
var regex_zuliprc = /^data:application\/octet-stream;charset=utf-8,\[api\]\nemail=.+\nkey=.+\nsite=.+\n$/;
|
var regex_zuliprc = /^data:application\/octet-stream;charset=utf-8,\[api\]\nemail=.+\nkey=.+\nsite=.+\n$/;
|
||||||
var regex_flaskbotrc = /^data:application\/octet-stream;charset=utf-8,\[\]\nemail=.+\nkey=.+\nsite=.+\n$/;
|
var regex_botserverrc = /^data:application\/octet-stream;charset=utf-8,\[\]\nemail=.+\nkey=.+\nsite=.+\n$/;
|
||||||
|
|
||||||
casper.then(function () {
|
casper.then(function () {
|
||||||
var menu_selector = '#settings-dropdown';
|
var menu_selector = '#settings-dropdown';
|
||||||
|
@ -142,14 +142,14 @@ casper.then(function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
casper.then(function () {
|
casper.then(function () {
|
||||||
casper.waitUntilVisible('#download_flaskbotrc', function () {
|
casper.waitUntilVisible('#download_botserverrc', function () {
|
||||||
casper.click("#download_flaskbotrc");
|
casper.click("#download_botserverrc");
|
||||||
|
|
||||||
casper.waitUntilVisible('#download_flaskbotrc[href^="data:application"]', function () {
|
casper.waitUntilVisible('#download_botserverrc[href^="data:application"]', function () {
|
||||||
casper.test.assertMatch(
|
casper.test.assertMatch(
|
||||||
decodeURIComponent(casper.getElementsAttribute('#download_flaskbotrc', 'href')),
|
decodeURIComponent(casper.getElementsAttribute('#download_botserverrc', 'href')),
|
||||||
regex_flaskbotrc,
|
regex_botserverrc,
|
||||||
'Looks like a flaskbotrc file');
|
'Looks like a botserverrc file');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -46,12 +46,12 @@ run_test('generate_zuliprc_content', () => {
|
||||||
assert.equal(content, expected);
|
assert.equal(content, expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
run_test('generate_flaskbotrc_content', () => {
|
run_test('generate_botserverrc_content', () => {
|
||||||
var user = {
|
var user = {
|
||||||
email: "vabstest-bot@zulip.com",
|
email: "vabstest-bot@zulip.com",
|
||||||
api_key: "nSlA0mUm7G42LP85lMv7syqFTzDE2q34",
|
api_key: "nSlA0mUm7G42LP85lMv7syqFTzDE2q34",
|
||||||
};
|
};
|
||||||
var content = settings_bots.generate_flaskbotrc_content(user.email, user.api_key);
|
var content = settings_bots.generate_botserverrc_content(user.email, user.api_key);
|
||||||
var expected = "[]\nemail=vabstest-bot@zulip.com\n" +
|
var expected = "[]\nemail=vabstest-bot@zulip.com\n" +
|
||||||
"key=nSlA0mUm7G42LP85lMv7syqFTzDE2q34\n" +
|
"key=nSlA0mUm7G42LP85lMv7syqFTzDE2q34\n" +
|
||||||
"site=https://chat.example.com\n";
|
"site=https://chat.example.com\n";
|
||||||
|
|
|
@ -139,7 +139,7 @@ function _setup_page() {
|
||||||
full_name: people.my_full_name(),
|
full_name: people.my_full_name(),
|
||||||
page_params: page_params,
|
page_params: page_params,
|
||||||
zuliprc: 'zuliprc',
|
zuliprc: 'zuliprc',
|
||||||
flaskbotrc: 'flaskbotrc',
|
botserverrc: 'botserverrc',
|
||||||
timezones: moment.tz.names(),
|
timezones: moment.tz.names(),
|
||||||
admin_only_bot_creation: page_params.is_admin ||
|
admin_only_bot_creation: page_params.is_admin ||
|
||||||
page_params.realm_bot_creation_policy !==
|
page_params.realm_bot_creation_policy !==
|
||||||
|
|
|
@ -110,7 +110,7 @@ exports.generate_zuliprc_content = function (email, api_key) {
|
||||||
"\n";
|
"\n";
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.generate_flaskbotrc_content = function (email, api_key) {
|
exports.generate_botserverrc_content = function (email, api_key) {
|
||||||
return "[]" +
|
return "[]" +
|
||||||
"\nemail=" + email +
|
"\nemail=" + email +
|
||||||
"\nkey=" + api_key +
|
"\nkey=" + api_key +
|
||||||
|
@ -177,12 +177,12 @@ exports.set_up = function () {
|
||||||
$('#config_inputbox').children().hide();
|
$('#config_inputbox').children().hide();
|
||||||
$("[name*='"+selected_embedded_bot+"']").show();
|
$("[name*='"+selected_embedded_bot+"']").show();
|
||||||
|
|
||||||
$('#download_flaskbotrc').click(function () {
|
$('#download_botserverrc').click(function () {
|
||||||
var OUTGOING_WEBHOOK_BOT_TYPE_INT = 3;
|
var OUTGOING_WEBHOOK_BOT_TYPE_INT = 3;
|
||||||
var content = "";
|
var content = "";
|
||||||
_.each(bot_data.get_all_bots_for_current_user(), function (bot) {
|
_.each(bot_data.get_all_bots_for_current_user(), function (bot) {
|
||||||
if (bot.is_active && bot.bot_type === OUTGOING_WEBHOOK_BOT_TYPE_INT) {
|
if (bot.is_active && bot.bot_type === OUTGOING_WEBHOOK_BOT_TYPE_INT) {
|
||||||
content += exports.generate_flaskbotrc_content(bot.email, bot.api_key);
|
content += exports.generate_botserverrc_content(bot.email, bot.api_key);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$(this).attr("href", "data:application/octet-stream;charset=utf-8," + encodeURIComponent(content));
|
$(this).attr("href", "data:application/octet-stream;charset=utf-8," + encodeURIComponent(content));
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<span>{{t 'Download config of all active outgoing webhook bots in Zulip Botserver format.' }}</span>
|
<span>{{t 'Download config of all active outgoing webhook bots in Zulip Botserver format.' }}</span>
|
||||||
<a type="submit" download="{{flaskbotrc}}" id= "download_flaskbotrc" class="btn" title="{{t 'Download flaskbotrc' }}">
|
<a type="submit" download="{{botserverrc}}" id= "download_botserverrc" class="btn" title="{{t 'Download botserverrc' }}">
|
||||||
<i class="icon-vector-download-alt sea-green"></i>
|
<i class="icon-vector-download-alt sea-green"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -76,11 +76,11 @@ pip install zulip_botserver
|
||||||
The Zulip botserver also supports running multiple bots from a single
|
The Zulip botserver also supports running multiple bots from a single
|
||||||
botserver process. You can do this with the following procedure.
|
botserver process. You can do this with the following procedure.
|
||||||
|
|
||||||
1. Download the `flaskbotrc` from the `your-bots` settings page, using
|
1. Download the `botserverrc` from the `your-bots` settings page, using
|
||||||
the "Download config of all active outgoing webhook bots in Zulip
|
the "Download config of all active outgoing webhook bots in Zulip
|
||||||
Botserver format." option at the top.
|
Botserver format." option at the top.
|
||||||
|
|
||||||
1. Open the `flaskbotrc`. It should contain one or more sections that look like this:
|
1. Open the `botserverrc`. It should contain one or more sections that look like this:
|
||||||
```
|
```
|
||||||
[]
|
[]
|
||||||
email=foo-bot@hostname
|
email=foo-bot@hostname
|
||||||
|
@ -99,11 +99,11 @@ key=dOHHlyqgpt5g0tVuVl6NHxDLlc9eFRX4
|
||||||
site=http://hostname
|
site=http://hostname
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Run the Zulip Botserver by passing the `flaskbotrc` to it. The
|
3. Run the Zulip Botserver by passing the `botserverrc` to it. The
|
||||||
command format is:
|
command format is:
|
||||||
|
|
||||||
```
|
```
|
||||||
zulip-bot-server --config-file <path_to_flaskbotrc>
|
zulip-bot-server --config-file <path_to_botserverrc>
|
||||||
```
|
```
|
||||||
|
|
||||||
If omitted, `hostname` defaults to `127.0.0.1` and `port` to `5002`.
|
If omitted, `hostname` defaults to `127.0.0.1` and `port` to `5002`.
|
||||||
|
@ -131,7 +131,7 @@ running it manually.
|
||||||
* Copy the following section into your existing supervisord config file.
|
* Copy the following section into your existing supervisord config file.
|
||||||
|
|
||||||
[program:zulip-bot-server]
|
[program:zulip-bot-server]
|
||||||
command=zulip-bot-server --config-file=<path/to/your/flaskbotrc>
|
command=zulip-bot-server --config-file=<path/to/your/botserverrc>
|
||||||
--hostname <address> --port <port>
|
--hostname <address> --port <port>
|
||||||
startsecs=3
|
startsecs=3
|
||||||
stdout_logfile=/var/log/zulip-botserver.log ; all output of your botserver will be logged here
|
stdout_logfile=/var/log/zulip-botserver.log ; all output of your botserver will be logged here
|
||||||
|
|
Loading…
Reference in New Issue