140 lines, 68 LOC, 68 covered (100%)
38 | 1 | /* ***** BEGIN LICENSE BLOCK ***** |
2 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
|
3 | * |
|
4 | * The contents of this file are subject to the Mozilla Public License Version |
|
5 | * 1.1 (the "License"); you may not use this file except in compliance with |
|
6 | * the License. You may obtain a copy of the License at |
|
7 | * http://www.mozilla.org/MPL/ |
|
8 | * |
|
9 | * Software distributed under the License is distributed on an "AS IS" basis, |
|
10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
|
11 | * for the specific language governing rights and limitations under the |
|
12 | * License. |
|
13 | * |
|
14 | * The Original Code is Bookmarks Sync. |
|
15 | * |
|
16 | * The Initial Developer of the Original Code is Mozilla. |
|
17 | * Portions created by the Initial Developer are Copyright (C) 2007 |
|
18 | * the Initial Developer. All Rights Reserved. |
|
19 | * |
|
20 | * Contributor(s): |
|
21 | * Dan Mills <thunder@mozilla.com> |
|
22 | * |
|
23 | * Alternatively, the contents of this file may be used under the terms of |
|
24 | * either the GNU General Public License Version 2 or later (the "GPL"), or |
|
25 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
|
26 | * in which case the provisions of the GPL or the LGPL are applicable instead |
|
27 | * of those above. If you wish to allow use of your version of this file only |
|
28 | * under the terms of either the GPL or the LGPL, and not to allow others to |
|
29 | * use your version of this file under the terms of the MPL, indicate your |
|
30 | * decision by deleting the provisions above and replace them with the notice |
|
31 | * and other provisions required by the GPL or the LGPL. If you do not delete |
|
32 | * the provisions above, a recipient may use your version of this file under |
|
33 | * the terms of any one of the MPL, the GPL or the LGPL. |
|
34 | * |
|
35 | * ***** END LICENSE BLOCK ***** */ |
|
36 | ||
37 | // Process each item in the "constants hash" to add to "global" and give a name |
|
20178 | 38 | let EXPORTED_SYMBOLS = [((this[key] = val), key) for ([key, val] in Iterator({ |
39 | ||
76 | 40 | WEAVE_CHANNEL: "dev", |
76 | 41 | WEAVE_VERSION: "1.3b6pre", |
76 | 42 | WEAVE_ID: "{340c2bbc-ce74-4362-90b5-7c26312808ef}", |
43 | ||
44 | // Version of the data format this client supports. The data format describes |
|
45 | // how records are packaged; this is separate from the Server API version and |
|
46 | // the per-engine cleartext formats. |
|
76 | 47 | STORAGE_VERSION: 2, |
48 | ||
76 | 49 | DEFAULT_SERVER: "https://auth.services.mozilla.com/", |
76 | 50 | UPDATED_URL: "https://services.mozilla.com/sync/updated/?version=1.3b6pre&channel=dev", |
51 | ||
76 | 52 | PREFS_BRANCH: "extensions.weave.", |
53 | ||
54 | // Host "key" to access Weave Identity in the password manager |
|
76 | 55 | PWDMGR_HOST: "chrome://weave", |
56 | ||
57 | // Sync intervals for various clients configurations |
|
76 | 58 | SINGLE_USER_SYNC: 24 * 60 * 60 * 1000, // 1 day |
76 | 59 | MULTI_DESKTOP_SYNC: 60 * 60 * 1000, // 1 hour |
76 | 60 | MULTI_MOBILE_SYNC: 5 * 60 * 1000, // 5 minutes |
76 | 61 | PARTIAL_DATA_SYNC: 60 * 1000, // 1 minute |
62 | ||
63 | // score thresholds for early syncs |
|
76 | 64 | SINGLE_USER_THRESHOLD: 1000, |
76 | 65 | MULTI_DESKTOP_THRESHOLD: 500, |
76 | 66 | MULTI_MOBILE_THRESHOLD: 100, |
67 | ||
68 | // File IO Flags |
|
76 | 69 | MODE_RDONLY: 0x01, |
76 | 70 | MODE_WRONLY: 0x02, |
76 | 71 | MODE_CREATE: 0x08, |
76 | 72 | MODE_APPEND: 0x10, |
76 | 73 | MODE_TRUNCATE: 0x20, |
74 | ||
75 | // File Permission flags |
|
76 | 76 | PERMS_FILE: 0644, |
76 | 77 | PERMS_PASSFILE: 0600, |
76 | 78 | PERMS_DIRECTORY: 0755, |
79 | ||
80 | // Number of records to upload in a single POST (multiple POSTS if exceeded) |
|
81 | // Record size limit is currently 28K, so 100 records is a bit over 2.7MB |
|
76 | 82 | MAX_UPLOAD_RECORDS: 100, |
83 | ||
84 | // Top-level statuses: |
|
76 | 85 | STATUS_OK: "success.status_ok", |
76 | 86 | SYNC_FAILED: "error.sync.failed", |
76 | 87 | LOGIN_FAILED: "error.login.failed", |
76 | 88 | SYNC_FAILED_PARTIAL: "error.sync.failed_partial", |
76 | 89 | CLIENT_NOT_CONFIGURED: "service.client_not_configured", |
76 | 90 | STATUS_DISABLED: "service.disabled", |
91 | ||
92 | // success states |
|
76 | 93 | LOGIN_SUCCEEDED: "success.login", |
76 | 94 | SYNC_SUCCEEDED: "success.sync", |
76 | 95 | ENGINE_SUCCEEDED: "success.engine", |
96 | ||
97 | // login failure status codes: |
|
76 | 98 | LOGIN_FAILED_NO_USERNAME: "error.login.reason.no_username", |
76 | 99 | LOGIN_FAILED_NO_PASSWORD: "error.login.reason.no_password", |
76 | 100 | LOGIN_FAILED_NO_PASSPHRASE: "error.login.reason.no_passphrase", |
76 | 101 | LOGIN_FAILED_NETWORK_ERROR: "error.login.reason.network", |
76 | 102 | LOGIN_FAILED_SERVER_ERROR: "error.login.reason.server", |
76 | 103 | LOGIN_FAILED_INVALID_PASSPHRASE: "error.login.reason.passphrase", |
76 | 104 | LOGIN_FAILED_LOGIN_REJECTED: "error.login.reason.password", |
105 | ||
106 | // sync failure status codes |
|
76 | 107 | METARECORD_DOWNLOAD_FAIL: "error.sync.reason.metarecord_download_fail", |
76 | 108 | VERSION_OUT_OF_DATE: "error.sync.reason.version_out_of_date", |
76 | 109 | DESKTOP_VERSION_OUT_OF_DATE: "error.sync.reason.desktop_version_out_of_date", |
76 | 110 | KEYS_DOWNLOAD_FAIL: "error.sync.reason.keys_download_fail", |
76 | 111 | NO_KEYS_NO_KEYGEN: "error.sync.reason.no_keys_no_keygen", |
76 | 112 | KEYS_UPLOAD_FAIL: "error.sync.reason.keys_upload_fail", |
76 | 113 | SETUP_FAILED_NO_PASSPHRASE: "error.sync.reason.setup_failed_no_passphrase", |
76 | 114 | CREDENTIALS_CHANGED: "error.sync.reason.credentials_changed", |
76 | 115 | ABORT_SYNC_COMMAND: "aborting sync, process commands said so", |
76 | 116 | NO_SYNC_NODE_FOUND: "error.sync.reason.no_node_found", |
117 | ||
118 | // engine failure status codes |
|
76 | 119 | ENGINE_UPLOAD_FAIL: "error.engine.reason.record_upload_fail", |
76 | 120 | ENGINE_DOWNLOAD_FAIL: "error.engine.reason.record_download_fail", |
76 | 121 | ENGINE_UNKNOWN_FAIL: "error.engine.reason.unknown_fail", |
76 | 122 | ENGINE_METARECORD_UPLOAD_FAIL: "error.engine.reason.metarecord_upload_fail", |
123 | ||
124 | // Ways that a sync can be disabled (messages only to be printed in debug log) |
|
76 | 125 | kSyncWeaveDisabled: "Weave is disabled", |
76 | 126 | kSyncNotLoggedIn: "User is not logged in", |
76 | 127 | kSyncNetworkOffline: "Network is offline", |
76 | 128 | kSyncInPrivateBrowsing: "Private browsing is enabled", |
76 | 129 | kSyncBackoffNotMet: "Trying to sync before the server said it's okay", |
76 | 130 | kFirstSyncChoiceNotMade: "User has not selected an action for first sync", |
131 | ||
132 | // Application IDs |
|
76 | 133 | FIREFOX_ID: "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}", |
76 | 134 | FENNEC_ID: "{a23983c0-fd0e-11dc-95ff-0800200c9a66}", |
76 | 135 | SEAMONKEY_ID: "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}", |
136 | ||
76 | 137 | MIN_PP_LENGTH: 12, |
27398 | 138 | MIN_PASS_LENGTH: 8 |
139 | ||
38 | 140 | }))]; |