Socket
Socket
Sign inDemoInstall

liveblog-client

Package Overview
Dependencies
28
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.6.0 to 3.6.7

app/favicon-alert.ico

26

.eslintrc.js

@@ -1,1 +0,25 @@

module.exports = require('superdesk-code-style');
const superdeskRules = require('superdesk-code-style');
module.exports = Object.assign({}, superdeskRules, {
'overrides': [
{
files: ['*.ts', '*.tsx'],
plugins: [
'@typescript-eslint/tslint',
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json'
},
rules: {
'@typescript-eslint/tslint/config': [2, {
lintFile: './tslint.json',
}],
'arrow-body-style': 0,
'react/prop-types': 0,
'object-curly-spacing': [2, 'always'],
'no-empty-function': [2, { 'allow': ['arrowFunctions'] }]
}
}
]
});

12

app/scripts/index.js

@@ -6,3 +6,2 @@ import 'lb-bootstrap.scss';

import 'jquery-gridster';
// import 'moment-timezone';
import 'bootstrap';

@@ -35,6 +34,2 @@ import 'angular';

// This is an ugly little hack required by the venerable superdesk.editor to work
import MediumEditor from 'medium-editor';
window.MediumEditor = MediumEditor;
import 'superdesk-core/scripts/core/activity';

@@ -51,5 +46,3 @@ import 'superdesk-core/scripts/core/analytics';

import 'superdesk-core/scripts/core/directives';
import 'superdesk-core/scripts/core/editor2';
import 'superdesk-core/scripts/core/spellcheck';
import 'superdesk-core/scripts/core/editor3';
import 'superdesk-core/scripts/core/features';

@@ -72,4 +65,2 @@ import 'superdesk-core/scripts/core/list';

import 'superdesk-core/scripts/apps/users';
// import 'superdesk-core/scripts/apps/groups';
// import 'superdesk-core/scripts/apps/products';
import 'superdesk-core/scripts/apps/publish';

@@ -156,4 +147,2 @@ import 'superdesk-core/scripts/apps/templates';

'superdesk.apps.desks',
// 'superdesk.apps.groups',
// 'superdesk.apps.products',
'superdesk.apps.authoring',

@@ -168,3 +157,2 @@ 'superdesk.apps.packaging',

'superdesk.apps.vocabularies',
// 'superdesk.apps.searchProviders',
'superdesk.apps.stream',

@@ -171,0 +159,0 @@ 'superdesk.apps.publish', // Can't remove

@@ -16,2 +16,2 @@ import adManagTemplate from 'scripts/liveblog-advertising/views/main.ng1';

});
}
}

@@ -22,2 +22,2 @@ export default function adsUtil() {

}
}
}

@@ -27,3 +27,2 @@ import adsLocalTpl from 'scripts/liveblog-edit/views/ads-local.ng1';

$scope.freetypesData = {}; $scope.freetypeControl = {}; $scope.validation = {};

@@ -30,0 +29,0 @@ $scope.adTypes = [

@@ -7,2 +7,2 @@ import './styles/advertising.scss';

.config(activities)
.service('adsUtilSevice', adsUtil);
.service('adsUtilSevice', adsUtil);

@@ -153,3 +153,3 @@ BlogListController.$inject = [

const changedBlog = {
blog_status: activeState.name == 'active' ? 'closed' : 'open',
blog_status: activeState.name === 'active' ? 'closed' : 'open',
};

@@ -170,3 +170,3 @@

notify.pop();
if (blog.blog_status == 'closed') {
if (blog.blog_status === 'closed') {
notify.info(gettext('Blog(s) moved to archived'));

@@ -457,10 +457,2 @@ } else {

$scope.blogsLoading = false;
// check if redirect after youtube authentication
let blogToRedirect = localStorage.getItem('blogToRedirect');
if (blogToRedirect) {
$scope.edit(blogToRedirect);
localStorage.removeItem('blogToRedirect');
}
});

@@ -467,0 +459,0 @@ }

@@ -129,2 +129,2 @@ lbUserSelectList.$inject = ['api'];

};
}
}

