diff --git a/services/web/app/src/Features/Institutions/InstitutionsController.js b/services/web/app/src/Features/Institutions/InstitutionsController.js deleted file mode 100644 index 048ee2a44d..0000000000 --- a/services/web/app/src/Features/Institutions/InstitutionsController.js +++ /dev/null @@ -1,13 +0,0 @@ -const InstitutionsManager = require('./InstitutionsManager') - -module.exports = { - confirmDomain(req, res, next) { - const { hostname } = req.body - InstitutionsManager.confirmDomain(hostname, function (error) { - if (error) { - return next(error) - } - res.sendStatus(200) - }) - }, -} diff --git a/services/web/app/src/Features/Institutions/InstitutionsManager.js b/services/web/app/src/Features/Institutions/InstitutionsManager.js index 116837c7d8..f458121296 100644 --- a/services/web/app/src/Features/Institutions/InstitutionsManager.js +++ b/services/web/app/src/Features/Institutions/InstitutionsManager.js @@ -15,7 +15,6 @@ const NotificationsHandler = require('../Notifications/NotificationsHandler') const SubscriptionLocator = require('../Subscription/SubscriptionLocator') const { Institution } = require('../../models/Institution') const { Subscription } = require('../../models/Subscription') -const Queues = require('../../infrastructure/Queues') const OError = require('@overleaf/o-error') const ASYNC_LIMIT = parseInt(process.env.ASYNC_LIMIT, 10) || 5 @@ -255,14 +254,6 @@ const InstitutionsManager = { ) }, - /** - * Enqueue a job for adding affiliations for when a domain is confirmed - */ - async confirmDomain(hostname) { - const queue = Queues.getQueue('confirm-institution-domain') - await queue.add({ hostname }) - }, - async fetchV1Data(institution) { const url = `${Settings.apis.v1.url}/universities/list/${institution.v1Id}` try { diff --git a/services/web/app/src/router.js b/services/web/app/src/router.js index 560c1b48c4..650175403d 100644 --- a/services/web/app/src/router.js +++ b/services/web/app/src/router.js @@ -56,7 +56,6 @@ const TokenAccessRouter = require('./Features/TokenAccess/TokenAccessRouter') const Features = require('./infrastructure/Features') const LinkedFilesRouter = require('./Features/LinkedFiles/LinkedFilesRouter') const TemplatesRouter = require('./Features/Templates/TemplatesRouter') -const InstitutionsController = require('./Features/Institutions/InstitutionsController') const UserMembershipRouter = require('./Features/UserMembership/UserMembershipRouter') const SystemMessageController = require('./Features/SystemMessages/SystemMessageController') const AnalyticsRegistrationSourceMiddleware = require('./Features/Analytics/AnalyticsRegistrationSourceMiddleware') @@ -1152,34 +1151,6 @@ function initialize(webRouter, privateApiRouter, publicApiRouter) { BetaProgramController.optOut ) - // New "api" endpoints. Started as a way for v1 to call over to v2 (for - // long-term features, as opposed to the nominally temporary ones in the - // overleaf-integration module), but may expand beyond that role. - publicApiRouter.post( - '/api/clsi/compile/:submission_id', - AuthenticationController.requirePrivateApiAuth(), - CompileController.compileSubmission - ) - publicApiRouter.get( - /^\/api\/clsi\/compile\/([^/]*)\/build\/([0-9a-f-]+)\/output\/(.*)$/, - function (req, res, next) { - const params = { - submission_id: req.params[0], - build_id: req.params[1], - file: req.params[2], - } - req.params = params - next() - }, - AuthenticationController.requirePrivateApiAuth(), - CompileController.getFileFromClsiWithoutUser - ) - publicApiRouter.post( - '/api/institutions/confirm_university_domain', - AuthenticationController.requirePrivateApiAuth(), - InstitutionsController.confirmDomain - ) - webRouter.get('/chrome', function (req, res, next) { // Match v1 behaviour - this is used for a Chrome web app if (SessionManager.isUserLoggedIn(req.session)) { diff --git a/services/web/test/acceptance/src/ApiClsiTests.js b/services/web/test/acceptance/src/ApiClsiTests.js deleted file mode 100644 index d6581c6fb2..0000000000 --- a/services/web/test/acceptance/src/ApiClsiTests.js +++ /dev/null @@ -1,156 +0,0 @@ -/* eslint-disable - max-len, - no-unused-vars, - n/no-deprecated-api, -*/ -// TODO: This file was created by bulk-decaffeinate. -// Fix any style issues and re-enable lint. -/* - * decaffeinate suggestions: - * DS102: Remove unnecessary code created because of implicit returns - * DS207: Consider shorter variations of null checks - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md - */ -const { expect } = require('chai') -const request = require('./helpers/request') -const Settings = require('@overleaf/settings') - -const auth = Buffer.from('overleaf:password').toString('base64') -const authedRequest = request.defaults({ - headers: { - Authorization: `Basic ${auth}`, - }, -}) - -describe('ApiClsiTests', function () { - describe('compile', function () { - beforeEach(function (done) { - this.compileSpec = { - compile: { - options: { - compiler: 'pdflatex', - timeout: 60, - }, - rootResourcePath: 'main.tex', - resources: [ - { - path: 'main/tex', - content: - '\\documentclass{article}\n\\begin{document}\nHello World\n\\end{document}', - }, - { - path: 'image.png', - url: 'www.example.com/image.png', - modified: 123456789, - }, - ], - }, - } - return done() - }) - - describe('valid request', function () { - it('returns success and a list of output files', function (done) { - return authedRequest.post( - { - uri: '/api/clsi/compile/abcd', - json: this.compileSpec, - }, - (error, response, body) => { - if (error != null) { - throw error - } - expect(response.statusCode).to.equal(200) - expect(response.body).to.deep.equal({ - status: 'success', - outputFiles: [ - { - path: 'project.pdf', - url: '/project/abcd/build/1234/output/project.pdf', - type: 'pdf', - build: 1234, - }, - { - path: 'project.log', - url: '/project/abcd/build/1234/output/project.log', - type: 'log', - build: 1234, - }, - ], - }) - return done() - } - ) - }) - }) - - describe('unauthorized', function () { - it('returns 401', function (done) { - return request.post( - { - uri: '/api/clsi/compile/abcd', - json: this.compileSpec, - }, - (error, response, body) => { - if (error != null) { - throw error - } - expect(response.statusCode).to.equal(401) - expect(response.body).to.equal('Unauthorized') - return done() - } - ) - }) - }) - }) - - describe('get output', function () { - describe('valid file', function () { - it('returns the file', function (done) { - return authedRequest.get( - '/api/clsi/compile/abcd/build/1234/output/project.pdf', - (error, response, body) => { - if (error != null) { - throw error - } - expect(response.statusCode).to.equal(200) - expect(response.body).to.equal('mock-pdf') - return done() - } - ) - }) - }) - - describe('invalid file', function () { - it('returns 404', function (done) { - return authedRequest.get( - '/api/clsi/compile/abcd/build/1234/output/project.aux', - (error, response, body) => { - if (error != null) { - throw error - } - expect(response.statusCode).to.equal(404) - expect(response.body).to.not.equal('mock-pdf') - return done() - } - ) - }) - }) - - describe('unauthorized', function () { - it('returns 401', function (done) { - return request.get( - '/api/clsi/compile/abcd/build/1234/output/project.pdf', - (error, response, body) => { - if (error != null) { - throw error - } - expect(response.statusCode).to.equal(401) - expect(response.body).to.not.equal('mock-pdf') - return done() - } - ) - }) - }) - }) -})