cloudcms-server 0.9.301 → 3.3.1-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.last_command +7 -0
- package/broadcast/providers/redis.js +32 -57
- package/clients/nrp.js +117 -0
- package/clients/redis.js +48 -0
- package/duster/helpers/sample/nyt.js +5 -7
- package/framework/controllers.js +0 -1
- package/index.js +23 -13
- package/insight/insight.js +6 -9
- package/locks/providers/redis.js +29 -58
- package/middleware/admin/admin.js +4 -4
- package/middleware/awareness/awareness.js +4 -1
- package/middleware/awareness/plugins/editorial.js +41 -66
- package/middleware/awareness/plugins/resources.js +74 -0
- package/middleware/awareness/providers/redis.js +263 -237
- package/middleware/cache/providers/redis.js +134 -92
- package/middleware/config/config.js +41 -2
- package/middleware/deployment/deployment.js +19 -27
- package/middleware/form/form.js +18 -33
- package/middleware/modules/modules.js +64 -11
- package/middleware/proxy/proxy.js +1 -2
- package/middleware/stores/engines/s3.js +0 -2
- package/middleware/stores/stores.js +50 -6
- package/middleware/themes/themes.js +49 -0
- package/middleware/virtual-config/virtual-config.js +35 -39
- package/notifications/notifications.js +75 -2
- package/package.json +18 -20
- package/server/index.js +105 -23
- package/server/standalone.js +2 -0
- package/util/auth.js +5 -9
- package/util/cloudcms.js +19 -34
- package/util/proxy-factory.js +20 -8
- package/util/redis.js +113 -0
- package/util/renditions.js +6 -12
- package/util/request.js +117 -0
- package/util/util.js +31 -40
- package/web/socket.io/socket.io.js +4240 -2
- package/web/cms/ice.js +0 -109
- package/web/cms/preview.js +0 -106
|
@@ -3,34 +3,31 @@ exports = module.exports = {};
|
|
|
3
3
|
var util = require("../../../util/util");
|
|
4
4
|
var socketUtil = require("../../../util/socket");
|
|
5
5
|
|
|
6
|
-
var request = require("request");
|
|
7
|
-
|
|
8
|
-
var http = require("http");
|
|
9
|
-
var https = require("https");
|
|
6
|
+
var request = require("../../../util/request");
|
|
10
7
|
|
|
11
8
|
exports.bindSocket = function(socket, provider)
|
|
12
9
|
{
|
|
13
10
|
socketUtil.bindGitana(socket, function() {
|
|
14
11
|
|
|
15
|
-
socket.on("
|
|
16
|
-
|
|
12
|
+
socket.on("acquireEditorialWorkspace", function(sessionKey, repositoryId, branchId, type, force, callback) {
|
|
13
|
+
acquireEditorialWorkspace(socket, provider, sessionKey, repositoryId, branchId, type, force, callback);
|
|
17
14
|
});
|
|
18
15
|
|
|
19
|
-
socket.on("
|
|
20
|
-
|
|
16
|
+
socket.on("releaseEditorialWorkspace", function(sessionKey, repositoryId, branchId, callback) {
|
|
17
|
+
releaseEditorialWorkspace(socket, provider, sessionKey, repositoryId, branchId, callback);
|
|
21
18
|
});
|
|
22
19
|
|
|
23
|
-
socket.on("
|
|
24
|
-
|
|
20
|
+
socket.on("commitEditorialWorkspace", function(sessionKey, repositoryId, branchId, callback) {
|
|
21
|
+
commitEditorialWorkspace(socket, provider, sessionKey, repositoryId, branchId, callback);
|
|
25
22
|
});
|
|
26
23
|
|
|
27
|
-
socket.on("
|
|
28
|
-
|
|
24
|
+
socket.on("editorialWorkspaceInfo", function(sessionKey, repositoryId, branchId, callback) {
|
|
25
|
+
editorialWorkspaceInfo(socket, provider, sessionKey, repositoryId, branchId, callback);
|
|
29
26
|
});
|
|
30
27
|
|
|
31
28
|
/**
|
|
32
|
-
* Acquires an editorial
|
|
33
|
-
* If a
|
|
29
|
+
* Acquires an editorial workspace. If a workspace doesn't already exists, it is created.
|
|
30
|
+
* If a workspace already exists, it is reused unless `force` is set true.
|
|
34
31
|
*
|
|
35
32
|
* @param socket
|
|
36
33
|
* @param provider
|
|
@@ -38,12 +35,13 @@ exports.bindSocket = function(socket, provider)
|
|
|
38
35
|
* @param repositoryId
|
|
39
36
|
* @param branchId
|
|
40
37
|
* @param force
|
|
38
|
+
* @param type (either "TEMPORARY" or "AUTOSAVE", assume "TEMPORARY" if not provided)
|
|
41
39
|
* @param callback
|
|
42
40
|
*/
|
|
43
|
-
var
|
|
41
|
+
var acquireEditorialWorkspace = function(socket, provider, sessionKey, repositoryId, branchId, type, force, callback)
|
|
44
42
|
{
|
|
45
|
-
// send an HTTP command to acquire an editorial
|
|
46
|
-
var URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT) + "/oneteam/editorial/session/acquire";
|
|
43
|
+
// send an HTTP command to acquire an editorial workspace for this repository and branch
|
|
44
|
+
var URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT, process.env.GITANA_PROXY_PATH) + "/oneteam/editorial/session/acquire";
|
|
47
45
|
|
|
48
46
|
var headers = {};
|
|
49
47
|
//headers["Authorization"] = socket.gitana.platform().getDriver().getHttpHeaders()["Authorization"];
|
|
@@ -57,39 +55,37 @@ exports.bindSocket = function(socket, provider)
|
|
|
57
55
|
json.repositoryId = repositoryId;
|
|
58
56
|
json.branchId = branchId;
|
|
59
57
|
json.key = sessionKey;
|
|
58
|
+
json.type = type;
|
|
59
|
+
|
|
60
|
+
if (!json.type) {
|
|
61
|
+
json.type = "TEMPORARY";
|
|
62
|
+
}
|
|
60
63
|
|
|
61
64
|
var qs = {};
|
|
62
65
|
if (force) {
|
|
63
66
|
qs["force"] = true;
|
|
64
67
|
}
|
|
65
68
|
|
|
66
|
-
var agent = http.globalAgent;
|
|
67
|
-
if (process.env.GITANA_PROXY_SCHEME === "https")
|
|
68
|
-
{
|
|
69
|
-
agent = https.globalAgent;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
69
|
request({
|
|
73
70
|
"method": "POST",
|
|
74
71
|
"url": URL,
|
|
75
72
|
"qs": {},
|
|
76
73
|
"json": json,
|
|
77
74
|
"headers": headers,
|
|
78
|
-
"agent": agent,
|
|
79
75
|
"timeout": process.defaultHttpTimeoutMs
|
|
80
|
-
}, function(err, response,
|
|
76
|
+
}, function(err, response, json) {
|
|
81
77
|
|
|
82
|
-
if (err || (
|
|
78
|
+
if (err || (json && json.error)) {
|
|
83
79
|
return callback(err);
|
|
84
80
|
}
|
|
85
81
|
|
|
86
|
-
callback(null,
|
|
82
|
+
callback(null, json._doc, json.branchId);
|
|
87
83
|
});
|
|
88
84
|
};
|
|
89
85
|
});
|
|
90
86
|
|
|
91
87
|
/**
|
|
92
|
-
* Releases an editorial
|
|
88
|
+
* Releases an editorial workspace, deleting the workspace branch and erasing any accumulated work.
|
|
93
89
|
*
|
|
94
90
|
* @param socket
|
|
95
91
|
* @param provider
|
|
@@ -98,10 +94,10 @@ exports.bindSocket = function(socket, provider)
|
|
|
98
94
|
* @param branchId
|
|
99
95
|
* @param callback
|
|
100
96
|
*/
|
|
101
|
-
var
|
|
97
|
+
var releaseEditorialWorkspace = function(socket, provider, sessionKey, repositoryId, branchId, callback)
|
|
102
98
|
{
|
|
103
99
|
// send an HTTP command to release the session
|
|
104
|
-
var URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT) + "/oneteam/editorial/session/release";
|
|
100
|
+
var URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT, process.env.GITANA_PROXY_PATH) + "/oneteam/editorial/session/release";
|
|
105
101
|
|
|
106
102
|
var json = {};
|
|
107
103
|
json.repositoryId = repositoryId;
|
|
@@ -115,23 +111,16 @@ exports.bindSocket = function(socket, provider)
|
|
|
115
111
|
headers["GITANA_TICKET"] = gitanaTicket;
|
|
116
112
|
}
|
|
117
113
|
|
|
118
|
-
var agent = http.globalAgent;
|
|
119
|
-
if (process.env.GITANA_PROXY_SCHEME === "https")
|
|
120
|
-
{
|
|
121
|
-
agent = https.globalAgent;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
114
|
request({
|
|
125
115
|
"method": "POST",
|
|
126
116
|
"url": URL,
|
|
127
117
|
"qs": {},
|
|
128
118
|
"json": json,
|
|
129
119
|
"headers": headers,
|
|
130
|
-
"agent": agent,
|
|
131
120
|
"timeout": process.defaultHttpTimeoutMs
|
|
132
|
-
}, function(err, response,
|
|
121
|
+
}, function(err, response, json) {
|
|
133
122
|
|
|
134
|
-
if (err || (
|
|
123
|
+
if (err || (json && json.error)) {
|
|
135
124
|
return callback(err);
|
|
136
125
|
}
|
|
137
126
|
|
|
@@ -140,7 +129,7 @@ exports.bindSocket = function(socket, provider)
|
|
|
140
129
|
};
|
|
141
130
|
|
|
142
131
|
/**
|
|
143
|
-
* Sends an HTTP request back to the API to commit the contents of an editorial
|
|
132
|
+
* Sends an HTTP request back to the API to commit the contents of an editorial workspace branch back to its
|
|
144
133
|
* parent branch.
|
|
145
134
|
*
|
|
146
135
|
* @param socket
|
|
@@ -150,9 +139,9 @@ exports.bindSocket = function(socket, provider)
|
|
|
150
139
|
* @param branchId
|
|
151
140
|
* @param callback
|
|
152
141
|
*/
|
|
153
|
-
var
|
|
142
|
+
var commitEditorialWorkspace = function(socket, provider, sessionKey, repositoryId, branchId, callback)
|
|
154
143
|
{
|
|
155
|
-
var URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT) + "/oneteam/editorial/session/commit";
|
|
144
|
+
var URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT, process.env.GITANA_PROXY_PATH) + "/oneteam/editorial/session/commit";
|
|
156
145
|
|
|
157
146
|
var json = {};
|
|
158
147
|
json.repositoryId = repositoryId;
|
|
@@ -166,32 +155,25 @@ exports.bindSocket = function(socket, provider)
|
|
|
166
155
|
headers["GITANA_TICKET"] = gitanaTicket;
|
|
167
156
|
}
|
|
168
157
|
|
|
169
|
-
var agent = http.globalAgent;
|
|
170
|
-
if (process.env.GITANA_PROXY_SCHEME === "https")
|
|
171
|
-
{
|
|
172
|
-
agent = https.globalAgent;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
158
|
request({
|
|
176
159
|
"method": "POST",
|
|
177
160
|
"url": URL,
|
|
178
161
|
"qs": {},
|
|
179
162
|
"json": json,
|
|
180
163
|
"headers": headers,
|
|
181
|
-
"agent": agent,
|
|
182
164
|
"timeout": process.defaultHttpTimeoutMs
|
|
183
|
-
}, function(err, response,
|
|
165
|
+
}, function(err, response, json) {
|
|
184
166
|
|
|
185
|
-
if (err || (
|
|
167
|
+
if (err || (json && json.error)) {
|
|
186
168
|
return callback(err);
|
|
187
169
|
}
|
|
188
170
|
|
|
189
|
-
callback(null,
|
|
171
|
+
callback(null, json);
|
|
190
172
|
});
|
|
191
173
|
};
|
|
192
174
|
|
|
193
175
|
/**
|
|
194
|
-
* Sends an HTTP request back to the API to request information about an existing editorial
|
|
176
|
+
* Sends an HTTP request back to the API to request information about an existing editorial workspace.
|
|
195
177
|
*
|
|
196
178
|
* @param socket
|
|
197
179
|
* @param provider
|
|
@@ -200,9 +182,9 @@ exports.bindSocket = function(socket, provider)
|
|
|
200
182
|
* @param branchId
|
|
201
183
|
* @param callback
|
|
202
184
|
*/
|
|
203
|
-
var
|
|
185
|
+
var editorialWorkspaceInfo = function(socket, provider, sessionKey, repositoryId, branchId, callback)
|
|
204
186
|
{
|
|
205
|
-
var URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT) + "/oneteam/editorial/session/info";
|
|
187
|
+
var URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT, process.env.GITANA_PROXY_PATH) + "/oneteam/editorial/session/info";
|
|
206
188
|
|
|
207
189
|
var json = {};
|
|
208
190
|
json.repositoryId = repositoryId;
|
|
@@ -216,31 +198,24 @@ exports.bindSocket = function(socket, provider)
|
|
|
216
198
|
headers["GITANA_TICKET"] = gitanaTicket;
|
|
217
199
|
}
|
|
218
200
|
|
|
219
|
-
var agent = http.globalAgent;
|
|
220
|
-
if (process.env.GITANA_PROXY_SCHEME === "https")
|
|
221
|
-
{
|
|
222
|
-
agent = https.globalAgent;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
201
|
request({
|
|
226
202
|
"method": "POST",
|
|
227
203
|
"url": URL,
|
|
228
204
|
"qs": {},
|
|
229
205
|
"json": json,
|
|
230
206
|
"headers": headers,
|
|
231
|
-
"agent": agent,
|
|
232
207
|
"timeout": process.defaultHttpTimeoutMs
|
|
233
|
-
}, function(err, response,
|
|
208
|
+
}, function(err, response, json) {
|
|
234
209
|
|
|
235
|
-
if (err || (
|
|
210
|
+
if (err || (json && json.error)) {
|
|
236
211
|
return callback(err);
|
|
237
212
|
}
|
|
238
213
|
|
|
239
|
-
if (!
|
|
214
|
+
if (!json.exists) {
|
|
240
215
|
return callback(null, false);
|
|
241
216
|
}
|
|
242
217
|
|
|
243
|
-
callback(null, true,
|
|
218
|
+
callback(null, true, json.workspace);
|
|
244
219
|
});
|
|
245
220
|
};
|
|
246
221
|
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
exports = module.exports = {};
|
|
2
|
+
|
|
3
|
+
var util = require("../../../util/util");
|
|
4
|
+
var socketUtil = require("../../../util/socket");
|
|
5
|
+
|
|
6
|
+
var subscriptionsBound = false;
|
|
7
|
+
|
|
8
|
+
var bindSubscriptions = function()
|
|
9
|
+
{
|
|
10
|
+
if (subscriptionsBound) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
subscriptionsBound = true;
|
|
15
|
+
|
|
16
|
+
// LISTEN: "deployment_synced"
|
|
17
|
+
process.broadcast.subscribe("deployment_synced", function (message, channel, done) {
|
|
18
|
+
|
|
19
|
+
if (!done) {
|
|
20
|
+
done = function () {};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
var deployment = message.deployment;
|
|
24
|
+
|
|
25
|
+
var resources = deployment.resources;
|
|
26
|
+
for (var k in resources)
|
|
27
|
+
{
|
|
28
|
+
var resourceObject = resources[k]; // state, operation, reference, headReference
|
|
29
|
+
|
|
30
|
+
var reference = resourceObject.reference;
|
|
31
|
+
var headReference = resourceObject.headReference;
|
|
32
|
+
|
|
33
|
+
var deploymentObject = JSON.parse(JSON.stringify(deployment));
|
|
34
|
+
delete deploymentObject.reference;
|
|
35
|
+
delete deploymentObject.headReference;
|
|
36
|
+
delete deploymentObject.resources;
|
|
37
|
+
delete deploymentObject.targetSummaries;
|
|
38
|
+
|
|
39
|
+
var watchObject = {
|
|
40
|
+
"type": "deployment_synced",
|
|
41
|
+
"resource": resourceObject,
|
|
42
|
+
"deployment": deploymentObject
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// fire to reference
|
|
46
|
+
process.IO.to(reference).emit("watchResource", reference, watchObject);
|
|
47
|
+
|
|
48
|
+
// fire to head reference
|
|
49
|
+
process.IO.to(headReference).emit("watchResource", headReference, watchObject);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
done();
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
exports.bindSocket = function(socket, provider)
|
|
57
|
+
{
|
|
58
|
+
bindSubscriptions();
|
|
59
|
+
|
|
60
|
+
socketUtil.bindGitana(socket, function() {
|
|
61
|
+
|
|
62
|
+
socket.on("watchResource", function(reference, callback) {
|
|
63
|
+
|
|
64
|
+
if (reference)
|
|
65
|
+
{
|
|
66
|
+
// join room for this reference
|
|
67
|
+
//console.log("watchResource, room: " + reference);
|
|
68
|
+
socket.join(reference);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
callback();
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
};
|