Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syndicate API including currently RSS and ATOM formatter API #1188

Open
wants to merge 63 commits into
base: lockhart
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
5b4e71c
update version for the https://sofab.atlassian.net/browse/SDAN-726
rbi-aap Apr 9, 2024
d2ebb0d
update for fix building error
rbi-aap Apr 9, 2024
beae01e
update for building error
rbi-aap Apr 9, 2024
d9f036c
update for review
rbi-aap Apr 9, 2024
c3217fe
update from review feedback regarding naming convention from audioIf …
rbi-aap Apr 11, 2024
b19a074
update for review
rbi-aap Apr 11, 2024
6433e61
remove space
rbi-aap Apr 11, 2024
41fcac4
remove space line
rbi-aap Apr 11, 2024
72f4876
Merge branch 'superdesk:lockhart' into lockhart
rbi-aap May 31, 2024
5f58d87
syndicate API. including RSS and ATOM formatter
rbi-aap May 31, 2024
43eb8c0
update style
rbi-aap May 31, 2024
cf5bcfa
split the 125 long line
rbi-aap Jun 3, 2024
391cf09
keep same name
rbi-aap Jun 3, 2024
a968773
update for review and feedback
rbi-aap Jun 7, 2024
9fa50f7
update for line long issues
rbi-aap Jun 7, 2024
f341ed5
for line long
rbi-aap Jun 7, 2024
165cc8a
for orderdict error in test
rbi-aap Jun 7, 2024
73a0b14
for behave test
rbi-aap Jun 7, 2024
fcf0f01
update
rbi-aap Jun 7, 2024
6a36641
add regular expression in route for avoid conflicts with old API
rbi-aap Jun 11, 2024
87c3098
update for the review
rbi-aap Jul 15, 2024
c3be21b
update for review
rbi-aap Jul 17, 2024
b826fb4
update for review
rbi-aap Jul 17, 2024
520fb03
for block-content SDAN-728 and SDAN-731
rbi-aap Jul 26, 2024
31a2437
for sync
rbi-aap Jul 26, 2024
dca96c4
replace await with promise
rbi-aap Jul 26, 2024
e5e4d15
for review
rbi-aap Jul 26, 2024
bc4ca05
for style
rbi-aap Jul 26, 2024
6d1803d
update after unit test for review
rbi-aap Aug 2, 2024
5ae6bd9
update for flake8
rbi-aap Aug 2, 2024
996dfe6
update for review
rbi-aap Aug 2, 2024
5fad329
for unit test
rbi-aap Aug 2, 2024
8bc3bc9
for test only
rbi-aap Aug 2, 2024
a46d813
temp turn off test_bookmarks test not relavant to content block
rbi-aap Aug 2, 2024
7200041
test
rbi-aap Aug 2, 2024
706d14d
test
rbi-aap Aug 6, 2024
750035a
for mock get_user in test
rbi-aap Aug 6, 2024
724c74c
for front end
rbi-aap Aug 30, 2024
d326f8d
ArticleBodyHTML.jsx -add XSS attach prevent and video player improvement
rbi-aap Aug 30, 2024
abe2ad0
update incorrect icon
rbi-aap Aug 30, 2024
4ccdc0b
update for env
rbi-aap Sep 2, 2024
68bd3d2
update
rbi-aap Sep 2, 2024
67a48d6
for env update
rbi-aap Sep 2, 2024
980c47e
for env change
rbi-aap Sep 2, 2024
b847be9
update env
rbi-aap Sep 2, 2024
565b8de
update
rbi-aap Sep 2, 2024
ef16577
update
rbi-aap Sep 2, 2024
f2e546b
update
rbi-aap Sep 2, 2024
141d3e9
update for old failed test
rbi-aap Sep 3, 2024
ae47ffc
update for a test
rbi-aap Sep 3, 2024
5bcacde
update for check
rbi-aap Sep 3, 2024
3ec72ba
change user type
rbi-aap Sep 3, 2024
80a288a
update for feature test
rbi-aap Sep 3, 2024
7204aee
block_media
rbi-aap Sep 3, 2024
49c403f
update for unit_test block_media
rbi-aap Sep 3, 2024
aaa1e17
update a few features near to release
rbi-aap Sep 3, 2024
a1d2243
lint check for indent
rbi-aap Sep 3, 2024
8d7a608
Enhanced video loading and poster management, updated Webpack and pac…
rbi-aap Sep 10, 2024
f1ee3c5
for update the ESLint for webpack and React
rbi-aap Sep 10, 2024
bb82ebe
for images.js to manage images in Webpack
rbi-aap Sep 10, 2024
1019cb7
for review update
rbi-aap Sep 13, 2024
61e88d5
remove memory monitoring function in live repo
rbi-aap Sep 16, 2024
7dc8049
check the reason
rbi-aap Sep 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 8 additions & 16 deletions assets/ui/components/ArticleBodyHtml.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,20 @@ import {formatHTML} from 'utils';
import {connect} from 'react-redux';
import {selectCopy} from '../../wire/actions';
import DOMPurify from 'dompurify';
// import fallbackDefault from 'images/poster_default.jpg'
const fallbackDefault = '/static/poster_default.jpg';