@@ -21,2 +21,3 @@ /**

import './../unread.posts.service';
import './../components/inactivity.modal';

@@ -49,2 +50,3 @@ BlogEditController.$inject = [

'$location',
'InactivityModal',
];

@@ -77,3 +79,4 @@

$rootScope,
$location
$location,
InactivityModal
) {

@@ -193,13 +196,2 @@ var self = this;

function removeEditFlag(postId, flag) {
postsService.removeFlagPost(flag);
findPostAndUpdate(postId, undefined, angular.noop);
}
function cleanUpFlag() {
if ($scope.currentPost && $scope.currentPost.edit_flag) {
removeEditFlag($scope.currentPost._id, $scope.currentPost.edit_flag);
}
}
// ask in a modalbox if the user is sure to want to overwrite editor.

@@ -246,3 +238,5 @@ // call the callback if user say yes or if editor is empty

if (blog.posts_limit != 0 && blog.total_posts >= blog.posts_limit && !(localStorage.getItem('preventDialog'))) {
if (blog.posts_limit !== 0 && blog.total_posts >= blog.posts_limit &&
!(localStorage.getItem('preventDialog'))
) {
modal

@@ -277,66 +271,2 @@ .confirm(gettext(`You will lose the oldest post as posts

/**
* Basically this just receives the data from flag registry with
* the users information attached to it. It also includes the flag TTL
*/
$scope.$on('posts:updateFlag', (event, data) => {
data.flags.forEach((flag, index) => {
findPostAndUpdate(flag.postId, flag, afterPostFlagUpdate);
});
});
$scope.$on('posts:deletedFlag', (event, data) => {
const refreshCallback = () => {
$scope.$apply();
};
const flag = data.update ? data.flag : undefined;
const callback = data.update ? afterPostFlagUpdate : refreshCallback;
findPostAndUpdate(data.flag.postId, flag, callback);
});
function findPostAndUpdate(postId, flag, cb) {
let foundPost;
let placesToLook = [
self.timelineStickyInstance,
self.timelineInstance,
self.commentPostsInstance,
self.contributionsPostsInstance,
self.draftPostsInstance,
];
// let's loop over the possible places to find the post and update it
for (let place of placesToLook) {
// NOTE: temporarily check this. We need to decide if we can modify
// users comments coming from frontend ui/blog
if (!place) continue;
place.pagesManager.updatePostFlag(postId, flag, (post) => {
cb(post, flag);
foundPost = post;
});
if (foundPost) break;
}
}
function afterPostFlagUpdate(post, flag) {
// let's also update post if its being edited
if ($scope.currentPost && $scope.currentPost._id === post._id) {
$scope.currentPost.edit_flag = flag;
}
// to trigger rendering
$scope.$apply();
// let's set the timeout and refresh when expired
postsService.setFlagTimeout(post, () => {
if ($scope.currentPost && post._id === $scope.currentPost._id) {
cleanEditor();
} else {
$scope.$apply();
}
});
}
// remove and clean every items from the editor

@@ -504,2 +434,13 @@ function cleanEditor(actionDisabled) {

},
/**
* Alternative debounced function triggered on editor changes.
* The idea with this is to be able to keep the edit flag alive
* while user keeps active in the editor
*/
debouncedEditorChanges: function() {
if ($scope.currentPost) {
postsService.flagPost($scope.currentPost._id);
}
},
actionStatus: function() {

@@ -729,3 +670,3 @@ if (isPostFreetype()) {

const helpLink = 'https://wiki.sourcefabric.org/x/PABIBg';
const callbackURI = `${config.server.url}/api/video_upload/oauth2callback`;
const callbackURI = `${config.server.url}/video_upload/oauth2callback`;

@@ -768,6 +709,5 @@ // @NOTE: this is ugly. Figure out how to improve this.

}).then((response) => {
// save to later be able to redirect to the place we were
localStorage.setItem('blogToRedirect', $scope.blog._id);
notify.pop();
notify.info(gettext('Saved credentials'));
notify.info(gettext('Saved credentials. Redirecting...'));
// redirect to google verification screen
window.location.replace(response.data);

@@ -793,6 +733,7 @@ });

$scope.actionPending = false;
if (response.data != 'Not Found')
if (response.data !== 'Not Found') {
successCallback(response.data);
else
} else {
errorCallback(response.data);
}
}, handleError);

@@ -874,4 +815,4 @@ },

// initalize the view with the editor panel
var panel = angular.isDefined($routeParams.panel) ? $routeParams.panel : 'editor',
syndId = angular.isDefined($routeParams.syndId) ? $routeParams.syndId : null;
var panel = angular.isDefined($routeParams.panel) ? $routeParams.panel : 'editor';
var syndId = angular.isDefined($routeParams.syndId) ? $routeParams.syndId : null;

@@ -898,2 +839,97 @@ // Here we define an object instead of simple array.

