Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert config to ES6 #888

Merged
merged 4 commits into from
Mar 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 0 additions & 113 deletions app/script/config.coffee

This file was deleted.

133 changes: 133 additions & 0 deletions app/script/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*
*/

'use strict';

if (window.z == null) {
window.z = {};
}

z.config = {
BROWSER_NOTIFICATION: {
TIMEOUT: 5000,
TITLE_LENGTH: 38,
BODY_LENGTH: 80,
},

LOGGER: {
OPTIONS: {
name_length: 65,
domains: {
'app.wire.com'() {
return 0;
},
'localhost'() {
return 300;
},
'wire.ms'() {
return 300;
},
'wire-webapp-staging.wire.com'() {
return 300;
},
'zinfra.io'() {
return 300;
},
},
},
},

// number of messages that will be pulled
MESSAGES_FETCH_LIMIT: 30,

// number of users displayed in "people you may know"
SUGGESTIONS_FETCH_LIMIT: 30,

ACCENT_ID: {
BLUE: 1,
GREEN: 2,
YELLOW: 3,
RED: 4,
ORANGE: 5,
PINK: 6,
PURPLE: 7,
},

MAXIMUM_CONVERSATION_SIZE: 128,

// self profile image size in pixel
MINIMUM_PROFILE_IMAGE_SIZE: {
WIDTH: 320,
HEIGHT: 320,
},

// 15 megabyte image upload limit
MAXIMUM_IMAGE_FILE_SIZE: 15 * 1024 * 1024,

// 25 megabyte upload limit (minus AES overhead)
MAXIMUM_ASSET_FILE_SIZE: 25 * 1024 * 1024 - 32,

// Maximum of parallel uploads
MAXIMUM_ASSET_UPLOADS: 10,

// Maximum characters per message
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useless comment, the constant is self explanatory

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because it explains that the length is measured in characters, not in bytes or anything else.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we have to update the constant to MAXIMUM_MESSAGE_CHARACTERS

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or something similar

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Constant renaming comes in another PR...

MAXIMUM_MESSAGE_LENGTH: 8000,

SUPPORTED_PROFILE_IMAGE_TYPES: [
'.jpg-large',
'image/jpg',
'image/jpeg',
'image/png',
'image/bmp',
],

SUPPORTED_CONVERSATION_IMAGE_TYPES: [
'.jpg-large',
'image/jpg',
'image/jpeg',
'image/png',
'image/bmp',
'image/gif',
],

// 3 minutes session timeout
LOCALYTICS_SESSION_TIMEOUT: 3 * 60 * 1000,

MINIMUM_USERNAME_LENGTH: 2,
MINIMUM_PASSWORD_LENGTH: 8,

// 10 seconds until phone code expires
LOGIN_CODE_EXPIRATION: 10 * 60,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it's 10 seconds.. why it's multiplied by 60?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who knows? 😃

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usage of this code is @code_expiration_timestamp z.util.get_unix_timestamp() + z.config.LOGIN_CODE_EXPIRATION.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's definitely 10 minutes - comment is wrong


// measured in pixel
SCROLL_TO_LAST_MESSAGE_THRESHOLD: 100,

PROPERTIES_KEY: 'webapp',

// bigger requests will be split in chunks with a maximum size as defined
MAXIMUM_USERS_PER_REQUEST: 200,

UNSPLASH_URL: 'https://source.unsplash.com/1200x1200/?landscape',

ACCOUNT_PRODUCTION_URL: 'https://account-wire.com/',
ACCOUNT_STAGING_URL: 'https://wire-account-staging.zinfra.io/',

WEBSITE_PRODUCTION_URL: 'https://wire.com/',
WEBSITE_STAGING_URL: 'https://staging-website.zinfra.io/',
};