From ab6322ef93cfbb3d518e1f5a157d8e97f94428d1 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Wed, 14 Apr 2021 21:17:36 +0200 Subject: new [commands]: added fix_article_entry_id command. --- instance/sqlite.py | 13 ------------- newspipe/commands.py | 13 +++++++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/instance/sqlite.py b/instance/sqlite.py index 0fec8f3d..43cdc2af 100644 --- a/instance/sqlite.py +++ b/instance/sqlite.py @@ -19,19 +19,6 @@ SQLALCHEMY_DATABASE_URI = "sqlite:///newspipe.db" # Security CONTENT_SECURITY_POLICY = { - 'default-src': '\'self\'', - 'img-src': '*', - 'media-src': [ - 'youtube.com', - ], - 'script-src': [ - '\'self\'', - '\'unsafe-inline\'', - ], - 'style-src': [ - '\'self\'', - '\'unsafe-inline\'', - ] } # Crawler diff --git a/newspipe/commands.py b/newspipe/commands.py index a12f92ce..06b7dda9 100755 --- a/newspipe/commands.py +++ b/newspipe/commands.py @@ -116,6 +116,19 @@ def delete_read_articles(): print("Read articles deleted.") +@application.cli.command("fix_article_entry_id") +def fix_article_entry_id(): + filter = {} + filter["entry_id"] = None + articles = ArticleController().read(**filter).limit(50) + for article in articles: + try: + article.entry_id = str(article.id) + db.session.commit() + except: + db.session.rollback() + + @application.cli.command("fetch_asyncio") @click.option('--user-id', default=None, help='Id of the user') @click.option('--feed-id', default=None, help='If of the feed') -- cgit