/* -------- let's put all related to edit post flag (if possible) -------- */
function removeEditFlag(postId, flag) {
postsService.removeFlagPost(flag);
findPostAndUpdate(postId, undefined, angular.noop);
}
function cleanUpFlag() {
if ($scope.currentPost && $scope.currentPost.edit_flag) {
removeEditFlag($scope.currentPost._id, $scope.currentPost.edit_flag);
}
}
function findPostAndUpdate(postId, flag, cb) {
let foundPost;
let placesToLook = [
self.timelineStickyInstance,
self.timelineInstance,
self.commentPostsInstance,
self.contributionsPostsInstance,
self.draftPostsInstance,
];
// let's loop over the possible places to find the post and update it
for (let place of placesToLook) {
// NOTE: temporarily check this. We need to decide if we can modify
// users comments coming from frontend ui/blog
if (!place) {
continue;
}
place.pagesManager.updatePostFlag(postId, flag, (post) => {
cb(post, flag);
foundPost = post;
});
if (foundPost) {
break;
}
}
}
const inactivityModal = new InactivityModal({
onKeepWorking: () => {
postsService.flagPost($scope.currentPost._id);
inactivityModal.instance.resetBrowserTab();
},
onSaveAndClose: () => {
$scope.publish();
inactivityModal.instance.resetBrowserTab();
},
onClose: () => {
cleanEditor();
inactivityModal.instance.resetBrowserTab();
},
});
function afterPostFlagUpdate(post, flag) {
// let's also update post if its being edited
if ($scope.currentPost && $scope.currentPost._id === post._id) {
$scope.currentPost.edit_flag = flag;
}
// to trigger rendering
$scope.$apply();
// let's set the timeout and refresh when expired
postsService.setFlagTimeout(post, () => {
if ($scope.currentPost && post._id === $scope.currentPost._id) {
inactivityModal.openModal();
inactivityModal.instance.iconTabAlert();
} else {
$scope.$apply();
}
});
}
// Basically this just receives the data from flag registry with
// the users information attached to it. It also includes the flag TTL
$scope.$on('posts:updateFlag', (event, data) => {
data.flags.forEach((flag, index) => {
findPostAndUpdate(flag.postId, flag, afterPostFlagUpdate);
});
});
$scope.$on('posts:deletedFlag', (event, data) => {
const refreshCallback = () => {
$scope.$apply();
};
const flag = data.update ? data.flag : undefined;
const callback = data.update ? afterPostFlagUpdate : refreshCallback;
findPostAndUpdate(data.flag.postId, flag, callback);
});
// we listen to change route event in order to remove flag when leaving the

@@ -917,2 +953,23 @@ // the editor view. We also make sure to destroy it to avoid multiple listeners

});
const removeFlagOnLeaving = () => {
if ($scope.currentPost && $scope.currentPost.edit_flag) {
const flag = $scope.currentPost.edit_flag;
const url = `${config.server.url}/post_flags/${flag._id}`;
postsService.syncRemoveFlag(url, flag._etag);
}
};
angular.element(window).on('beforeunload', () => {
if ($scope.currentPost) {
return 'Are you sure you want to leave?';
}
});
angular.element(window).on('unload', () => {
removeFlagOnLeaving();
});
/* -------- end of post flagging stuff --------- */
}

