Skip to content

Commit

Permalink
~ fixed an issue where XSS protection would break rendering on mobile…
Browse files Browse the repository at this point in the history
…(References #73, References #70)
  • Loading branch information
joethei committed Jan 16, 2022
1 parent 2dcb0f2 commit 157c331
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "rss-reader",
"name": "RSS Reader",
"version": "1.0.4",
"version": "1.0.5",
"minAppVersion": "0.12.17",
"description": "Read RSS Feeds from within obsidian",
"author": "Johannes Theiner",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rss-reader",
"version": "1.0.4",
"version": "1.0.5",
"description": "Read RSS Feeds from inside obsidian",
"main": "main.js",
"scripts": {
Expand Down
15 changes: 11 additions & 4 deletions src/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,18 @@ export function rssToMd(plugin: RssReaderPlugin, content: string): string {
}

//wrap all codeblocks where there is a processor registered.
//as codeblockProcessors is not exposed publicly(and seems to be only existent after v.13) do a check first
//@ts-ignore
const codeblockProcessors: string[] = Object.keys(MarkdownPreviewRenderer.codeBlockPostProcessors);
for (const codeblockProcessor of codeblockProcessors) {
const regex = RegExp("^```" + codeblockProcessor +"\[\\s\\S\]+```$", "gm");
markdown = markdown.replace(regex, "<pre>$&</pre>");
if(MarkdownPreviewRenderer.codeBlockPostProcessors) {
//@ts-ignore
const codeblockProcessors: string[] = Object.keys(MarkdownPreviewRenderer.codeBlockPostProcessors);
for (const codeblockProcessor of codeblockProcessors) {
const regex = RegExp("^```" + codeblockProcessor +"\[\\s\\S\]*?```$", "gm");
markdown = markdown.replace(regex, "<pre>$&</pre>");
}
}else {
//just remove all codeblocks instead
markdown = markdown.replace(/^```.*\n([\s\S]*?)```$/gm, "<pre>$&</pre>");
}

return markdown;
Expand Down
4 changes: 3 additions & 1 deletion src/l10n/locales/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,5 +193,7 @@ export default {

filter_folder_ignore_help: "diese Ordner ignorieren",
filter_feed_ignore_help: "diese Feeds ignorieren",
filter_tags_ignore_help: "diese Tags ignorieren"
filter_tags_ignore_help: "diese Tags ignorieren",

loading: "Lädt"
}
4 changes: 3 additions & 1 deletion src/l10n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,5 +192,7 @@ export default {

filter_folder_ignore_help: "ignore the following folders",
filter_feed_ignore_help: "ignore the following feeds",
filter_tags_ignore_help: "ignore the following tags"
filter_tags_ignore_help: "ignore the following tags",

loading: "Loading"
}
4 changes: 3 additions & 1 deletion src/l10n/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,5 +192,7 @@ export default {

filter_folder_ignore_help: "忽略以下分类",
filter_feed_ignore_help: "忽略以下订阅源",
filter_tags_ignore_help: "忽略以下标签"
filter_tags_ignore_help: "忽略以下标签",

loading: "正在加载"
}
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ export default class RssReaderPlugin extends Plugin {
}

async updateFeeds(): Promise<void> {
console.log("updating feeds");
interface IStringTMap<T> {
[key: string]: T;
}
Expand Down
4 changes: 2 additions & 2 deletions src/view/FolderView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
<TopRowButtons plugin={plugin}/>

{#if !folded}
<p>Loading</p>
<h1>{ t('loading') }</h1>
{:else}
<div class="rss-view">
{#if $filteredItemsStore}
Expand Down Expand Up @@ -182,7 +182,7 @@
{/if}

{#if !$sortedFeedsStore}
<h1>No feeds configured</h1>
<h1>{ t('loading') }</h1>
{/if}

{#if $sortedFeedsStore}
Expand Down
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
"1.0.1": "0.12.17",
"1.0.2": "0.12.17",
"1.0.3": "0.12.17",
"1.0.4": "0.12.17"
"1.0.4": "0.12.17",
"1.0.5": "0.12.17"
}

0 comments on commit 157c331

Please sign in to comment.