mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
Compare commits
38 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42e4575cb7 | ||
|
|
28a4bb403a | ||
|
|
cca3c907db | ||
|
|
1a5b932742 | ||
|
|
a1d3f3008a | ||
|
|
902f2efbd2 | ||
|
|
2e534af146 | ||
|
|
23ca30c3c2 | ||
|
|
517eedad00 | ||
|
|
216ea1fb42 | ||
|
|
640d1a0ce3 | ||
|
|
bba7425b5f | ||
|
|
7a1a49bfb4 | ||
|
|
e451e6698c | ||
|
|
9af3f21404 | ||
|
|
7b14a9c0c2 | ||
|
|
0b65cc9510 | ||
|
|
7879ab9b61 | ||
|
|
e6bebcafb3 | ||
|
|
3b465cebb7 | ||
|
|
aeb211be06 | ||
|
|
ad992aea7b | ||
|
|
d848f72a0b | ||
|
|
0db087908d | ||
|
|
42138d04d6 | ||
|
|
4522a9d0d5 | ||
|
|
7440fcad0e | ||
|
|
fc51c1882f | ||
|
|
e24498b31f | ||
|
|
60fdc79563 | ||
|
|
6729ebc6ea | ||
|
|
c8ff216ce5 | ||
|
|
98c4150cfe | ||
|
|
128332d710 | ||
|
|
eabcb519a4 | ||
|
|
5e14cead3d | ||
|
|
b601f938ff | ||
|
|
4acfda32d0 |
63
.github/workflows/ci.yml
vendored
63
.github/workflows/ci.yml
vendored
@@ -46,20 +46,39 @@ jobs:
|
|||||||
- name: Build with Maven
|
- name: Build with Maven
|
||||||
run: mvn --batch-mode --no-transfer-progress install -Pnative -P${{ matrix.database }} -DskipTests=${{ matrix.os == 'windows-latest' && matrix.database != 'h2' }}
|
run: mvn --batch-mode --no-transfer-progress install -Pnative -P${{ matrix.database }} -DskipTests=${{ matrix.os == 'windows-latest' && matrix.database != 'h2' }}
|
||||||
|
|
||||||
|
# Build pages
|
||||||
|
- name: Copy generated markdown documentation to /documentation
|
||||||
|
run: mkdir documentation && cp ./commafeed-server/target/quarkus-generated-doc/config/commafeed-server.md ./documentation/README.md
|
||||||
|
|
||||||
|
- name: Generate pages
|
||||||
|
uses: wranders/markdown-to-pages-action@8d8a750832932ac785f5424c8c5543aa0b26bb9a # v1
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
out_path: target/pages
|
||||||
|
files: |-
|
||||||
|
README.md
|
||||||
|
documentation/README.md
|
||||||
|
|
||||||
# Upload artifacts
|
# Upload artifacts
|
||||||
- name: Upload cross-platform app
|
- name: Upload cross-platform app
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
|
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4
|
||||||
if: matrix.os == 'ubuntu-latest' # we only need to upload the cross-platform artifact once per database
|
if: matrix.os == 'ubuntu-latest' # we only need to upload the cross-platform artifact once per database
|
||||||
with:
|
with:
|
||||||
name: commafeed-${{ matrix.database }}-jvm
|
name: commafeed-${{ matrix.database }}-jvm
|
||||||
path: commafeed-server/target/commafeed-*.zip
|
path: commafeed-server/target/commafeed-*.zip
|
||||||
|
|
||||||
- name: Upload native executable
|
- name: Upload native executable
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
|
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4
|
||||||
with:
|
with:
|
||||||
name: commafeed-${{ matrix.database }}-${{ runner.os }}-${{ runner.arch }}
|
name: commafeed-${{ matrix.database }}-${{ runner.os }}-${{ runner.arch }}
|
||||||
path: commafeed-server/target/commafeed-*-runner*
|
path: commafeed-server/target/commafeed-*-runner*
|
||||||
|
|
||||||
|
- name: Upload pages
|
||||||
|
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
|
||||||
|
if: matrix.os == 'ubuntu-latest' && matrix.database == 'h2' # we only need to upload the pages once
|
||||||
|
with:
|
||||||
|
path: target/pages
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
needs: build
|
||||||
@@ -118,7 +137,7 @@ jobs:
|
|||||||
|
|
||||||
## build but don't push for PRs and renovate
|
## build but don't push for PRs and renovate
|
||||||
- name: Docker build - native
|
- name: Docker build - native
|
||||||
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6
|
uses: docker/build-push-action@0adf9959216b96bec444f325f1e493d4aa344497 # v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: commafeed-server/src/main/docker/Dockerfile.native
|
file: commafeed-server/src/main/docker/Dockerfile.native
|
||||||
@@ -126,7 +145,7 @@ jobs:
|
|||||||
platforms: linux/amd64,linux/arm64/v8
|
platforms: linux/amd64,linux/arm64/v8
|
||||||
|
|
||||||
- name: Docker build - jvm
|
- name: Docker build - jvm
|
||||||
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6
|
uses: docker/build-push-action@0adf9959216b96bec444f325f1e493d4aa344497 # v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: commafeed-server/src/main/docker/Dockerfile.jvm
|
file: commafeed-server/src/main/docker/Dockerfile.jvm
|
||||||
@@ -135,7 +154,7 @@ jobs:
|
|||||||
|
|
||||||
## build and push tag
|
## build and push tag
|
||||||
- name: Docker build and push tag - native
|
- name: Docker build and push tag - native
|
||||||
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6
|
uses: docker/build-push-action@0adf9959216b96bec444f325f1e493d4aa344497 # v6
|
||||||
if: ${{ github.ref_type == 'tag' }}
|
if: ${{ github.ref_type == 'tag' }}
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
@@ -147,7 +166,7 @@ jobs:
|
|||||||
athou/commafeed:${{ github.ref_name }}-${{ matrix.database }}
|
athou/commafeed:${{ github.ref_name }}-${{ matrix.database }}
|
||||||
|
|
||||||
- name: Docker build and push tag - jvm
|
- name: Docker build and push tag - jvm
|
||||||
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6
|
uses: docker/build-push-action@0adf9959216b96bec444f325f1e493d4aa344497 # v6
|
||||||
if: ${{ github.ref_type == 'tag' }}
|
if: ${{ github.ref_type == 'tag' }}
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
@@ -160,7 +179,7 @@ jobs:
|
|||||||
|
|
||||||
## build and push master
|
## build and push master
|
||||||
- name: Docker build and push master - native
|
- name: Docker build and push master - native
|
||||||
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6
|
uses: docker/build-push-action@0adf9959216b96bec444f325f1e493d4aa344497 # v6
|
||||||
if: ${{ github.ref_name == 'master' }}
|
if: ${{ github.ref_name == 'master' }}
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
@@ -170,7 +189,7 @@ jobs:
|
|||||||
tags: athou/commafeed:master-${{ matrix.database }}
|
tags: athou/commafeed:master-${{ matrix.database }}
|
||||||
|
|
||||||
- name: Docker build and push master - jvm
|
- name: Docker build and push master - jvm
|
||||||
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6
|
uses: docker/build-push-action@0adf9959216b96bec444f325f1e493d4aa344497 # v6
|
||||||
if: ${{ github.ref_name == 'master' }}
|
if: ${{ github.ref_name == 'master' }}
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
@@ -211,12 +230,23 @@ jobs:
|
|||||||
version: ${{ github.ref_name }}
|
version: ${{ github.ref_name }}
|
||||||
|
|
||||||
- name: Create GitHub release
|
- name: Create GitHub release
|
||||||
uses: ncipollo/release-action@cdcc88a9acf3ca41c16c37bb7d21b9ad48560d87 # v1
|
uses: ncipollo/release-action@440c8c1cb0ed28b9f43e4d1d670870f059653174 # v1
|
||||||
with:
|
with:
|
||||||
name: CommaFeed ${{ github.ref_name }}
|
name: CommaFeed ${{ github.ref_name }}
|
||||||
body: ${{ steps.changelog_reader.outputs.changes }}
|
body: ${{ steps.changelog_reader.outputs.changes }}
|
||||||
artifacts: ./artifacts/*
|
artifacts: ./artifacts/*
|
||||||
|
|
||||||
|
|
||||||
|
update-dockerhub-description:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: release
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Update Docker Hub Description
|
- name: Update Docker Hub Description
|
||||||
uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae # v4
|
uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae # v4
|
||||||
with:
|
with:
|
||||||
@@ -225,3 +255,18 @@ jobs:
|
|||||||
repository: athou/commafeed
|
repository: athou/commafeed
|
||||||
short-description: ${{ github.event.repository.description }}
|
short-description: ${{ github.event.repository.description }}
|
||||||
readme-filepath: commafeed-server/src/main/docker/README.md
|
readme-filepath: commafeed-server/src/main/docker/README.md
|
||||||
|
|
||||||
|
|
||||||
|
deploy-pages:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: release
|
||||||
|
permissions:
|
||||||
|
pages: write
|
||||||
|
id-token: write
|
||||||
|
environment:
|
||||||
|
name: github-pages
|
||||||
|
url: ${{ steps.deployment.outputs.page_url }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4
|
||||||
|
id: deployment
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [5.6.1]
|
||||||
|
|
||||||
|
- Restore support for iframes in feed entries (#1688)
|
||||||
|
- There is now a package available for Arch Linux thanks to @dcelasun (#1691)
|
||||||
|
|
||||||
## [5.6.0]
|
## [5.6.0]
|
||||||
|
|
||||||
- To better respect the bandwidth of feed owners, the default value of `commafeed.feed-refresh.interval-empirical` is now true. This means feeds no longer refresh exactly every 5 minutes (the default value of `commafeed.feed-refresh.interval`) but between 5 minutes and 4 hours (the default value of the new `commafeed.feed-refresh.max-interval` setting). The interval is calculated based on feed activity, so highly active feeds refresh more often (#1677)
|
- To better respect the bandwidth of feed owners, the default value of `commafeed.feed-refresh.interval-empirical` is now true. This means feeds no longer refresh exactly every 5 minutes (the default value of `commafeed.feed-refresh.interval`) but between 5 minutes and 4 hours (the default value of the new `commafeed.feed-refresh.max-interval` setting). The interval is calculated based on feed activity, so highly active feeds refresh more often (#1677)
|
||||||
|
|||||||
10
README.md
10
README.md
@@ -48,10 +48,10 @@ system and database of choice.
|
|||||||
|
|
||||||
There are two types of packages:
|
There are two types of packages:
|
||||||
|
|
||||||
- The `linux-x86_64` and `windows-x86_64` packages are compiled natively and contain an executable that can be run
|
- The `linux-x86_64`, `linux-aarch_64` and `windows-x86_64` packages are compiled natively and contain an executable that can be run
|
||||||
directly.
|
directly.
|
||||||
- The `jvm` package is a zip file containing all `.jar` files required to run the application. This package works on all
|
- The `jvm` package is a zip file containing all `.jar` files required to run the application. This package works on all
|
||||||
platforms and is started with `java -jar quarkus-run.jar`.
|
platforms but requires a JRE and is started with `java -jar quarkus-run.jar`.
|
||||||
|
|
||||||
If available for your operating system, the native package is recommended because it has a faster startup time and lower
|
If available for your operating system, the native package is recommended because it has a faster startup time and lower
|
||||||
memory usage.
|
memory usage.
|
||||||
@@ -73,6 +73,10 @@ When the build is complete:
|
|||||||
- if you used the native profile, the executable is located at
|
- if you used the native profile, the executable is located at
|
||||||
`commafeed-server/target/commafeed-<version>-<database>-<platform>-<arch>-runner[.exe]`
|
`commafeed-server/target/commafeed-<version>-<database>-<platform>-<arch>-runner[.exe]`
|
||||||
|
|
||||||
|
### Distribution packages
|
||||||
|
|
||||||
|
- Arch Linux users can use [the CommaFeed package on AUR](https://aur.archlinux.org/pkgbase/commafeed), which builds native binaries with GraalVM for all supported databases.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
CommaFeed doesn't require any configuration to run with its embedded database (H2). The database file will be stored in
|
CommaFeed doesn't require any configuration to run with its embedded database (H2). The database file will be stored in
|
||||||
@@ -100,7 +104,7 @@ There are multiple ways to configure CommaFeed:
|
|||||||
|
|
||||||
The properties file is recommended because CommaFeed will be able to warn about invalid properties and typos.
|
The properties file is recommended because CommaFeed will be able to warn about invalid properties and typos.
|
||||||
|
|
||||||
All [CommaFeed settings](commafeed-server/doc/commafeed.md) are optional and have sensible default values.
|
All [CommaFeed settings](https://athou.github.io/commafeed/documentation) are optional and have sensible default values.
|
||||||
|
|
||||||
When logging in, credentials are stored in an encrypted cookie. The encryption key is randomly generated at startup,
|
When logging in, credentials are stored in an encrypted cookie. The encryption key is randomly generated at startup,
|
||||||
meaning that you will have to log back in after each restart of the application. To prevent this, you can set the
|
meaning that you will have to log back in after each restart of the application. To prevent this, you can set the
|
||||||
|
|||||||
1409
commafeed-client/package-lock.json
generated
1409
commafeed-client/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -17,14 +17,14 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.14.0",
|
"@emotion/react": "^11.14.0",
|
||||||
"@fontsource/open-sans": "^5.1.1",
|
"@fontsource/open-sans": "^5.1.1",
|
||||||
"@mantine/core": "^7.16.3",
|
|
||||||
"@mantine/form": "^7.16.3",
|
|
||||||
"@mantine/hooks": "^7.16.3",
|
|
||||||
"@mantine/modals": "^7.16.3",
|
|
||||||
"@mantine/notifications": "^7.16.3",
|
|
||||||
"@mantine/spotlight": "^7.16.3",
|
|
||||||
"@lingui/core": "^5.2.0",
|
"@lingui/core": "^5.2.0",
|
||||||
"@lingui/react": "^5.2.0",
|
"@lingui/react": "^5.2.0",
|
||||||
|
"@mantine/core": "^7.17.0",
|
||||||
|
"@mantine/form": "^7.17.0",
|
||||||
|
"@mantine/hooks": "^7.17.0",
|
||||||
|
"@mantine/modals": "^7.17.0",
|
||||||
|
"@mantine/notifications": "^7.17.0",
|
||||||
|
"@mantine/spotlight": "^7.17.0",
|
||||||
"@monaco-editor/react": "^4.7.0",
|
"@monaco-editor/react": "^4.7.0",
|
||||||
"@reduxjs/toolkit": "^2.5.1",
|
"@reduxjs/toolkit": "^2.5.1",
|
||||||
"axios": "^1.7.9",
|
"axios": "^1.7.9",
|
||||||
@@ -40,10 +40,10 @@
|
|||||||
"react-dom": "^19.0.0",
|
"react-dom": "^19.0.0",
|
||||||
"react-draggable": "^4.4.6",
|
"react-draggable": "^4.4.6",
|
||||||
"react-ga4": "^2.1.0",
|
"react-ga4": "^2.1.0",
|
||||||
"react-icons": "^5.4.0",
|
"react-icons": "^5.5.0",
|
||||||
"react-infinite-scroller": "^1.2.6",
|
"react-infinite-scroller": "^1.2.6",
|
||||||
"react-redux": "^9.2.0",
|
"react-redux": "^9.2.0",
|
||||||
"react-router-dom": "^7.1.5",
|
"react-router-dom": "^7.2.0",
|
||||||
"react-swipeable": "^7.0.2",
|
"react-swipeable": "^7.0.2",
|
||||||
"redoc": "^2.4.0",
|
"redoc": "^2.4.0",
|
||||||
"style-to-object": "^1.0.8",
|
"style-to-object": "^1.0.8",
|
||||||
@@ -57,9 +57,12 @@
|
|||||||
"@lingui/babel-plugin-lingui-macro": "^5.2.0",
|
"@lingui/babel-plugin-lingui-macro": "^5.2.0",
|
||||||
"@lingui/cli": "^5.2.0",
|
"@lingui/cli": "^5.2.0",
|
||||||
"@lingui/vite-plugin": "^5.2.0",
|
"@lingui/vite-plugin": "^5.2.0",
|
||||||
|
"@testing-library/jest-dom": "^6.6.3",
|
||||||
|
"@testing-library/react": "^16.2.0",
|
||||||
|
"@testing-library/user-event": "^14.6.1",
|
||||||
"@types/mousetrap": "^1.6.15",
|
"@types/mousetrap": "^1.6.15",
|
||||||
"@types/react": "^19.0.8",
|
"@types/react": "^19.0.10",
|
||||||
"@types/react-dom": "^19.0.3",
|
"@types/react-dom": "^19.0.4",
|
||||||
"@types/react-infinite-scroller": "^1.2.5",
|
"@types/react-infinite-scroller": "^1.2.5",
|
||||||
"@types/throttle-debounce": "^5.0.2",
|
"@types/throttle-debounce": "^5.0.2",
|
||||||
"@types/tinycon": "^0.6.7",
|
"@types/tinycon": "^0.6.7",
|
||||||
@@ -68,11 +71,11 @@
|
|||||||
"jsdom": "^26.0.0",
|
"jsdom": "^26.0.0",
|
||||||
"rollup-plugin-visualizer": "^5.14.0",
|
"rollup-plugin-visualizer": "^5.14.0",
|
||||||
"typescript": "^5.7.3",
|
"typescript": "^5.7.3",
|
||||||
"vite": "^6.1.0",
|
"vite": "^6.1.1",
|
||||||
"vite-plugin-checker": "^0.8.0",
|
"vite-plugin-checker": "^0.9.0",
|
||||||
"vite-tsconfig-paths": "^5.1.4",
|
"vite-tsconfig-paths": "^5.1.4",
|
||||||
"vitest": "^3.0.5",
|
"vitest": "^3.0.6",
|
||||||
"vitest-mock-extended": "^2.0.2"
|
"vitest-mock-extended": "^3.0.1"
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"react-infinite-scroller": {
|
"react-infinite-scroller": {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.commafeed</groupId>
|
<groupId>com.commafeed</groupId>
|
||||||
<artifactId>commafeed</artifactId>
|
<artifactId>commafeed</artifactId>
|
||||||
<version>5.6.0</version>
|
<version>5.6.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>commafeed-client</artifactId>
|
<artifactId>commafeed-client</artifactId>
|
||||||
<name>CommaFeed Client</name>
|
<name>CommaFeed Client</name>
|
||||||
|
|||||||
27
commafeed-client/src/components/content/Content.test.tsx
Normal file
27
commafeed-client/src/components/content/Content.test.tsx
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import { MantineProvider } from "@mantine/core"
|
||||||
|
import { render } from "@testing-library/react"
|
||||||
|
import { Content } from "components/content/Content"
|
||||||
|
import React from "react"
|
||||||
|
import { describe, expect, it } from "vitest"
|
||||||
|
|
||||||
|
describe("Content component", () => {
|
||||||
|
it("renders basic content", () => {
|
||||||
|
const { container } = render(<Content content="<p>Hello World</p>" />, { wrapper: MantineProvider })
|
||||||
|
expect(container.querySelector("p")).toHaveTextContent("Hello World")
|
||||||
|
})
|
||||||
|
|
||||||
|
it("renders highlighted text when highlight prop is provided", () => {
|
||||||
|
const { container } = render(<Content content="Hello World" highlight="World" />, { wrapper: MantineProvider })
|
||||||
|
expect(container.querySelector("mark")).toHaveTextContent("World")
|
||||||
|
})
|
||||||
|
|
||||||
|
it("renders iframe tag when included in content", () => {
|
||||||
|
const { container } = render(<Content content='<iframe src="https://example.com"></iframe>' />, { wrapper: MantineProvider })
|
||||||
|
expect(container.querySelector("iframe")).toHaveAttribute("src", "https://example.com")
|
||||||
|
})
|
||||||
|
|
||||||
|
it("does not render unsupported tags", () => {
|
||||||
|
const { container } = render(<Content content='<script>alert("test")</script>' />, { wrapper: MantineProvider })
|
||||||
|
expect(container.querySelector("script")).toBeNull()
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -4,7 +4,7 @@ import { calculatePlaceholderSize } from "app/utils"
|
|||||||
import { ImageWithPlaceholderWhileLoading } from "components/ImageWithPlaceholderWhileLoading"
|
import { ImageWithPlaceholderWhileLoading } from "components/ImageWithPlaceholderWhileLoading"
|
||||||
import { BasicHtmlStyles } from "components/content/BasicHtmlStyles"
|
import { BasicHtmlStyles } from "components/content/BasicHtmlStyles"
|
||||||
import escapeStringRegexp from "escape-string-regexp"
|
import escapeStringRegexp from "escape-string-regexp"
|
||||||
import { type ChildrenNode, Interweave, type MatchResponse, Matcher, type Node, type TransformCallback } from "interweave"
|
import { ALLOWED_TAG_LIST, type ChildrenNode, Interweave, type MatchResponse, Matcher, type Node, type TransformCallback } from "interweave"
|
||||||
import React from "react"
|
import React from "react"
|
||||||
import styleToObject from "style-to-object"
|
import styleToObject from "style-to-object"
|
||||||
import { tss } from "tss"
|
import { tss } from "tss"
|
||||||
@@ -88,6 +88,9 @@ class HighlightMatcher extends Matcher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// allow iframe tag
|
||||||
|
const allowList = [...ALLOWED_TAG_LIST, "iframe"]
|
||||||
|
|
||||||
// memoize component because Interweave is costly
|
// memoize component because Interweave is costly
|
||||||
const Content = React.memo((props: ContentProps) => {
|
const Content = React.memo((props: ContentProps) => {
|
||||||
const { classes } = useStyles()
|
const { classes } = useStyles()
|
||||||
@@ -96,7 +99,7 @@ const Content = React.memo((props: ContentProps) => {
|
|||||||
return (
|
return (
|
||||||
<BasicHtmlStyles>
|
<BasicHtmlStyles>
|
||||||
<Box className={classes.content}>
|
<Box className={classes.content}>
|
||||||
<Interweave content={props.content} transform={transform} matchers={matchers} />
|
<Interweave content={props.content} transform={transform} matchers={matchers} allowList={allowList} />
|
||||||
</Box>
|
</Box>
|
||||||
</BasicHtmlStyles>
|
</BasicHtmlStyles>
|
||||||
)
|
)
|
||||||
|
|||||||
16
commafeed-client/src/setupTests.ts
Normal file
16
commafeed-client/src/setupTests.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import "@testing-library/jest-dom"
|
||||||
|
import { vi } from "vitest"
|
||||||
|
|
||||||
|
Object.defineProperty(window, "matchMedia", {
|
||||||
|
writable: true,
|
||||||
|
value: vi.fn().mockImplementation(query => ({
|
||||||
|
matches: false,
|
||||||
|
media: query,
|
||||||
|
onchange: null,
|
||||||
|
addListener: vi.fn(), // deprecated
|
||||||
|
removeListener: vi.fn(), // deprecated
|
||||||
|
addEventListener: vi.fn(),
|
||||||
|
removeEventListener: vi.fn(),
|
||||||
|
dispatchEvent: vi.fn(),
|
||||||
|
})),
|
||||||
|
})
|
||||||
@@ -52,5 +52,7 @@ export default defineConfig(() => ({
|
|||||||
},
|
},
|
||||||
test: {
|
test: {
|
||||||
environment: "jsdom",
|
environment: "jsdom",
|
||||||
|
globals: true,
|
||||||
|
setupFiles: "./src/setupTests.ts",
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
|
|||||||
@@ -1,894 +0,0 @@
|
|||||||
🔒: Configuration property fixed at build time - All other configuration properties are overridable at runtime
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th align="left">Configuration property</th>
|
|
||||||
<th>Type</th>
|
|
||||||
<th>Default</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.hide-from-web-crawlers`
|
|
||||||
|
|
||||||
Whether to expose a robots.txt file that disallows web crawlers and search engine indexers.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_HIDE_FROM_WEB_CRAWLERS`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
boolean
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`true`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.image-proxy-enabled`
|
|
||||||
|
|
||||||
If enabled, images in feed entries will be proxied through the server instead of accessed directly by the browser.
|
|
||||||
|
|
||||||
This is useful if commafeed is accessed through a restricting proxy that blocks some feeds that are followed.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_IMAGE_PROXY_ENABLED`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
boolean
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`false`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.password-recovery-enabled`
|
|
||||||
|
|
||||||
Enable password recovery via email.
|
|
||||||
|
|
||||||
Quarkus mailer will need to be configured.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_PASSWORD_RECOVERY_ENABLED`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
boolean
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`false`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.announcement`
|
|
||||||
|
|
||||||
Message displayed in a notification at the bottom of the page.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_ANNOUNCEMENT`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
string
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.google-analytics-tracking-code`
|
|
||||||
|
|
||||||
Google Analytics tracking code.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_GOOGLE_ANALYTICS_TRACKING_CODE`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
string
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.google-auth-key`
|
|
||||||
|
|
||||||
Google Auth key for fetching Youtube channel favicons.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_GOOGLE_AUTH_KEY`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
string
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th align="left" colspan="3">
|
|
||||||
HTTP client configuration
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.http-client.user-agent`
|
|
||||||
|
|
||||||
User-Agent string that will be used by the http client, leave empty for the default one.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_HTTP_CLIENT_USER_AGENT`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
string
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.http-client.connect-timeout`
|
|
||||||
|
|
||||||
Time to wait for a connection to be established.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_HTTP_CLIENT_CONNECT_TIMEOUT`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
[Duration](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html) [🛈](#duration-note-anchor)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`5S`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.http-client.ssl-handshake-timeout`
|
|
||||||
|
|
||||||
Time to wait for SSL handshake to complete.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_HTTP_CLIENT_SSL_HANDSHAKE_TIMEOUT`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
[Duration](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html) [🛈](#duration-note-anchor)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`5S`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.http-client.socket-timeout`
|
|
||||||
|
|
||||||
Time to wait between two packets before timeout.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_HTTP_CLIENT_SOCKET_TIMEOUT`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
[Duration](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html) [🛈](#duration-note-anchor)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`10S`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.http-client.response-timeout`
|
|
||||||
|
|
||||||
Time to wait for the full response to be received.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_HTTP_CLIENT_RESPONSE_TIMEOUT`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
[Duration](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html) [🛈](#duration-note-anchor)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`10S`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.http-client.connection-time-to-live`
|
|
||||||
|
|
||||||
Time to live for a connection in the pool.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_HTTP_CLIENT_CONNECTION_TIME_TO_LIVE`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
[Duration](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html) [🛈](#duration-note-anchor)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`30S`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.http-client.idle-connections-eviction-interval`
|
|
||||||
|
|
||||||
Time between eviction runs for idle connections.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_HTTP_CLIENT_IDLE_CONNECTIONS_EVICTION_INTERVAL`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
[Duration](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html) [🛈](#duration-note-anchor)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`1M`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.http-client.max-response-size`
|
|
||||||
|
|
||||||
If a feed is larger than this, it will be discarded to prevent memory issues while parsing the feed.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_HTTP_CLIENT_MAX_RESPONSE_SIZE`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
MemorySize [🛈](#memory-size-note-anchor)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`5M`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.http-client.block-local-addresses`
|
|
||||||
|
|
||||||
Prevent access to local addresses to mitigate server-side request forgery (SSRF) attacks, which could potentially expose internal
|
|
||||||
resources.
|
|
||||||
|
|
||||||
You may want to disable this if you subscribe to feeds that are only available on your local network and you trust all users of
|
|
||||||
your CommaFeed instance.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_HTTP_CLIENT_BLOCK_LOCAL_ADDRESSES`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
boolean
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`true`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th align="left" colspan="3">
|
|
||||||
HTTP client cache configuration
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.http-client.cache.enabled`
|
|
||||||
|
|
||||||
Whether to enable the cache. This cache is used to avoid spamming feeds in short bursts (e.g. when subscribing to a feed for the
|
|
||||||
first time or when clicking "fetch all my feeds now").
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_HTTP_CLIENT_CACHE_ENABLED`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
boolean
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`true`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.http-client.cache.maximum-memory-size`
|
|
||||||
|
|
||||||
Maximum amount of memory the cache can use.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_HTTP_CLIENT_CACHE_MAXIMUM_MEMORY_SIZE`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
MemorySize [🛈](#memory-size-note-anchor)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`10M`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.http-client.cache.expiration`
|
|
||||||
|
|
||||||
Duration after which an entry is removed from the cache.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_HTTP_CLIENT_CACHE_EXPIRATION`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
[Duration](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html) [🛈](#duration-note-anchor)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`1M`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th align="left" colspan="3">
|
|
||||||
Feed refresh engine settings
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.feed-refresh.interval`
|
|
||||||
|
|
||||||
Default amount of time CommaFeed will wait before refreshing a feed.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_FEED_REFRESH_INTERVAL`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
[Duration](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html) [🛈](#duration-note-anchor)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`5M`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.feed-refresh.max-interval`
|
|
||||||
|
|
||||||
Maximum amount of time CommaFeed will wait before refreshing a feed. This is used as an upper bound when:
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>an error occurs while refreshing a feed and we're backing off exponentially</li>
|
|
||||||
<li>we receive a Cache-Control header from the feed</li>
|
|
||||||
<li>we receive a Retry-After header from the feed</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_FEED_REFRESH_MAX_INTERVAL`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
[Duration](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html) [🛈](#duration-note-anchor)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`4H`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.feed-refresh.interval-empirical`
|
|
||||||
|
|
||||||
If enabled, CommaFeed will calculate the next refresh time based on the feed's average time between entries and the time since
|
|
||||||
the last entry was published. The interval will be sometimes between the default refresh interval
|
|
||||||
(`commafeed.feed-refresh.interval`) and the maximum refresh interval (`commafeed.feed-refresh.max-interval`).
|
|
||||||
|
|
||||||
See <code>FeedRefreshIntervalCalculator</code> for details.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_FEED_REFRESH_INTERVAL_EMPIRICAL`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
boolean
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`true`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.feed-refresh.http-threads`
|
|
||||||
|
|
||||||
Amount of http threads used to fetch feeds.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_FEED_REFRESH_HTTP_THREADS`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
int
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`3`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.feed-refresh.database-threads`
|
|
||||||
|
|
||||||
Amount of threads used to insert new entries in the database.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_FEED_REFRESH_DATABASE_THREADS`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
int
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`1`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.feed-refresh.user-inactivity-period`
|
|
||||||
|
|
||||||
Duration after which a user is considered inactive. Feeds for inactive users are not refreshed until they log in again.
|
|
||||||
|
|
||||||
0 to disable.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_FEED_REFRESH_USER_INACTIVITY_PERIOD`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
[Duration](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html) [🛈](#duration-note-anchor)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`0S`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.feed-refresh.filtering-expression-evaluation-timeout`
|
|
||||||
|
|
||||||
Duration after which the evaluation of a filtering expresion to mark an entry as read is considered to have timed out.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_FEED_REFRESH_FILTERING_EXPRESSION_EVALUATION_TIMEOUT`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
[Duration](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html) [🛈](#duration-note-anchor)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`500MS`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.feed-refresh.force-refresh-cooldown-duration`
|
|
||||||
|
|
||||||
Duration after which the "Fetch all my feeds now" action is available again after use to avoid spamming feeds.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_FEED_REFRESH_FORCE_REFRESH_COOLDOWN_DURATION`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
[Duration](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html) [🛈](#duration-note-anchor)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`0S`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th align="left" colspan="3">
|
|
||||||
Feed refresh engine error handling settings
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.feed-refresh.errors.retries-before-backoff`
|
|
||||||
|
|
||||||
Number of retries before backoff is applied.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_FEED_REFRESH_ERRORS_RETRIES_BEFORE_BACKOFF`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
int
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`3`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.feed-refresh.errors.backoff-interval`
|
|
||||||
|
|
||||||
Duration to wait before retrying after an error. Will be multiplied by the number of errors since the last successful fetch.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_FEED_REFRESH_ERRORS_BACKOFF_INTERVAL`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
[Duration](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html) [🛈](#duration-note-anchor)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`1H`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th align="left" colspan="3">
|
|
||||||
Database settings
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.database.query-timeout`
|
|
||||||
|
|
||||||
Timeout applied to all database queries.
|
|
||||||
|
|
||||||
0 to disable.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_DATABASE_QUERY_TIMEOUT`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
[Duration](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html) [🛈](#duration-note-anchor)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`0S`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th align="left" colspan="3">
|
|
||||||
Database cleanup settings
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.database.cleanup.entries-max-age`
|
|
||||||
|
|
||||||
Maximum age of feed entries in the database. Older entries will be deleted.
|
|
||||||
|
|
||||||
0 to disable.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_DATABASE_CLEANUP_ENTRIES_MAX_AGE`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
[Duration](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html) [🛈](#duration-note-anchor)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`365D`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.database.cleanup.statuses-max-age`
|
|
||||||
|
|
||||||
Maximum age of feed entry statuses (read/unread) in the database. Older statuses will be deleted.
|
|
||||||
|
|
||||||
0 to disable.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_DATABASE_CLEANUP_STATUSES_MAX_AGE`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
[Duration](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html) [🛈](#duration-note-anchor)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`0S`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.database.cleanup.max-feed-capacity`
|
|
||||||
|
|
||||||
Maximum number of entries per feed to keep in the database.
|
|
||||||
|
|
||||||
0 to disable.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_DATABASE_CLEANUP_MAX_FEED_CAPACITY`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
int
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`500`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.database.cleanup.max-feeds-per-user`
|
|
||||||
|
|
||||||
Limit the number of feeds a user can subscribe to.
|
|
||||||
|
|
||||||
0 to disable.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_DATABASE_CLEANUP_MAX_FEEDS_PER_USER`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
int
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`0`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.database.cleanup.batch-size`
|
|
||||||
|
|
||||||
Rows to delete per query while cleaning up old entries.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_DATABASE_CLEANUP_BATCH_SIZE`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
int
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`100`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th align="left" colspan="3">
|
|
||||||
Users settings
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.users.allow-registrations`
|
|
||||||
|
|
||||||
Whether to let users create accounts for themselves.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_USERS_ALLOW_REGISTRATIONS`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
boolean
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`false`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.users.strict-password-policy`
|
|
||||||
|
|
||||||
Whether to enable strict password validation (1 uppercase char, 1 lowercase char, 1 digit, 1 special char).
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_USERS_STRICT_PASSWORD_POLICY`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
boolean
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`true`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.users.create-demo-account`
|
|
||||||
|
|
||||||
Whether to create a demo account the first time the app starts.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_USERS_CREATE_DEMO_ACCOUNT`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
boolean
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`false`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th align="left" colspan="3">
|
|
||||||
Websocket settings
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.websocket.enabled`
|
|
||||||
|
|
||||||
Enable websocket connection so the server can notify web clients that there are new entries for feeds.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_WEBSOCKET_ENABLED`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
boolean
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`true`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.websocket.ping-interval`
|
|
||||||
|
|
||||||
Interval at which the client will send a ping message on the websocket to keep the connection alive.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_WEBSOCKET_PING_INTERVAL`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
[Duration](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html) [🛈](#duration-note-anchor)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`15M`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`commafeed.websocket.tree-reload-interval`
|
|
||||||
|
|
||||||
If the websocket connection is disabled or the connection is lost, the client will reload the feed tree at this interval.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Environment variable: `COMMAFEED_WEBSOCKET_TREE_RELOAD_INTERVAL`</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
[Duration](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html) [🛈](#duration-note-anchor)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
`30S`
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<a name="duration-note-anchor"></a>
|
|
||||||
|
|
||||||
> [!NOTE]
|
|
||||||
> ### About the Duration format
|
|
||||||
>
|
|
||||||
> To write duration values, use the standard `java.time.Duration` format.
|
|
||||||
> See the [Duration#parse()](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html#parse(java.lang.CharSequence)) Java API documentation] for more information.
|
|
||||||
>
|
|
||||||
> You can also use a simplified format, starting with a number:
|
|
||||||
>
|
|
||||||
> * If the value is only a number, it represents time in seconds.
|
|
||||||
> * If the value is a number followed by `ms`, it represents time in milliseconds.
|
|
||||||
>
|
|
||||||
> In other cases, the simplified format is translated to the `java.time.Duration` format for parsing:
|
|
||||||
>
|
|
||||||
> * If the value is a number followed by `h`, `m`, or `s`, it is prefixed with `PT`.
|
|
||||||
> * If the value is a number followed by `d`, it is prefixed with `P`.
|
|
||||||
<a name="memory-size-note-anchor"></a>
|
|
||||||
|
|
||||||
> [!NOTE]
|
|
||||||
> ### About the MemorySize format
|
|
||||||
>
|
|
||||||
> A size configuration option recognizes strings in this format (shown as a regular expression): `[0-9]+[KkMmGgTtPpEeZzYy]?`.
|
|
||||||
>
|
|
||||||
> If no suffix is given, assume bytes.
|
|
||||||
@@ -6,13 +6,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.commafeed</groupId>
|
<groupId>com.commafeed</groupId>
|
||||||
<artifactId>commafeed</artifactId>
|
<artifactId>commafeed</artifactId>
|
||||||
<version>5.6.0</version>
|
<version>5.6.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>commafeed-server</artifactId>
|
<artifactId>commafeed-server</artifactId>
|
||||||
<name>CommaFeed Server</name>
|
<name>CommaFeed Server</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<quarkus.version>3.18.3</quarkus.version>
|
<quarkus.version>3.18.4</quarkus.version>
|
||||||
<querydsl.version>6.10.1</querydsl.version>
|
<querydsl.version>6.10.1</querydsl.version>
|
||||||
<rome.version>2.1.0</rome.version>
|
<rome.version>2.1.0</rome.version>
|
||||||
<swagger.version>2.2.28</swagger.version>
|
<swagger.version>2.2.28</swagger.version>
|
||||||
@@ -115,6 +115,34 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>exec-maven-plugin</artifactId>
|
||||||
|
<version>3.5.0</version>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.quarkus</groupId>
|
||||||
|
<artifactId>quarkus-extension-processor</artifactId>
|
||||||
|
<version>${quarkus.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<configuration>
|
||||||
|
<includePluginDependencies>true</includePluginDependencies>
|
||||||
|
<mainClass>com.commafeed.tools.CommaFeedPropertiesGenerator</mainClass>
|
||||||
|
<arguments>
|
||||||
|
<argument>${project.build.directory}</argument>
|
||||||
|
</arguments>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>process-test-resources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>java</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
@@ -270,7 +298,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>com.diffplug.spotless</groupId>
|
<groupId>com.diffplug.spotless</groupId>
|
||||||
<artifactId>spotless-maven-plugin</artifactId>
|
<artifactId>spotless-maven-plugin</artifactId>
|
||||||
<version>2.44.2</version>
|
<version>2.44.3</version>
|
||||||
<?m2e ignore?>
|
<?m2e ignore?>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
@@ -297,7 +325,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.commafeed</groupId>
|
<groupId>com.commafeed</groupId>
|
||||||
<artifactId>commafeed-client</artifactId>
|
<artifactId>commafeed-client</artifactId>
|
||||||
<version>5.6.0</version>
|
<version>5.6.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- compile-time processors -->
|
<!-- compile-time processors -->
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM ibm-semeru-runtimes:open-21.0.5_11-jre
|
FROM ibm-semeru-runtimes:open-21.0.6_7-jre
|
||||||
EXPOSE 8082
|
EXPOSE 8082
|
||||||
|
|
||||||
RUN mkdir -p /commafeed/data
|
RUN mkdir -p /commafeed/data
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ CommaFeed also supports:
|
|||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
All [CommaFeed settings](https://github.com/Athou/commafeed/blob/master/commafeed-server/doc/commafeed.md) are
|
All [CommaFeed settings](https://athou.github.io/commafeed/documentation) are
|
||||||
optional and have sensible default values.
|
optional and have sensible default values.
|
||||||
|
|
||||||
Settings are overrideable with environment variables. For instance, `commafeed.feed-refresh.interval-empirical` can be
|
Settings are overrideable with environment variables. For instance, `commafeed.feed-refresh.interval-empirical` can be
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ import com.commafeed.backend.HttpGetter.NotModifiedException;
|
|||||||
import com.commafeed.backend.HttpGetter.SchemeNotAllowedException;
|
import com.commafeed.backend.HttpGetter.SchemeNotAllowedException;
|
||||||
import com.commafeed.backend.HttpGetter.TooManyRequestsException;
|
import com.commafeed.backend.HttpGetter.TooManyRequestsException;
|
||||||
import com.commafeed.backend.feed.parser.FeedParser;
|
import com.commafeed.backend.feed.parser.FeedParser;
|
||||||
|
import com.commafeed.backend.feed.parser.FeedParser.FeedParsingException;
|
||||||
import com.commafeed.backend.feed.parser.FeedParserResult;
|
import com.commafeed.backend.feed.parser.FeedParserResult;
|
||||||
import com.commafeed.backend.urlprovider.FeedURLProvider;
|
import com.commafeed.backend.urlprovider.FeedURLProvider;
|
||||||
import com.rometools.rome.io.FeedException;
|
|
||||||
|
|
||||||
import io.quarkus.arc.All;
|
import io.quarkus.arc.All;
|
||||||
import jakarta.inject.Singleton;
|
import jakarta.inject.Singleton;
|
||||||
@@ -43,8 +43,8 @@ public class FeedFetcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public FeedFetcherResult fetch(String feedUrl, boolean extractFeedUrlFromHtml, String lastModified, String eTag,
|
public FeedFetcherResult fetch(String feedUrl, boolean extractFeedUrlFromHtml, String lastModified, String eTag,
|
||||||
Instant lastPublishedDate, String lastContentHash) throws FeedException, IOException, NotModifiedException,
|
Instant lastPublishedDate, String lastContentHash) throws FeedParsingException, IOException, NotModifiedException,
|
||||||
TooManyRequestsException, SchemeNotAllowedException, HostNotAllowedException {
|
TooManyRequestsException, SchemeNotAllowedException, HostNotAllowedException, NoFeedFoundException {
|
||||||
log.debug("Fetching feed {}", feedUrl);
|
log.debug("Fetching feed {}", feedUrl);
|
||||||
|
|
||||||
HttpResult result = getter.get(HttpRequest.builder(feedUrl).lastModified(lastModified).eTag(eTag).build());
|
HttpResult result = getter.get(HttpRequest.builder(feedUrl).lastModified(lastModified).eTag(eTag).build());
|
||||||
@@ -53,17 +53,17 @@ public class FeedFetcher {
|
|||||||
FeedParserResult parserResult;
|
FeedParserResult parserResult;
|
||||||
try {
|
try {
|
||||||
parserResult = parser.parse(result.getUrlAfterRedirect(), content);
|
parserResult = parser.parse(result.getUrlAfterRedirect(), content);
|
||||||
} catch (FeedException e) {
|
} catch (FeedParsingException e) {
|
||||||
if (extractFeedUrlFromHtml) {
|
if (extractFeedUrlFromHtml) {
|
||||||
String extractedUrl = extractFeedUrl(urlProviders, feedUrl, new String(result.getContent(), StandardCharsets.UTF_8));
|
String extractedUrl = extractFeedUrl(urlProviders, feedUrl, new String(result.getContent(), StandardCharsets.UTF_8));
|
||||||
if (org.apache.commons.lang3.StringUtils.isNotBlank(extractedUrl)) {
|
if (StringUtils.isNotBlank(extractedUrl)) {
|
||||||
feedUrl = extractedUrl;
|
feedUrl = extractedUrl;
|
||||||
|
|
||||||
result = getter.get(HttpRequest.builder(extractedUrl).lastModified(lastModified).eTag(eTag).build());
|
result = getter.get(HttpRequest.builder(extractedUrl).lastModified(lastModified).eTag(eTag).build());
|
||||||
content = result.getContent();
|
content = result.getContent();
|
||||||
parserResult = parser.parse(result.getUrlAfterRedirect(), content);
|
parserResult = parser.parse(result.getUrlAfterRedirect(), content);
|
||||||
} else {
|
} else {
|
||||||
throw e;
|
throw new NoFeedFoundException(e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw e;
|
throw e;
|
||||||
@@ -111,4 +111,12 @@ public class FeedFetcher {
|
|||||||
String contentHash, Duration validFor) {
|
String contentHash, Duration validFor) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class NoFeedFoundException extends Exception {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public NoFeedFoundException(Throwable cause) {
|
||||||
|
super("This URL does not point to an RSS feed or a website with an RSS feed.", cause);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ import com.rometools.rome.feed.synd.SyndEntry;
|
|||||||
import com.rometools.rome.feed.synd.SyndFeed;
|
import com.rometools.rome.feed.synd.SyndFeed;
|
||||||
import com.rometools.rome.feed.synd.SyndLink;
|
import com.rometools.rome.feed.synd.SyndLink;
|
||||||
import com.rometools.rome.feed.synd.SyndLinkImpl;
|
import com.rometools.rome.feed.synd.SyndLinkImpl;
|
||||||
import com.rometools.rome.io.FeedException;
|
|
||||||
import com.rometools.rome.io.SyndFeedInput;
|
import com.rometools.rome.io.SyndFeedInput;
|
||||||
|
|
||||||
import jakarta.inject.Singleton;
|
import jakarta.inject.Singleton;
|
||||||
@@ -56,12 +55,12 @@ public class FeedParser {
|
|||||||
private final EncodingDetector encodingDetector;
|
private final EncodingDetector encodingDetector;
|
||||||
private final FeedCleaner feedCleaner;
|
private final FeedCleaner feedCleaner;
|
||||||
|
|
||||||
public FeedParserResult parse(String feedUrl, byte[] xml) throws FeedException {
|
public FeedParserResult parse(String feedUrl, byte[] xml) throws FeedParsingException {
|
||||||
try {
|
try {
|
||||||
Charset encoding = encodingDetector.getEncoding(xml);
|
Charset encoding = encodingDetector.getEncoding(xml);
|
||||||
String xmlString = feedCleaner.trimInvalidXmlCharacters(new String(xml, encoding));
|
String xmlString = feedCleaner.trimInvalidXmlCharacters(new String(xml, encoding));
|
||||||
if (xmlString == null) {
|
if (xmlString == null) {
|
||||||
throw new FeedException("Input string is null for url " + feedUrl);
|
throw new FeedParsingException("Input string is null for url " + feedUrl);
|
||||||
}
|
}
|
||||||
xmlString = feedCleaner.replaceHtmlEntitiesWithNumericEntities(xmlString);
|
xmlString = feedCleaner.replaceHtmlEntitiesWithNumericEntities(xmlString);
|
||||||
xmlString = feedCleaner.removeDoctypeDeclarations(xmlString);
|
xmlString = feedCleaner.removeDoctypeDeclarations(xmlString);
|
||||||
@@ -81,8 +80,10 @@ public class FeedParser {
|
|||||||
Long averageEntryInterval = averageTimeBetweenEntries(entries);
|
Long averageEntryInterval = averageTimeBetweenEntries(entries);
|
||||||
|
|
||||||
return new FeedParserResult(title, link, lastPublishedDate, averageEntryInterval, lastEntryDate, entries);
|
return new FeedParserResult(title, link, lastPublishedDate, averageEntryInterval, lastEntryDate, entries);
|
||||||
|
} catch (FeedParsingException e) {
|
||||||
|
throw e;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new FeedException(String.format("Could not parse feed from %s : %s", feedUrl, e.getMessage()), e);
|
throw new FeedParsingException(String.format("Could not parse feed from %s : %s", feedUrl, e.getMessage()), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,4 +269,16 @@ public class FeedParser {
|
|||||||
return (long) stats.getMean();
|
return (long) stats.getMean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class FeedParsingException extends Exception {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public FeedParsingException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FeedParsingException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -264,10 +264,7 @@ public class FeedREST {
|
|||||||
info = fetchFeedInternal(req.getUrl());
|
info = fetchFeedInternal(req.getUrl());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Throwable cause = Throwables.getRootCause(e);
|
Throwable cause = Throwables.getRootCause(e);
|
||||||
return Response.status(Status.INTERNAL_SERVER_ERROR)
|
return Response.status(Status.INTERNAL_SERVER_ERROR).entity(cause.getMessage()).type(MediaType.TEXT_PLAIN).build();
|
||||||
.entity(cause.getClass().getName() + ": " + cause.getMessage())
|
|
||||||
.type(MediaType.TEXT_PLAIN)
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
return Response.ok(info).build();
|
return Response.ok(info).build();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
package com.commafeed.tools;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import com.commafeed.CommaFeedConfiguration;
|
||||||
|
|
||||||
|
import io.quarkus.annotation.processor.Outputs;
|
||||||
|
import io.quarkus.annotation.processor.documentation.config.model.AbstractConfigItem;
|
||||||
|
import io.quarkus.annotation.processor.documentation.config.model.ConfigProperty;
|
||||||
|
import io.quarkus.annotation.processor.documentation.config.model.ConfigRoot;
|
||||||
|
import io.quarkus.annotation.processor.documentation.config.model.ConfigSection;
|
||||||
|
import io.quarkus.annotation.processor.documentation.config.model.JavadocElements;
|
||||||
|
import io.quarkus.annotation.processor.documentation.config.model.ResolvedModel;
|
||||||
|
import io.quarkus.annotation.processor.documentation.config.util.JacksonMappers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class generates an application.properties file with all the properties from {@link CommaFeedConfiguration}.
|
||||||
|
*
|
||||||
|
* This is useful for people who want to be able to configure CommaFeed without having to look at the code or the documentation, or for
|
||||||
|
* distribution packages that want to provide a default configuration file.
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
public class CommaFeedPropertiesGenerator {
|
||||||
|
|
||||||
|
private final List<String> lines = new ArrayList<>();
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
new CommaFeedPropertiesGenerator().generate(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void generate(String[] args) throws IOException {
|
||||||
|
Path targetPath = Paths.get(args[0]);
|
||||||
|
|
||||||
|
ResolvedModel resolvedModel = JacksonMappers.yamlObjectReader()
|
||||||
|
.readValue(targetPath.resolve(Outputs.QUARKUS_CONFIG_DOC_MODEL).toFile(), ResolvedModel.class);
|
||||||
|
JavadocElements javadocElements = JacksonMappers.yamlObjectReader()
|
||||||
|
.readValue(targetPath.resolve(Outputs.QUARKUS_CONFIG_DOC_JAVADOC).toFile(), JavadocElements.class);
|
||||||
|
|
||||||
|
for (ConfigRoot configRoot : resolvedModel.getConfigRoots()) {
|
||||||
|
for (AbstractConfigItem item : configRoot.getItems()) {
|
||||||
|
handleAbstractConfigItem(item, javadocElements);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Files.writeString(targetPath.resolve("quarkus-generated-doc").resolve("application.properties"), String.join("\n", lines));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleAbstractConfigItem(AbstractConfigItem item, JavadocElements javadocElements) {
|
||||||
|
if (item.isSection()) {
|
||||||
|
handleSection((ConfigSection) item, javadocElements);
|
||||||
|
} else {
|
||||||
|
handleProperty((ConfigProperty) item, javadocElements);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleSection(ConfigSection section, JavadocElements javadocElements) {
|
||||||
|
for (AbstractConfigItem item : section.getItems()) {
|
||||||
|
handleAbstractConfigItem(item, javadocElements);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleProperty(ConfigProperty property, JavadocElements javadocElements) {
|
||||||
|
String key = property.getPath().property();
|
||||||
|
String description = javadocElements.elements()
|
||||||
|
.get(property.getSourceType() + "." + property.getSourceElementName())
|
||||||
|
.description()
|
||||||
|
.replace("\n", "\n# ");
|
||||||
|
String defaultValue = Optional.ofNullable(property.getDefaultValue()).orElse("").toLowerCase();
|
||||||
|
|
||||||
|
lines.add("# " + description);
|
||||||
|
lines.add(key + "=" + defaultValue);
|
||||||
|
lines.add("");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
package com.commafeed;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
import org.junit.jupiter.api.Assertions;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
class CommaFeedConfigurationTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void verifyMarkdownDocIsUpToDate() throws IOException {
|
|
||||||
String versionedDocumentationFile = FileUtils.readFileToString(new File("doc/commafeed.md"), StandardCharsets.UTF_8);
|
|
||||||
String generatedDocumentationFile = FileUtils.readFileToString(new File("target/quarkus-generated-doc/config/commafeed-server.md"),
|
|
||||||
StandardCharsets.UTF_8);
|
|
||||||
|
|
||||||
Assertions.assertLinesMatch(versionedDocumentationFile.lines(), generatedDocumentationFile.lines());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
4
pom.xml
4
pom.xml
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>com.commafeed</groupId>
|
<groupId>com.commafeed</groupId>
|
||||||
<artifactId>commafeed</artifactId>
|
<artifactId>commafeed</artifactId>
|
||||||
<version>5.6.0</version>
|
<version>5.6.1</version>
|
||||||
<name>CommaFeed</name>
|
<name>CommaFeed</name>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.13.0</version>
|
<version>3.14.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<parameters>true</parameters>
|
<parameters>true</parameters>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user