@@ -77,3 +77,3 @@ /**

if (vm.newBlog.posts_limit != 0 && count > 0) {
if (vm.newBlog.posts_limit !== 0 && count > 0) {
modal

@@ -92,3 +92,3 @@ .confirm(gettext(`You will lose the oldest posts beyond

if (vm.newBlog.posts_limit != 0 && count > 0) {
if (vm.newBlog.posts_limit !== 0 && count > 0) {
postsService.getPosts(vm.blog._id, {excludeDeleted: true, sticky: false, highlight: false})

@@ -143,2 +143,7 @@ .then((posts) => {

],
canCommentOptions: [
{text: 'Unset', value: 'unset'},
{text: 'Enabled', value: 'enabled'},
{text: 'Disabled', value: 'disabled'},
],
// used as an aux var to be able to change members and safely cancel the changes

@@ -338,2 +343,3 @@ blogMembers: [],

posts_limit: vm.newBlog.posts_limit,
users_can_comment: vm.newBlog.users_can_comment,
};

@@ -516,3 +522,2 @@

// check if form is dirty before leaving the page

@@ -519,0 +524,0 @@ const deregisterPreventer = $scope.$on('$locationChangeStart', routeChange);

@@ -36,3 +36,5 @@ import freetypeImageTpl from 'scripts/liveblog-edit/views/freetype-image.ng1';

const sentinel = $scope.$watch('[image,compulsory]', ([image, compulsory]) => {
if (image.picture_url === undefined && compulsory === undefined) return;
if (image.picture_url === undefined && compulsory === undefined) {
return;
}
const imageValue = (image.picture_url === '' || image.picture_url === undefined);

@@ -39,0 +41,0 @@ const compulsoryValue = (compulsory === '' || compulsory === undefined);

@@ -61,2 +61,1 @@ freetypeRender.$inject = ['$compile', '$rootScope', 'freetypeService'];

}

@@ -20,3 +20,5 @@ import freetypeTextTpl from 'scripts/liveblog-edit/views/freetype-text.ng1';

$scope.$on('$destroy', $scope.$watch('text', (value) => {
if (value === undefined) return;
if (value === undefined) {
return;
}
$scope.numberFlag = (value !== '') && isNaN(value);

@@ -30,3 +32,5 @@ $scope.validation['number__' + $scope._id] = !$scope.numberFlag;

// if initially they're undefined we return and do nothing
if (text === undefined && compulsory === undefined) return;
if (text === undefined && compulsory === undefined) {
return;
}

@@ -33,0 +37,0 @@ $scope.compulsoryFlag = (text === '' && (compulsory === '' || compulsory === undefined));

@@ -83,6 +83,9 @@ import postTpl from 'scripts/liveblog-edit/views/post.ng1';

userify: function(user) {
if (!user) return;
if (!user) {
return;
}
if (user._id === $rootScope.currentUser._id)
if (user._id === $rootScope.currentUser._id) {
return 'You';
}

@@ -136,4 +139,5 @@ return user.display_name;

if (scope.isYoutubeAttached(post))
if (scope.isYoutubeAttached(post)) {
msg += '<br/>This will NOT remove the video from YouTube\'s account.';
}

@@ -140,0 +144,0 @@ scope.clearReorder();

@@ -0,1 +1,2 @@

/* eslint complexity: ["error", 12] */
import postsTpl from 'scripts/liveblog-edit/views/posts.ng1';

@@ -2,0 +3,0 @@

@@ -14,6 +14,5 @@ /**

'use strict';
/**
* Name of the scope variable where the freetype data will be stored.
*/
* Name of the scope variable where the freetype data will be stored.
*/
const SCOPE_FREETYPEDATA = 'freetypeData';

@@ -20,0 +19,0 @@

@@ -21,2 +21,3 @@

import BlogSettingsController from './controllers/blog-settings.js';
import './components/inactivity.modal';

