code: Rename flaskbotrc to botserverrc.

This commit is contained in:
Robert Hönig 2018-05-29 10:18:06 +02:00
parent 91ec0aba09
commit 04d68d2570
6 changed files with 19 additions and 19 deletions

View File

@ -8,7 +8,7 @@ common.start_and_log_in();
// var form_sel = 'form[action^="/json/settings"]';
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 () {
var menu_selector = '#settings-dropdown';
@ -142,14 +142,14 @@ casper.then(function () {
});
casper.then(function () {
casper.waitUntilVisible('#download_flaskbotrc', function () {
casper.click("#download_flaskbotrc");
casper.waitUntilVisible('#download_botserverrc', function () {
casper.click("#download_botserverrc");
casper.waitUntilVisible('#download_flaskbotrc[href^="data:application"]', function () {
casper.waitUntilVisible('#download_botserverrc[href^="data:application"]', function () {
casper.test.assertMatch(
decodeURIComponent(casper.getElementsAttribute('#download_flaskbotrc', 'href')),
regex_flaskbotrc,
'Looks like a flaskbotrc file');
decodeURIComponent(casper.getElementsAttribute('#download_botserverrc', 'href')),
regex_botserverrc,
'Looks like a botserverrc file');
});
});
});

View File

@ -46,12 +46,12 @@ run_test('generate_zuliprc_content', () => {
assert.equal(content, expected);
});
run_test('generate_flaskbotrc_content', () => {
run_test('generate_botserverrc_content', () => {
var user = {
email: "vabstest-bot@zulip.com",
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" +
"key=nSlA0mUm7G42LP85lMv7syqFTzDE2q34\n" +
"site=https://chat.example.com\n";

View File

@ -139,7 +139,7 @@ function _setup_page() {
full_name: people.my_full_name(),
page_params: page_params,
zuliprc: 'zuliprc',
flaskbotrc: 'flaskbotrc',
botserverrc: 'botserverrc',
timezones: moment.tz.names(),
admin_only_bot_creation: page_params.is_admin ||
page_params.realm_bot_creation_policy !==

View File

@ -110,7 +110,7 @@ exports.generate_zuliprc_content = function (email, api_key) {
"\n";
};
exports.generate_flaskbotrc_content = function (email, api_key) {
exports.generate_botserverrc_content = function (email, api_key) {
return "[]" +
"\nemail=" + email +
"\nkey=" + api_key +
@ -177,12 +177,12 @@ exports.set_up = function () {
$('#config_inputbox').children().hide();
$("[name*='"+selected_embedded_bot+"']").show();
$('#download_flaskbotrc').click(function () {
$('#download_botserverrc').click(function () {
var OUTGOING_WEBHOOK_BOT_TYPE_INT = 3;
var content = "";
_.each(bot_data.get_all_bots_for_current_user(), function (bot) {
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));

View File

@ -7,7 +7,7 @@
<div>
<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>
</a>
</div>

View File

@ -76,11 +76,11 @@ pip install zulip_botserver
The Zulip botserver also supports running multiple bots from a single
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
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
@ -99,11 +99,11 @@ key=dOHHlyqgpt5g0tVuVl6NHxDLlc9eFRX4
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:
```
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`.
@ -131,7 +131,7 @@ running it manually.
* Copy the following section into your existing supervisord config file.
[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>
startsecs=3
stdout_logfile=/var/log/zulip-botserver.log ; all output of your botserver will be logged here