class ArticleBodyHtml extends React.PureComponent {
constructor(props) {
super(props);
this.state = {
sanitizedHtml: '',
memoryUsage: null
};
this.copyClicked = this.copyClicked.bind(this);
this.clickClicked = this.clickClicked.bind(this);
this.preventContextMenu = this.preventContextMenu.bind(this);
this.getBodyHTML = memoize(this._getBodyHTML.bind(this));
this.bodyRef = React.createRef();
this.players = new Map();
this.memoryInterval = null;
}

componentDidMount() {
Expand Down Expand Up @@ -53,9 +50,9 @@ class ArticleBodyHtml extends React.PureComponent {
this.players.forEach(player => player.destroy());
this.players.clear();

if (this.memoryInterval) {
clearInterval(this.memoryInterval);
}
// if (this.memoryInterval) {
MarkLark86 marked this conversation as resolved.
Show resolved Hide resolved
// clearInterval(this.memoryInterval);
// }
}

startMemoryUsageTracking() {
Expand Down Expand Up @@ -232,8 +229,6 @@ class ArticleBodyHtml extends React.PureComponent {
return;
}
const loadHandler = () => {
// eslint-disable-next-line no-console
console.log('Initial dimensions:', player.media.videoWidth, player.media.videoHeight);
const checkVideoContent = () => {
if (player.media.videoWidth > 0 && player.media.videoHeight > 0) {
const canvas = document.createElement('canvas');
Expand All @@ -245,12 +240,10 @@ class ArticleBodyHtml extends React.PureComponent {
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
const data = imageData.data;
// loop for none blank pixel
let stepSize = 4; // Adjust the step size as needed
let stepSize = 8; // Adjust the step size
for (let i = 0; i < data.length; i += stepSize * 4) {
if (data[i] > 0 || data[i + 1] > 0 || data[i + 2] > 0) {

// eslint-disable-next-line no-console
console.log('Pixel content detected, poster not needed');
console.warn('Pixel content detected, poster not needed');
return true;
}
}
Expand All @@ -261,15 +254,14 @@ class ArticleBodyHtml extends React.PureComponent {
const attemptContentCheck = () => {
if (checkVideoContent()) {
player.poster = null;
// eslint-disable-next-line no-console
console.log('Pixel content detected, poster removed');
console.warn('Pixel content detected, poster removed');
return true;
}
return false;
};

let attemptCount = 0;
const maxAttempts = 2;
const maxAttempts = 1;
const checkInterval = setInterval(() => {
if (attemptContentCheck() || attemptCount >= maxAttempts) {
clearInterval(checkInterval);
Expand All @@ -285,7 +277,7 @@ class ArticleBodyHtml extends React.PureComponent {
};

player.on('error', (error) => {
console.error('Error details:', {
console.error('Error details and location:', {
message: error.message,
code: error.code,
type: error.type,
Expand Down
2 changes: 1 addition & 1 deletion newsroom/companies/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def update_company(data, _id):
@account_manager_only
def save_company_permissions(_id):
csrf_token = request.headers.get('X-CSRF-Token')
expected_csrf_token = session.get('csrf_token')
expected_csrf_token = session.pop('csrf_token')
orig = get_entity_or_404(_id, 'companies')
data = get_json_or_400()
if not csrf_token or csrf_token != expected_csrf_token:
Expand Down
17 changes: 17 additions & 0 deletions newsroom/wire/block_media/download_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,24 @@


def filter_items_download(func):
"""
A decorator that filters downloaded items based on a given filter function.

:param func: The function to be decorated. It should take _ids and item_type as parameters
and return a list of items.
:return: A wrapper function that adds filtering capability to the decorated function.
"""
def wrapper(_ids, item_type, filter_func=None):
"""
Wrapper function that calls the decorated function and applies optional filtering.

:param _ids: List of IDs to download items for.
:param item_type: Type of items to download .
:param filter_func: Optional function to filter the downloaded items.
default is None, no filtering is applied.
:return: A list of downloaded items, potentially filtered if a filter_func is provided
and the item_type is not 'agenda'.
"""
items = func(_ids, item_type)
if filter_func and items and (item_type != 'agenda'):
items = filter_func(items)
Expand Down
29 changes: 0 additions & 29 deletions newsroom/wire/block_media/permission_media.py

This file was deleted.

4 changes: 2 additions & 2 deletions newsroom/wire/search.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
from datetime import datetime, timedelta
from copy import deepcopy
from eve.utils import ParsedRequest, config
Expand All @@ -18,9 +19,8 @@
from newsroom.companies import get_user_company
from newsroom.products.products import get_products_by_company
from newsroom.wire.block_media.filter_media import filter_media
from superdesk.logging import logger

# logger = logging.getLogger(__name__)
logger = logging.getLogger(__name__)


def get_bookmarks_count(user_id, product_type):
Expand Down
Loading