@@ -50,2 +51,3 @@ /**

'liveblog.freetypes',
'liveblog.edit.components.inactivityModal',
])

@@ -215,2 +217,5 @@ .config(['superdeskProvider', function(superdesk) {

})
.filter('varname', () => function(text = '') {
return text.toLowerCase().replace(' ', '_');
})
.factory('instagramService', ['$timeout', function($timeout) {

@@ -217,0 +222,0 @@ const insta = {};

@@ -166,5 +166,9 @@ pagesManagerFactory.$inject = ['postsService', '$q', 'lodash', 'moment', 'instagramService'];

// post updated
} if (post.post_status !== self.status
|| self.status === 'open' && post.sticky !== sticky
|| self.highlight && !post.lb_highlight) {
}
if (post.post_status !== self.status
|| self.status === 'open'
&& post.sticky !== sticky
|| self.highlight && !post.lb_highlight
) {
removePost(post);

@@ -171,0 +175,0 @@ } else {

@@ -344,3 +344,21 @@ /**

function setFlagTimeout(post, cb) {
function syncRemoveFlag(url, etag) {
// NOTE: avoid using Promise as we are triggering this
// when unload & onunload window event. So if we use promises
// browser will kill the thread before the request is triggered
const jq = angular.element;
jq.ajax({
url: url,
method: 'DELETE',
crossDomain: true,
async: false,
headers: {
Authorization: localStorage.getItem('sess:token'),
'If-Match': etag,
},
});
}
function setFlagTimeout(post, callback) {
// perhaps not the best place to put this but I needed this

@@ -366,4 +384,5 @@ // to be accessible from diferent directives. If there is another/better way

post.edit_flag = undefined;
cb();
callback();
// then remove also from backend if user is editing

@@ -383,2 +402,3 @@ if (editFlag.users.indexOf(session.identity) !== -1) {

removeFlagPost: removeFlagPost,
syncRemoveFlag: syncRemoveFlag,
setFlagTimeout: setFlagTimeout,

@@ -385,0 +405,0 @@ saveDraft: function(blogId, post, items, sticky, highlight) {

@@ -206,2 +206,1 @@ import listViewTpl from 'scripts/liveblog-freetypes/views/list.ng1';

export default liveblogFreetypesModule;
import './styles/marketplace.scss';
import './../flux';
import '../flux';

@@ -43,2 +43,1 @@ import marketplaceTpl from 'scripts/liveblog-marketplace/views/marketplace.ng1';

}]);

@@ -82,3 +82,2 @@ import ingestPanelTpl from 'scripts/liveblog-syndication/views/ingest-panel.ng1';

// This watches for incoming posts when ingest is not in focus

@@ -85,0 +84,0 @@ if (scope.ingestQueue.queue.length > 0) {

import './styles/syndication.scss';
import './../flux';
import '../flux';

@@ -4,0 +4,0 @@ // ACTIONS

@@ -100,3 +100,3 @@ import listTpl from 'scripts/liveblog-themes/views/list.ng1';

for (var i = 0; i < themes.length; i++) {
if (themes[i].name != 'angular') {
if (themes[i].name !== 'angular') {
self.themeNames.push({label: themes[i].label, name: themes[i].name});

@@ -152,4 +152,5 @@ }

setNotificationCookie: function(cookieName, cookieValue) {
if (/MSIE \d|Trident.*rv:/.test(navigator.userAgent))
if (/MSIE \d|Trident.*rv:/.test(navigator.userAgent)) {
document.cookie = cookieName + '=' + cookieValue + ';path=/';
}
document.cookie = encodeURIComponent(cookieName + '=') + encodeURIComponent(cookieValue + ';')

@@ -159,4 +160,5 @@ + 'expires=0;path=/';

getNotificationCookie: function(cookieName) {
if (getCookie(cookieName))
if (getCookie(cookieName)) {
return true;
}

@@ -171,6 +173,8 @@ function getCookie(cookieName) {

// tslint:disable-next-line
while (temp.charAt(0) == ' ') {
temp = temp.substring(1);
}
if (temp.indexOf(name) == 0) {
if (temp.indexOf(name) === 0) {
return temp.substring(name.length, temp.length);

@@ -177,0 +181,0 @@ }

import angular from 'angular';
import _ from 'lodash';

@@ -55,2 +56,4 @@ export default angular

params: '=stParams',
debounceOnChange: '=stDebounceChange',
debounceTime: '@stDebounceTime',
},

@@ -64,4 +67,5 @@ link: function(scope, element, attrs) {

// clean older instances if any
if (scope.editor)
if (scope.editor) {
scope.editor.destroy();
}

@@ -98,2 +102,6 @@ scope.editor = new SirTrevor.Editor(opts);

const debouncedChange = _.debounce(scope.debounceOnChange, scope.debounceTime);
element.on('keydown', debouncedChange);
// @TODO: investigate how to better `digest` out of $scope variables.

@@ -100,0 +108,0 @@ // scope.$watchCollection('editor.blocks', function(blocks) {

import RetryHandler from './retry-handler';
class MediaUploader {

@@ -135,5 +134,5 @@ constructor(options) {

onContentUploadSuccess_(e) {
if (e.target.status == 200 || e.target.status == 201) {
if (e.target.status === 200 || e.target.status === 201) {
this.onComplete(e.target.response);
} else if (e.target.status == 308) {
} else if (e.target.status === 308) {
this.extractRange_(e.target);

@@ -196,5 +195,9 @@ this.retryHandler.reset();

if (id) url += id;
if (id) {
url += id;
}
if (query) url += '?' + query;
if (query) {
url += '?' + query;
}

@@ -205,3 +208,2 @@ return url;

export default MediaUploader;
export default MediaUploader;

@@ -48,2 +48,2 @@ class RetryHandler {

export default RetryHandler;
export default RetryHandler;

@@ -57,4 +57,3 @@ import handlePlaceholder from './handle-placeholder';

style: 'display: none',
})
.html(window.gettext('Max. amount of 300 characters is reached')));
}).html(window.gettext('Max. amount of 300 characters is reached')));

@@ -108,3 +107,3 @@ this.$editor.append($('<div>', {

if (typeof this.getOptions().uploader !== 'function') {
throw 'Image block need an `uploader` function in options.';
throw new Error('Image block need an `uploader` function in options.');
}

@@ -111,0 +110,0 @@ // setup the upload button

@@ -16,3 +16,3 @@ /**

import imageBlock from './image-block';
import videoBlock from './video-block';
import videoBlock, {getYoutubeID} from './video-block';
import handlePlaceholder from './handle-placeholder';

@@ -119,2 +119,20 @@ import sanitizeConfig from './sanitizer-config';

/**
* Simple function is intended to escape _ characters from html tag attributes
* before passing the content to SirTrevor.toHTML function. SirTrevors screws up underscores
* and replace them with <i> tags like if it was markdown
*
* This is long time known issue. Check https://dev.sourcefabric.org/browse/LBSD-2353
* and connected issues.
* @param {string} htmlString
*/
function escapeUnderscore(htmlString) {
// SirTrevor won't match this and then it will replace them with _
const tripleBackslashEscape = '\\\_'; // eslint-disable-line
const tagAttrs = /(\S+)\s*=\s*([']|["])([\W\w]*?)\2/gm;
return htmlString
.replace(tagAttrs, (match) => match.replace(/_/g, tripleBackslashEscape));
}
function replaceEmbedWithUrl(string) {

@@ -126,3 +144,3 @@ var m;

if ((m = youtubePattern.exec(string)) !== null) {
return 'https://www.youtube.com/watch?v=' + m[1];
return 'https://www.youtube.com/watch?v=' + getYoutubeID(string);
} else if ((m = facebookPattern.exec(string)) !== null) {

@@ -428,2 +446,3 @@ return decodeURIComponent(m[1]);

});
SirTrevor.Blocks.Quote = SirTrevor.Block.extend({

@@ -536,3 +555,5 @@ type: 'quote',

SirTrevor.Blocks.Text.prototype.loadData = function(data) {
this.getTextBlock().html(SirTrevor.toHTML(data.text, this.type));
let htmlContent = escapeUnderscore(data.text);
this.getTextBlock().html(SirTrevor.toHTML(htmlContent, this.type));
};

@@ -633,3 +654,5 @@

loadData: function(data) {
this.getTextBlock().html(SirTrevor.toHTML(data.text, this.type));
let htmlContent = escapeUnderscore(data.text);
this.getTextBlock().html(SirTrevor.toHTML(htmlContent, this.type));
},

@@ -636,0 +659,0 @@ isEmpty: function() {

import handlePlaceholder from './handle-placeholder';
import MediaUploader from './helpers/media-uploader';
var AddContentBtns = function() {
let AddContentBtns = function() {
this.top = $('.st-block-controls__top');

@@ -23,3 +23,3 @@ this.bottom = $('[data-icon-after="ADD CONTENT HERE"]');

function handleFileSize(size) {
var i = Math.floor(Math.log(size) / Math.log(1024));
let i = Math.floor(Math.log(size) / Math.log(1024));

@@ -30,2 +30,8 @@ return (size / Math.pow(1024, i)).toFixed(2) * 1

export const getYoutubeID = (url) => {
let parsedUrl = url.split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/);
return (parsedUrl[2] !== undefined) ? parsedUrl[2].split(/[^0-9a-z_-]/i)[0] : parsedUrl[0];
};
export default function videoBlock(SirTrevor, config) {

@@ -47,3 +53,3 @@ return SirTrevor.Block.extend({

'<div class="upload-status"></div><br>',
'<div class="remaining_time"></div><br>',
'<div class="remaining-time"></div><br>',
'<div class="during-upload">',

@@ -59,7 +65,7 @@ '<p><span id="percent-transferred">'

onBlockRender: function() {
var self = this;
let self = this;
var addContentBtns = new AddContentBtns();
var isAdmin = self.getOptions().isAdmin();
var uploadBlock = [
let addContentBtns = new AddContentBtns();
let isAdmin = self.getOptions().isAdmin();
let uploadBlock = [
'<div class="row st-block__upload-container">',

@@ -88,6 +94,8 @@ '<div class="col-md-6">',

self.$('.st-block__inputs').append(uploadBlock);
if (!isAdmin) self.$('#updateButton').hide();
if (!isAdmin) {
self.$('#updateButton').hide();
}
self.$('#updateButton').on('click', () => {
var message = 'Are you sure to update the credentials?';
let message = 'Are you sure to update the credentials?';

@@ -98,5 +106,7 @@ self.getOptions().displayModalBox(message);

self.$('#embedlyUploadFile').on('change', function() {
var file = $(this).prop('files')[0];
let file = $(this).prop('files')[0];
if (!file) return false;
if (!file) {
return false;
}

@@ -114,9 +124,37 @@ // Handle one upload at a time

});
const onEditorChange = () => {
const data = this.retrieveData();
const input = data.title + data.credit + data.credit;
if (_.isEmpty(input)) {
this.getOptions().disableSubmit(true);
return false;
}
this.getOptions().disableSubmit(false);
};
let editableFields = self.$editor.next().find('[contenteditable]');
editableFields.on('focus', function(ev) {
const $this = $(this);
$this.data('before', $this.html());
});
editableFields.on('blur keyup paste input', function(ev) {
const $this = $(this);
if ($this.data('before') !== $this.html()) {
$this.data('before', $this.html());
onEditorChange();
}
});
},
uploadFile: function(file) {
var uploadStartTime = 0;
var title = 'liveblog-' + Math.random().toString(36)
let uploadStartTime = 0;
let title = 'liveblog-' + Math.random().toString(36)
.substr(2, 5);
var self = this;
var metadata = {
let self = this;
let metadata = {
snippet: {

@@ -129,3 +167,3 @@ title: title,

status: {
privacyStatus: 'public',
privacyStatus: 'unlisted',
},

@@ -140,6 +178,6 @@ };

onError: function(data) {
var message = data;
let message = data;
try {
var errorResponse = JSON.parse(data);
let errorResponse = JSON.parse(data);

@@ -161,3 +199,3 @@ message = errorResponse.error.message;

$('.remaining_time').text('Time Left: ' + estimatedSecondsRemaining + ' Seconds');
$('.remaining-time').text('Time Left: ' + estimatedSecondsRemaining + ' Seconds');
$('#upload-progress').attr({

@@ -177,3 +215,3 @@ value: bytesUploaded,

onComplete: function(data) {
$('.remaining_time').hide();
$('.remaining-time').hide();
$('.upload-status').text('Video uploaded successfully');

@@ -203,8 +241,2 @@ $('.during-upload').hide();

getYoutubeID: function(url) {
let parsedUrl = url.split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/);
return (parsedUrl[2] !== undefined) ? parsedUrl[2].split(/[^0-9a-z_-]/i)[0] : parsedUrl[0];
},
renderCard: function(data) {

@@ -255,5 +287,5 @@ let cardClass = 'liveblog--card';

onDrop: function(transferData) {
var file = transferData.files[0];
var addContentBtns = new AddContentBtns();
var self = this;
let file = transferData.files[0];
let addContentBtns = new AddContentBtns();
let self = this;

@@ -317,3 +349,3 @@ if (!file) {

html: data.html,
original_id: this.getYoutubeID(data.html),
original_id: getYoutubeID(data.html),
provider_name: 'YoutubeUpload',

@@ -327,3 +359,3 @@ caption: this.$('[name=caption]').text(),

toHTML: function() {
var data = this.retrieveData();
let data = this.retrieveData();

@@ -330,0 +362,0 @@ return this.renderCard(data);

{
"name": "liveblog-client",
"version": "3.6.0",
"version": "3.6.7",
"repository": {

@@ -10,5 +10,7 @@ "type": "git",

"build": "grunt build",
"test": "grunt ci:travis",
"webdriver-update": "webdriver-manager update",
"e2e": "protractor protractor-conf.js"
"eslint": "grunt eslint",
"tslint": "tsc --noEmit && tslint -c tslint.json 'app/**/*.{ts,tsx}'",
"lint": "npm run eslint && npm run tslint",
"webdriver-update": "./node_modules/protractor/bin/webdriver-manager update --gecko false --versions.chrome 77.0.3865.40 --versions.standalone 3.9.1",
"e2e": "./node_modules/.bin/protractor protractor-conf.js"
},

@@ -22,8 +24,8 @@ "licenses": [

"devDependencies": {
"babel-core": "6.26.0",
"babel-loader": "7.1.3",
"babel-plugin-transform-class-properties": "6.24.1",
"babel-plugin-transform-object-rest-spread": "6.26.0",
"babel-preset-es2015": "6.24.1",
"babel-preset-react": "6.24.1",
"@types/angular": "^1.6.54",
"@types/bootstrap": "^3.3.42",
"@types/jquery": "^3.3.29",
"@types/react": "^16.8.18",
"@typescript-eslint/eslint-plugin-tslint": "^1.7.0",
"@typescript-eslint/parser": "^1.7.0",
"bootstrap": "3.3.7",

@@ -33,6 +35,6 @@ "btoa": "1.1.2",

"css-loader": "0.28.7",
"eslint": "4.11.0",
"eslint-loader": "1.9.0",
"eslint": "^5.16.0",
"eslint-plugin-angular": "3.1.1",
"eslint-plugin-react": "^7.5.1",
"fork-ts-checker-webpack-plugin": "^0.5.2",
"grunt": "1.0.1",

@@ -49,3 +51,3 @@ "grunt-angular-gettext": "2.3.6",

"grunt-contrib-watch": "1.0.0",
"grunt-eslint": "20.1.0",
"grunt-eslint": "^21.0.0",
"grunt-filerev": "2.3.1",

@@ -74,10 +76,13 @@ "grunt-jscs": "1.8.0",

"phantomjs": "^2.1.3",
"protractor": "5.2.1",
"protractor-flake": "3.0.1",
"react": "16.2.0",
"react-dom": "16.2.0",
"protractor": "5.4.2",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"request": "^2.79.0",
"sass-loader": "6.0.6",
"style-loader": "0.19.0",
"superdesk-code-style": "^1.0.0",
"superdesk-code-style": "^1.2.0",
"superdesk-ui-framework": "^1.8.14",
"ts-loader": "^3.5.0",
"tslint": "^5.16.0",
"typescript": "^3.4.5",
"webpack": "3.6.0",

@@ -100,2 +105,3 @@ "webpack-dev-server": "2.8.2"

"angular-vs-repeat": "1.1.7",
"eslint-loader": "^2.1.2",
"eventable": "madebymany/eventable",

@@ -121,3 +127,4 @@ "gridster": "0.5.6",

"sir-trevor": "liveblog/sir-trevor-js",
"superdesk-core": "github:eos87/superdesk-client-core#v1.17.0-liveblog"
"superdesk-core": "eos87/superdesk-client-core#v1.17.0-liveblog",
"superdesk-ui-framework": "^1.8.13"
},

@@ -124,0 +131,0 @@ "engines": {

@@ -24,3 +24,3 @@ var waitAndClick = require('./utils').waitAndClick;

/* jshint validthis: true */
browser.wait(() => element(by.css('.modal__dialog')).isDisplayed(), 1000);
browser.wait(() => element(by.css('.modal__dialog:not(.v2)')).isDisplayed(), 1000);
return this;

@@ -27,0 +27,0 @@ }

@@ -12,2 +12,3 @@ module.exports = {

'favicon.ico',
'favicon-alert.ico',
'styles/css/*.css'

@@ -14,0 +15,0 @@ ]

@@ -12,7 +12,9 @@ var path = require('path');

src: [
path.join(root, 'app/scripts/**/*.js'),
path.join(root, 'app/scripts/**/*.jsx')
path.join(root, 'app/**/*.js'),
path.join(root, 'app/**/*.jsx'),
path.join(root, 'app/**/*.ts'),
path.join(root, 'app/**/*.tsx')
],
envs: ['browser', 'amd']
}
},

@@ -19,0 +21,0 @@ // TODO: lint the shit out of the specs

@@ -12,7 +12,10 @@ const webpack = require('webpack');

new webpack.DefinePlugin({
'process.env': {NODE_ENV: JSON.stringify('production')}
'process.env': {NODE_ENV: JSON.stringify('production')},
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
})
)
}
),
},
};
};

@@ -0,4 +1,7 @@

/* eslint-disable */
const path = require('path');
const webpack = require('webpack');
const lodash = require('lodash');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');

@@ -33,6 +36,2 @@ // makeConfig creates a new configuration file based on the passed options.

// isEmbedded will be true when the app is embedded into the main repo as a
// node module.
const isEmbedded = require('fs').existsSync('./node_modules/superdesk-core');
return {

@@ -56,8 +55,11 @@ entry: {

moment: 'moment',
// MediumEditor needs to be globally available, because
// its plugins will not be able to find it otherwise.
MediumEditor: 'medium-editor'
}),
new webpack.DefinePlugin({
__SUPERDESK_CONFIG__: JSON.stringify(sdConfig)
}),
// Using TS transpileOnly mode to speed up things and using this plugin
// for type checking. https://github.com/Realytics/fork-ts-checker-webpack-plugin
new ForkTsCheckerWebpackPlugin({
async: false
})

@@ -88,3 +90,3 @@ ],

},
extensions: ['.js', '.jsx']
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},

@@ -95,9 +97,14 @@

{
test: /\.(ts|tsx|js|jsx)$/,
exclude: shouldExclude,
loader: 'ts-loader',
options: {
transpileOnly: true,
}
},
{
enforce: 'pre',
test: /\.jsx?$/,
test: /\.(ts|tsx|js|jsx)$/,
loader: 'eslint-loader',
// superdesk apps handle their own linter
exclude: (p) => p.indexOf('node_modules') !== -1 || sdConfig.apps && sdConfig.apps.some(
(app) => p.indexOf(app) > -1
),
exclude: /node_modules/,
options: {

@@ -109,12 +116,2 @@ configFile: './.eslintrc.js',

{
test: /\.jsx?$/,
exclude: shouldExclude,
loader: 'babel-loader',
options: {
cacheDirectory: true,
presets: ['es2015', 'react'],
plugins: ['transform-object-rest-spread']
}
},
{
test: /\.html$/,

@@ -121,0 +118,0 @@ use: [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc