Created
August 19, 2016 08:23
-
-
Save henryoswald/5ba4de7ea9284b2f6ab1c5426d3da113 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Only in web-api-sharelatex-blue/current/app/coffee/Features/Analytics: AnalyticsController.coffee | |
Only in web-api-sharelatex-blue/current/app/coffee/Features/Analytics: AnalyticsManager.coffee | |
diff -r web-api-sharelatex-blue/current/app/coffee/Features/Authentication/AuthenticationController.coffee web-api-sharelatex-green/current/app/coffee/Features/Authentication/AuthenticationController.coffee | |
12,13d11 | |
< UserSessionsManager = require("../User/UserSessionsManager") | |
< Analytics = require "../Analytics/AnalyticsManager" | |
18c16 | |
< | |
--- | |
> | |
41d38 | |
< Analytics.recordEvent user._id, "user-logged-in" | |
67c64 | |
< AuthenticationController._redirectToLoginOrRegisterPage(req, res) | |
--- | |
> AuthenticationController._redirectToLoginOrRegisterPage(req, res) | |
98c95 | |
< return AuthenticationController._redirectToRegisterPage(req, res) | |
--- | |
> return AuthenticationController._redirectToRegisterPage(req, res) | |
100c97 | |
< AuthenticationController._redirectToLoginPage(req, res) | |
--- | |
> AuthenticationController._redirectToLoginPage(req, res) | |
138,139d134 | |
< session_created: (new Date()).toISOString() | |
< ip_address: req.ip | |
149,150d143 | |
< | |
< UserSessionsManager.trackSession(user, req.sessionID, () ->) | |
diff -r web-api-sharelatex-blue/current/app/coffee/Features/Blog/BlogController.coffee web-api-sharelatex-green/current/app/coffee/Features/Blog/BlogController.coffee | |
30,31d29 | |
< if settings.cdn?.web?.host? | |
< data?.content = data?.content?.replace(/src="([^"]+)"/g, "src='#{settings.cdn?.web?.host}$1'"); | |
diff -r web-api-sharelatex-blue/current/app/coffee/Features/Collaborators/CollaboratorsController.coffee web-api-sharelatex-green/current/app/coffee/Features/Collaborators/CollaboratorsController.coffee | |
7,9c7 | |
< EmailHelper = require "../Helpers/EmailHelper" | |
< logger = require 'logger-sharelatex' | |
< | |
--- | |
> mimelib = require("mimelib") | |
21,22c19,20 | |
< | |
< email = EmailHelper.parseEmail(email) | |
--- | |
> | |
> email = mimelib.parseAddresses(email or "")[0]?.address?.toLowerCase() | |
25c23 | |
< | |
--- | |
> | |
40d37 | |
< EditorRealTimeController.emitToRoom project_id, 'project:membership:changed', {members: true} | |
42c39 | |
< | |
--- | |
> | |
56,63d52 | |
< getAllMembers: (req, res, next) -> | |
< projectId = req.params.Project_id | |
< logger.log {projectId}, "getting all active members for project" | |
< CollaboratorsHandler.getAllMembers projectId, (err, members) -> | |
< if err? | |
< logger.err {projectId}, "error getting members for project" | |
< return next(err) | |
< res.json({members: members}) | |
diff -r web-api-sharelatex-blue/current/app/coffee/Features/Collaborators/CollaboratorsEmailHandler.coffee web-api-sharelatex-green/current/app/coffee/Features/Collaborators/CollaboratorsEmailHandler.coffee | |
5,13c5 | |
< | |
< module.exports = CollaboratorsEmailHandler = | |
< | |
< _buildInviteUrl: (project, invite) -> | |
< "#{Settings.siteUrl}/project/#{project._id}/invite/token/#{invite.token}?" + [ | |
< "project_name=#{encodeURIComponent(project.name)}" | |
< "user_first_name=#{encodeURIComponent(project.owner_ref.first_name)}" | |
< ].join("&") | |
< | |
--- | |
> module.exports = | |
33,48c25 | |
< EmailHandler.sendEmail "projectSharedWithYou", emailOptions, callback | |
< | |
< notifyUserOfProjectInvite: (project_id, email, invite, callback)-> | |
< Project | |
< .findOne(_id: project_id ) | |
< .select("name owner_ref") | |
< .populate('owner_ref') | |
< .exec (err, project)-> | |
< emailOptions = | |
< to: email | |
< replyTo: project.owner_ref.email | |
< project: | |
< name: project.name | |
< inviteUrl: CollaboratorsEmailHandler._buildInviteUrl(project, invite) | |
< owner: project.owner_ref | |
< EmailHandler.sendEmail "projectInvite", emailOptions, callback | |
--- | |
> EmailHandler.sendEmail "projectSharedWithYou", emailOptions, callback | |
\ No newline at end of file | |
diff -r web-api-sharelatex-blue/current/app/coffee/Features/Collaborators/CollaboratorsHandler.coffee web-api-sharelatex-green/current/app/coffee/Features/Collaborators/CollaboratorsHandler.coffee | |
2a3 | |
> mimelib = require("mimelib") | |
10,12d10 | |
< EmailHelper = require "../Helpers/EmailHelper" | |
< ProjectEditorHandler = require "../Project/ProjectEditorHandler" | |
< | |
15d12 | |
< | |
27c24 | |
< | |
--- | |
> | |
32c29 | |
< | |
--- | |
> | |
47c44 | |
< | |
--- | |
> | |
57c54 | |
< | |
--- | |
> | |
62c59 | |
< | |
--- | |
> | |
75c72 | |
< | |
--- | |
> | |
82c79 | |
< | |
--- | |
> | |
92c89 | |
< | |
--- | |
> | |
104c101 | |
< | |
--- | |
> | |
106c103,104 | |
< email = EmailHelper.parseEmail(unparsed_email) | |
--- | |
> emails = mimelib.parseAddresses(unparsed_email) | |
> email = emails[0]?.address?.toLowerCase() | |
123c121 | |
< | |
--- | |
> | |
132a131,135 | |
> # Do these in the background | |
> UserGetter.getUser user_id, {email: 1}, (error, user) -> | |
> if error? | |
> logger.error {err: error, project_id, user_id}, "error getting user while adding to project" | |
> CollaboratorsEmailHandler.notifyUserOfProjectShare project_id, user.email | |
143,151d145 | |
< | |
< getAllMembers: (projectId, callback=(err, members)->) -> | |
< logger.log {projectId}, "fetching all members" | |
< CollaboratorsHandler.getMembersWithPrivilegeLevels projectId, (error, rawMembers) -> | |
< if error? | |
< logger.err {projectId, error}, "error getting members for project" | |
< return callback(error) | |
< {owner, members} = ProjectEditorHandler.buildOwnerAndMembersViews(rawMembers) | |
< callback(null, members) | |
Only in web-api-sharelatex-blue/current/app/coffee/Features/Collaborators: CollaboratorsInviteController.coffee | |
Only in web-api-sharelatex-blue/current/app/coffee/Features/Collaborators: CollaboratorsInviteHandler.coffee | |
diff -r web-api-sharelatex-blue/current/app/coffee/Features/Collaborators/CollaboratorsRouter.coffee web-api-sharelatex-green/current/app/coffee/Features/Collaborators/CollaboratorsRouter.coffee | |
4,5d3 | |
< CollaboratorsInviteController = require('./CollaboratorsInviteController') | |
< RateLimiterMiddlewear = require('../Security/RateLimiterMiddlewear') | |
13,72d10 | |
< | |
< webRouter.get( | |
< '/project/:Project_id/members', | |
< AuthenticationController.requireLogin(), | |
< AuthorizationMiddlewear.ensureUserCanAdminProject, | |
< CollaboratorsController.getAllMembers | |
< ) | |
< | |
< # invites | |
< webRouter.post( | |
< '/project/:Project_id/invite', | |
< RateLimiterMiddlewear.rateLimit({ | |
< endpointName: "invite-to-project" | |
< params: ["Project_id"] | |
< maxRequests: 200 | |
< timeInterval: 60 * 10 | |
< }), | |
< AuthenticationController.requireLogin(), | |
< AuthorizationMiddlewear.ensureUserCanAdminProject, | |
< CollaboratorsInviteController.inviteToProject | |
< ) | |
< | |
< webRouter.get( | |
< '/project/:Project_id/invites', | |
< AuthenticationController.requireLogin(), | |
< AuthorizationMiddlewear.ensureUserCanAdminProject, | |
< CollaboratorsInviteController.getAllInvites | |
< ) | |
< | |
< webRouter.delete( | |
< '/project/:Project_id/invite/:invite_id', | |
< AuthenticationController.requireLogin(), | |
< AuthorizationMiddlewear.ensureUserCanAdminProject, | |
< CollaboratorsInviteController.revokeInvite | |
< ) | |
< | |
< webRouter.post( | |
< '/project/:Project_id/invite/:invite_id/resend', | |
< RateLimiterMiddlewear.rateLimit({ | |
< endpointName: "resend-invite" | |
< params: ["Project_id"] | |
< maxRequests: 200 | |
< timeInterval: 60 * 10 | |
< }), | |
< AuthenticationController.requireLogin(), | |
< AuthorizationMiddlewear.ensureUserCanAdminProject, | |
< CollaboratorsInviteController.resendInvite | |
< ) | |
< | |
< webRouter.get( | |
< '/project/:Project_id/invite/token/:token', | |
< AuthenticationController.requireLogin(), | |
< CollaboratorsInviteController.viewInvite | |
< ) | |
< | |
< webRouter.post( | |
< '/project/:Project_id/invite/:invite_id/accept', | |
< AuthenticationController.requireLogin(), | |
< CollaboratorsInviteController.acceptInvite | |
< ) | |
diff -r web-api-sharelatex-blue/current/app/coffee/Features/Compile/ClsiManager.coffee web-api-sharelatex-green/current/app/coffee/Features/Compile/ClsiManager.coffee | |
39,45d38 | |
< stopCompile: (project_id, user_id, options, callback = (error) ->) -> | |
< compilerUrl = @_getCompilerUrl(options?.compileGroup, project_id, user_id, "compile/stop") | |
< opts = | |
< url:compilerUrl | |
< method:"POST" | |
< ClsiManager._makeRequest project_id, opts, callback | |
< | |
150d142 | |
< check: options.check | |
diff -r web-api-sharelatex-blue/current/app/coffee/Features/Compile/CompileController.coffee web-api-sharelatex-green/current/app/coffee/Features/Compile/CompileController.coffee | |
32,33c32,33 | |
< if req.body?.check in ['validate', 'error', 'silent'] | |
< options.check = req.body.check | |
--- | |
> if req.query?.isolated is "true" | |
> options.isolated = true | |
46,54d45 | |
< stopCompile: (req, res, next = (error) ->) -> | |
< project_id = req.params.Project_id | |
< AuthenticationController.getLoggedInUserId req, (error, user_id) -> | |
< return next(error) if error? | |
< logger.log {project_id:project_id, user_id:user_id}, "stop compile request" | |
< CompileManager.stopCompile project_id, user_id, (error) -> | |
< return next(error) if error? | |
< res.status(200).send() | |
< | |
56,57c47,49 | |
< # callback with user_id if per-user, undefined otherwise | |
< if not Settings.disablePerUserCompiles | |
--- | |
> # callback with user_id if isolated flag is set on request, undefined otherwise | |
> isolated = req.query?.isolated is "true" | |
> if isolated | |
63,64c55,57 | |
< # callback with user_id if per-user, undefined otherwise | |
< if not Settings.disablePerUserCompiles | |
--- | |
> # callback with user_id if isolated flag or user_id param is set on request, undefined otherwise | |
> isolated = req.query?.isolated is "true" or req.params.user_id? | |
> if isolated | |
168,176c161 | |
< if not file? | |
< return next(new Error("missing file parameter")) | |
< # Check that we are dealing with a simple file path (this is not | |
< # strictly needed because synctex uses this parameter as a label | |
< # to look up in the synctex output, and does not open the file | |
< # itself). Since we have valid synctex paths like foo/./bar we | |
< # allow those by replacing /./ with / | |
< testPath = file.replace '/./', '/' | |
< if Path.resolve("/", testPath) isnt "/#{testPath}" | |
--- | |
> if not file? or Path.resolve("/", file) isnt "/#{file}" | |
diff -r web-api-sharelatex-blue/current/app/coffee/Features/Compile/CompileManager.coffee web-api-sharelatex-green/current/app/coffee/Features/Compile/CompileManager.coffee | |
41c41 | |
< compileAsUser = if Settings.disablePerUserCompiles then undefined else user_id | |
--- | |
> compileAsUser = if options.isolated then user_id else undefined | |
47,52d46 | |
< | |
< stopCompile: (project_id, user_id, callback = (error) ->) -> | |
< CompileManager.getProjectCompileLimits project_id, (error, limits) -> | |
< return callback(error) if error? | |
< ClsiManager.stopCompile project_id, user_id, limits, callback | |
< | |
diff -r web-api-sharelatex-blue/current/app/coffee/Features/Editor/EditorHttpController.coffee web-api-sharelatex-green/current/app/coffee/Features/Editor/EditorHttpController.coffee | |
12d11 | |
< CollaboratorsInviteHandler = require("../Collaborators/CollaboratorsInviteHandler") | |
34d32 | |
< logger.log {project_id, user_id}, "building the joinProject view" | |
45,49c43,44 | |
< logger.log {project_id, user_id, privilegeLevel}, "not an acceptable privilege level, returning null" | |
< return callback null, null, false | |
< CollaboratorsInviteHandler.getAllInvites project_id, (error, invites) -> | |
< return callback(error) if error? | |
< logger.log {project_id, user_id, memberCount: members.length, inviteCount: invites.length, privilegeLevel}, "returning project model view" | |
--- | |
> callback null, null, false | |
> else | |
51c46 | |
< ProjectEditorHandler.buildProjectModelView(project, members, invites), | |
--- | |
> ProjectEditorHandler.buildProjectModelView(project, members), | |
142a138,139 | |
> | |
> | |
diff -r web-api-sharelatex-blue/current/app/coffee/Features/Email/EmailBuilder.coffee web-api-sharelatex-green/current/app/coffee/Features/Email/EmailBuilder.coffee | |
10c10 | |
< templates.registered = | |
--- | |
> templates.registered = | |
22c22 | |
< templates.canceledSubscription = | |
--- | |
> templates.canceledSubscription = | |
39c39 | |
< templates.passwordResetRequested = | |
--- | |
> templates.passwordResetRequested = | |
69c69 | |
< templates.projectSharedWithYou = | |
--- | |
> templates.projectSharedWithYou = | |
90,105d89 | |
< templates.projectInvite = | |
< subject: _.template "<%= project.name %> - shared by <%= owner.email %>" | |
< layout: NotificationEmailLayout | |
< type:"notification" | |
< compiledTemplate: _.template """ | |
< <p>Hi, <%= owner.email %> wants to share <a href="<%= project.url %>">'<%= project.name %>'</a> with you</p> | |
< <center> | |
< <a style="text-decoration: none; width: 200px; background-color: #a93629; border: 1px solid #e24b3b; border-radius: 3px; padding: 15px; margin: 24px; display: block;" href="<%= inviteUrl %>" style="text-decoration:none" target="_blank"> | |
< <span style= "font-size:16px;font-family:Helvetica,Arial;font-weight:400;color:#fff;white-space:nowrap;display:block; text-align:center"> | |
< View Project | |
< </span> | |
< </a> | |
< </center> | |
< <p> Thank you</p> | |
< <p> <a href="<%= siteUrl %>">#{settings.appName}</a></p> | |
< """ | |
107c91 | |
< templates.completeJoinGroupAccount = | |
--- | |
> templates.completeJoinGroupAccount = | |
141a126 | |
> | |
Only in web-api-sharelatex-blue/current/app/coffee/Features: Helpers | |
diff -r web-api-sharelatex-blue/current/app/coffee/Features/Notifications/NotificationsBuilder.coffee web-api-sharelatex-green/current/app/coffee/Features/Notifications/NotificationsBuilder.coffee | |
4,6c4 | |
< module.exports = | |
< | |
< # Note: notification keys should be url-safe | |
--- | |
> module.exports = | |
11c9 | |
< messageOpts = | |
--- | |
> messageOpts = | |
15c13 | |
< NotificationsHandler.createNotification user._id, @key, "notification_group_invite", messageOpts, null, false, callback | |
--- | |
> NotificationsHandler.createNotification user._id, @key, "notification_group_invite", messageOpts, callback | |
19,31d16 | |
< | |
< projectInvite: (invite, project, sendingUser, user) -> | |
< key: "project-invite-#{invite._id}" | |
< create: (callback=()->) -> | |
< messageOpts = | |
< userName: sendingUser.first_name | |
< projectName: project.name | |
< projectId: project._id.toString() | |
< token: invite.token | |
< logger.log {user_id: user._id, project_id: project._id, invite_id: invite._id, key: @key}, "creating project invite notification for user" | |
< NotificationsHandler.createNotification user._id, @key, "notification_project_invite", messageOpts, invite.expires, true, callback | |
< read: (callback=()->) -> | |
< NotificationsHandler.markAsReadByKeyOnly @key, callback | |
diff -r web-api-sharelatex-blue/current/app/coffee/Features/Notifications/NotificationsHandler.coffee web-api-sharelatex-green/current/app/coffee/Features/Notifications/NotificationsHandler.coffee | |
13c13 | |
< module.exports = | |
--- | |
> module.exports = | |
16c16 | |
< opts = | |
--- | |
> opts = | |
32,42c32,33 | |
< createNotification: (user_id, key, templateKey, messageOpts, expiryDateTime, forceCreate, callback)-> | |
< payload = { | |
< key:key | |
< messageOpts:messageOpts | |
< templateKey:templateKey | |
< } | |
< if expiryDateTime? | |
< payload.expires = expiryDateTime | |
< if forceCreate | |
< payload.forceCreate = true | |
< opts = | |
--- | |
> createNotification: (user_id, key, templateKey, messageOpts, callback)-> | |
> opts = | |
46c37,41 | |
< json: payload | |
--- | |
> json: { | |
> key:key | |
> messageOpts:messageOpts | |
> templateKey:templateKey | |
> } | |
51c46 | |
< opts = | |
--- | |
> opts = | |
60c55 | |
< | |
--- | |
> | |
68,77d62 | |
< makeRequest opts, callback | |
< | |
< # removes notification by key, without regard for user_id, | |
< # should not be exposed to user via ui/router | |
< markAsReadByKeyOnly: (key, callback)-> | |
< opts = | |
< uri: "#{settings.apis.notifications?.url}/key/#{key}" | |
< method: "DELETE" | |
< timeout: oneSecond | |
< logger.log {key:key}, "sending mark notification as read with key-only to notifications api" | |
diff -r web-api-sharelatex-blue/current/app/coffee/Features/PasswordReset/PasswordResetController.coffee web-api-sharelatex-green/current/app/coffee/Features/PasswordReset/PasswordResetController.coffee | |
5d4 | |
< UserSessionsManager = require("../User/UserSessionsManager") | |
51,58c50,55 | |
< UserSessionsManager.revokeAllUserSessions {_id: user_id}, [], (err) -> | |
< return next(err) if err? | |
< if req.body.login_after | |
< UserGetter.getUser user_id, {email: 1}, (err, user) -> | |
< return next(err) if err? | |
< AuthenticationController.doLogin {email:user.email, password: password}, req, res, next | |
< else | |
< res.sendStatus 200 | |
--- | |
> if req.body.login_after | |
> UserGetter.getUser user_id, {email: 1}, (err, user) -> | |
> return next(err) if err? | |
> AuthenticationController.doLogin {email:user.email, password: password}, req, res, next | |
> else | |
> res.sendStatus 200 | |
diff -r web-api-sharelatex-blue/current/app/coffee/Features/Project/ProjectController.coffee web-api-sharelatex-green/current/app/coffee/Features/Project/ProjectController.coffee | |
248d247 | |
< signUpDate : user.signUpDate | |
diff -r web-api-sharelatex-blue/current/app/coffee/Features/Project/ProjectEditorHandler.coffee web-api-sharelatex-green/current/app/coffee/Features/Project/ProjectEditorHandler.coffee | |
4c4 | |
< buildProjectModelView: (project, members, invites) -> | |
--- | |
> buildProjectModelView: (project, members) -> | |
18,25c18,26 | |
< invites: invites | |
< | |
< if !result.invites? | |
< result.invites = [] | |
< | |
< {owner, ownerFeatures, members} = @buildOwnerAndMembersViews(members) | |
< result.owner = owner | |
< result.members = members | |
--- | |
> | |
> owner = null | |
> for member in members | |
> if member.privilegeLevel == "owner" | |
> owner = member.user | |
> else | |
> result.members.push @buildUserModelView member.user, member.privilegeLevel | |
> if owner? | |
> result.owner = @buildUserModelView owner, "owner" | |
27c28 | |
< result.features = _.defaults(ownerFeatures or {}, { | |
--- | |
> result.features = _.defaults(owner?.features or {}, { | |
38,49d38 | |
< | |
< buildOwnerAndMembersViews: (members) -> | |
< owner = null | |
< ownerFeatures = null | |
< filteredMembers = [] | |
< for member in members | |
< if member.privilegeLevel == "owner" | |
< ownerFeatures = member.user.features | |
< owner = @buildUserModelView member.user, "owner" | |
< else | |
< filteredMembers.push @buildUserModelView member.user, member.privilegeLevel | |
< {owner: owner, ownerFeatures: ownerFeatures, members: filteredMembers} | |
diff -r web-api-sharelatex-blue/current/app/coffee/Features/Project/ProjectEntityHandler.coffee web-api-sharelatex-green/current/app/coffee/Features/Project/ProjectEntityHandler.coffee | |
515,519d514 | |
< if path.resolve("/", element.name) isnt "/#{element.name}" or element.name.match("/") | |
< e = new Error("invalid element name") | |
< logger.err project_id:project._id, folder_id:folder_id, element:element, type:type, "failed trying to insert element as name was invalid" | |
< return callback(e) | |
< | |
diff -r web-api-sharelatex-blue/current/app/coffee/Features/References/ReferencesController.coffee web-api-sharelatex-green/current/app/coffee/Features/References/ReferencesController.coffee | |
35,36c35,36 | |
< return res.json({projectId, keys: []}) | |
< if shouldBroadcast | |
--- | |
> return res.send() | |
> else if shouldBroadcast | |
diff -r web-api-sharelatex-blue/current/app/coffee/Features/References/ReferencesHandler.coffee web-api-sharelatex-green/current/app/coffee/Features/References/ReferencesHandler.coffee | |
7c7 | |
< _ = require('underscore') | |
--- | |
> U = require('underscore') | |
25c25 | |
< _.each (folder.fileRefs or []), (file) -> | |
--- | |
> (folder.fileRefs or []).forEach (file) -> | |
28c28 | |
< _.each (folder.folders or []), (folder) -> | |
--- | |
> (folder.folders or []).forEach (folder) -> | |
30c30 | |
< _.each (project.rootFolder or []), (rootFolder) -> | |
--- | |
> (project.rootFolder or []).forEach (rootFolder) -> | |
37c37 | |
< _.each (folder.docs or []), (doc) -> | |
--- | |
> (folder.docs or []).forEach (doc) -> | |
40c40 | |
< _.each (folder.folders or []), (folder) -> | |
--- | |
> (folder.folders or []).forEach (folder) -> | |
42c42 | |
< _.each (project.rootFolder or []), (rootFolder) -> | |
--- | |
> (project.rootFolder or []).forEach (rootFolder) -> | |
diff -r web-api-sharelatex-blue/current/app/coffee/Features/Security/OneTimeTokenHandler.coffee web-api-sharelatex-green/current/app/coffee/Features/Security/OneTimeTokenHandler.coffee | |
33c33 | |
< callback err, results?[0] | |
--- | |
> callback err, results[0] | |
diff -r web-api-sharelatex-blue/current/app/coffee/Features/Subscription/LimitationsManager.coffee web-api-sharelatex-green/current/app/coffee/Features/Subscription/LimitationsManager.coffee | |
7d6 | |
< CollaboratorsInvitesHandler = require("../Collaborators/CollaboratorsInviteHandler") | |
24,29c23,26 | |
< CollaboratorsInvitesHandler.getInviteCount project_id, (error, invite_count) => | |
< return callback(error) if error? | |
< if current_number + invite_count + x_collaborators <= allowed_number or allowed_number < 0 | |
< callback null, true | |
< else | |
< callback null, false | |
--- | |
> if current_number + x_collaborators <= allowed_number or allowed_number < 0 | |
> callback null, true | |
> else | |
> callback null, false | |
44c41 | |
< hasValidSubscription = subscription? and (subscription.recurlySubscription_id? or subscription?.customAccount == true) | |
--- | |
> hasValidSubscription = subscription? and subscription.recurlySubscription_id? | |
47c44 | |
< | |
--- | |
> | |
70a68 | |
> | |
diff -r web-api-sharelatex-blue/current/app/coffee/Features/Uploads/ProjectUploadController.coffee web-api-sharelatex-green/current/app/coffee/Features/Uploads/ProjectUploadController.coffee | |
30,31c30,31 | |
< name = req.files.qqfile?.originalname | |
< path = req.files.qqfile?.path | |
--- | |
> name = req.files.qqfile.originalname | |
> path = req.files.qqfile.path | |
diff -r web-api-sharelatex-blue/current/app/coffee/Features/User/UserController.coffee web-api-sharelatex-green/current/app/coffee/Features/User/UserController.coffee | |
11d10 | |
< UserSessionsManager = require("./UserSessionsManager") | |
85,86d83 | |
< sessionId = req.sessionID | |
< user = req?.session?.user | |
90d86 | |
< UserSessionsManager.untrackSession(user, sessionId) | |
124,129c120,123 | |
< UserSessionsManager.revokeAllUserSessions user, [req.sessionID], (err) -> | |
< return next(err) if err? | |
< res.send | |
< message: | |
< type:'success' | |
< text:'Your password has been changed' | |
--- | |
> res.send | |
> message: | |
> type:'success' | |
> text:'Your password has been changed' | |
135a130,132 | |
> | |
> | |
> | |
diff -r web-api-sharelatex-blue/current/app/coffee/Features/User/UserRegistrationHandler.coffee web-api-sharelatex-green/current/app/coffee/Features/User/UserRegistrationHandler.coffee | |
11d10 | |
< Analytics = require "../Analytics/AnalyticsManager" | |
66d64 | |
< Analytics.recordEvent user._id, "user-registered" | |
Only in web-api-sharelatex-blue/current/app/coffee/Features/User: UserSessionsManager.coffee | |
diff -r web-api-sharelatex-blue/current/app/coffee/infrastructure/ExpressLocals.coffee web-api-sharelatex-green/current/app/coffee/infrastructure/ExpressLocals.coffee | |
10d9 | |
< Url = require "url" | |
14,15d12 | |
< | |
< | |
22d18 | |
< | |
44,55c40 | |
< | |
< getFingerprint = (path) -> | |
< if fingerprints[path]? | |
< return fingerprints[path] | |
< else | |
< logger.err "No fingerprint for file: #{path}" | |
< return "" | |
< | |
< logger.log "Finished generating file fingerprints" | |
< | |
< cdnAvailable = Settings.cdn?.web?.host? | |
< darkCdnAvailable = Settings.cdn?.web?.darkHost? | |
--- | |
> | |
63,74d47 | |
< | |
< isDark = req.headers?.host?.slice(0,4)?.toLowerCase() == "dark" | |
< isSmoke = req.headers?.host?.slice(0,5)?.toLowerCase() == "smoke" | |
< isLive = !isDark and !isSmoke | |
< | |
< if cdnAvailable and isLive | |
< staticFilesBase = Settings.cdn?.web?.host | |
< else if darkCdnAvailable and isDark | |
< staticFilesBase = Settings.cdn?.web?.darkHost | |
< else | |
< staticFilesBase = "" | |
< | |
76,107d48 | |
< res.locals.fullJsPath = Url.resolve(staticFilesBase, jsPath) | |
< | |
< | |
< res.locals.buildJsPath = (jsFile, opts = {})-> | |
< path = Path.join(jsPath, jsFile) | |
< | |
< doFingerPrint = opts.fingerprint != false | |
< | |
< if !opts.qs? | |
< opts.qs = {} | |
< | |
< if !opts.qs?.fingerprint? and doFingerPrint | |
< opts.qs.fingerprint = getFingerprint(path) | |
< | |
< if opts.cdn != false | |
< path = Url.resolve(staticFilesBase, path) | |
< | |
< qs = querystring.stringify(opts.qs) | |
< | |
< if qs? and qs.length > 0 | |
< path = path + "?" + qs | |
< return path | |
< | |
< | |
< res.locals.buildCssPath = (cssFile)-> | |
< path = Path.join("/stylesheets/", cssFile) | |
< return Url.resolve(staticFilesBase, path) + "?fingerprint=" + getFingerprint(path) | |
< | |
< res.locals.buildImgPath = (imgFile)-> | |
< path = Path.join("/img/", imgFile) | |
< return Url.resolve(staticFilesBase, path) | |
< | |
110,111d50 | |
< | |
< | |
177c116,121 | |
< res.locals.fingerprint = getFingerprint | |
--- | |
> res.locals.fingerprint = (path) -> | |
> if fingerprints[path]? | |
> return fingerprints[path] | |
> else | |
> logger.err "No fingerprint for file: #{path}" | |
> return "" | |
diff -r web-api-sharelatex-blue/current/app/coffee/infrastructure/Server.coffee web-api-sharelatex-green/current/app/coffee/infrastructure/Server.coffee | |
34d33 | |
< UserSessionsManager = require "../Features/User/UserSessionsManager" | |
93,94d91 | |
< if req?.session?.user? | |
< UserSessionsManager.touch(req.session.user, (err)->) | |
103a101,102 | |
> | |
> | |
109,114c108,109 | |
< webRouter.use (req, res, next) -> | |
< if Settings.editorIsOpen | |
< next() | |
< else if req.url.indexOf("/admin") == 0 | |
< next() | |
< else | |
--- | |
> app.use (req, res, next) -> | |
> if !Settings.editorIsOpen | |
116a112,113 | |
> else | |
> next() | |
120c117 | |
< | |
--- | |
> | |
diff -r web-api-sharelatex-blue/current/app/coffee/models/ProjectInvite.coffee web-api-sharelatex-green/current/app/coffee/models/ProjectInvite.coffee | |
4d3 | |
< | |
8,32c7,15 | |
< | |
< EXPIRY_IN_SECONDS = 60 * 60 * 24 * 30 | |
< | |
< ExpiryDate = () -> | |
< timestamp = new Date() | |
< timestamp.setSeconds(timestamp.getSeconds() + EXPIRY_IN_SECONDS) | |
< return timestamp | |
< | |
< | |
< | |
< ProjectInviteSchema = new Schema( | |
< { | |
< email: String | |
< token: String | |
< sendingUserId: ObjectId | |
< projectId: ObjectId | |
< privileges: String | |
< createdAt: {type: Date, default: Date.now} | |
< expires: {type: Date, default: ExpiryDate, index: {expireAfterSeconds: 10}} | |
< }, | |
< { | |
< collection: 'projectInvites' | |
< } | |
< ) | |
< | |
--- | |
> ProjectInviteSchema = new Schema | |
> project_id: ObjectId | |
> from_user_id: ObjectId | |
> privilegeLevel: String | |
> # For existing users | |
> to_user_id: ObjectId | |
> # For non-existant users | |
> hashed_token: String | |
> email: String | |
36d18 | |
< | |
41,42c23 | |
< exports.ProjectInviteSchema = ProjectInviteSchema | |
< exports.EXPIRY_IN_SECONDS = EXPIRY_IN_SECONDS | |
--- | |
> exports.ProjectInviteSchema = ProjectInviteSchema | |
\ No newline at end of file | |
diff -r web-api-sharelatex-blue/current/app/coffee/router.coffee web-api-sharelatex-green/current/app/coffee/router.coffee | |
41d40 | |
< AnalyticsRouter = require('./Features/Analytics/AnalyticsRouter') | |
72,73c71 | |
< AnalyticsRouter.apply(webRouter, apiRouter) | |
< | |
--- | |
> | |
110,111d107 | |
< webRouter.post '/project/:Project_id/compile/stop', AuthorizationMiddlewear.ensureUserCanReadProject, CompileController.stopCompile | |
< | |
134,144d129 | |
< # direct url access to output files for user but no build, to retrieve files when build fails | |
< webRouter.get /^\/project\/([^\/]*)\/user\/([0-9a-f-]+)\/output\/(.*)$/, | |
< ((req, res, next) -> | |
< params = | |
< "Project_id": req.params[0] | |
< "user_id": req.params[1] | |
< "file": req.params[2] | |
< req.params = params | |
< next() | |
< ), AuthorizationMiddlewear.ensureUserCanReadProject, CompileController.getFileFromClsi | |
< | |
247,248d231 | |
< webRouter.get '/dev/csrf', (req, res) -> | |
< res.send res.locals.csrfToken | |
285c268 | |
< webRouter.get '*', ErrorController.notFound | |
--- | |
> webRouter.get '*', ErrorController.notFound | |
\ No newline at end of file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment