mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-15 13:27:02 +00:00
Add in enabledLinkedFileTypes setting
This commit is contained in:
parent
a99f55891f
commit
d4025908b7
5 changed files with 13 additions and 1 deletions
|
@ -1,5 +1,7 @@
|
|||
AuthenticationController = require '../Authentication/AuthenticationController'
|
||||
EditorController = require '../Editor/EditorController'
|
||||
Settings = require 'settings-sharelatex'
|
||||
logger = require 'logger-sharelatex'
|
||||
|
||||
module.exports = LinkedFilesController = {
|
||||
Agents: {
|
||||
|
@ -10,9 +12,12 @@ module.exports = LinkedFilesController = {
|
|||
{project_id} = req.params
|
||||
{name, provider, data, parent_folder_id} = req.body
|
||||
user_id = AuthenticationController.getLoggedInUserId(req)
|
||||
logger.log {project_id, name, provider, data, parent_folder_id, user_id}, 'create linked file request'
|
||||
|
||||
if !LinkedFilesController.Agents.hasOwnProperty(provider)
|
||||
return res.send(400)
|
||||
unless provider in Settings.enabledLinkedFileTypes
|
||||
return res.send(400)
|
||||
Agent = LinkedFilesController.Agents[provider]
|
||||
|
||||
linkedFileData = Agent.sanitizeData(data)
|
||||
|
|
|
@ -106,7 +106,7 @@ block requirejs
|
|||
//- We need to do .replace(/\//g, '\\/') do that '</script>' -> '<\/script>'
|
||||
//- and doesn't prematurely end the script tag.
|
||||
script#data(type="application/json").
|
||||
!{JSON.stringify({userSettings: userSettings, user: user, trackChangesState: trackChangesState, useV2History: useV2History}).replace(/\//g, '\\/')}
|
||||
!{JSON.stringify({userSettings: userSettings, user: user, trackChangesState: trackChangesState, useV2History: useV2History, enabledLinkedFileTypes: settings.enabledLinkedFileTypes}).replace(/\//g, '\\/')}
|
||||
|
||||
script(type="text/javascript").
|
||||
window.data = JSON.parse($("#data").text());
|
||||
|
@ -115,6 +115,7 @@ block requirejs
|
|||
var data = JSON.parse($("#data").text());
|
||||
window.userSettings = data.userSettings;
|
||||
window.user = data.user;
|
||||
window.enabledLinkedFiles = data.enabledLinkedFiles;
|
||||
window.csrfToken = "!{csrfToken}";
|
||||
window.anonymous = #{anonymous};
|
||||
window.anonymousAccessToken = "#{anonymousAccessToken}";
|
||||
|
|
|
@ -216,6 +216,8 @@ module.exports = settings =
|
|||
|
||||
enableSubscriptions:false
|
||||
|
||||
enabledLinkedFileTypes: (process.env['ENABLED_LINKED_FILE_TYPES'] or '').split(',')
|
||||
|
||||
# i18n
|
||||
# ------
|
||||
#
|
||||
|
|
|
@ -15,6 +15,7 @@ services:
|
|||
MONGO_URL: "mongodb://mongo/sharelatex"
|
||||
SHARELATEX_ALLOW_PUBLIC_ACCESS: 'true'
|
||||
PROJECT_HISTORY_ENABLED: 'true'
|
||||
ENABLED_LINKED_FILE_TYPES: 'url'
|
||||
LINKED_URL_PROXY: 'http://localhost:6543'
|
||||
depends_on:
|
||||
- redis
|
||||
|
|
|
@ -31,6 +31,9 @@ define [
|
|||
)
|
||||
|
||||
$scope.openLinkedFileModal = window.openLinkedFileModal = () ->
|
||||
unless 'url' in window.data.enabledLinkedFileTypes
|
||||
console.warn("Url linked files are not enabled")
|
||||
return
|
||||
$modal.open(
|
||||
templateUrl: "linkedFileModalTemplate"
|
||||
controller: "LinkedFileModalController"
|
||||
|
|
Loading…
Add table
Reference in a new issue