Skip to content

Commit

Permalink
Merge branch 'self-host-updates' of https://github.com/omnivore-app/o…
Browse files Browse the repository at this point in the history
…mnivore into self-host-updates
  • Loading branch information
Podginator committed Jan 17, 2025
2 parents 74b4c18 + e42208a commit 4ed102a
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 'Login to GitHub container registry'
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{github.actor}}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-migrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
lint_migrations:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Fetch main branch
run: git fetch origin main:main
- name: Find modified migrations
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run-distiller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Setup Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.19
- name: Generate distiller output for readability
Expand All @@ -34,7 +34,7 @@ jobs:
go-domdistiller file -i $f/source.html -o $f/distiller.html
done
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Generate static html
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
ports:
- 6379
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Initialize the database
Expand All @@ -55,7 +55,7 @@ jobs:
env:
PGPASSWORD: postgres
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: 22.12.0
- name: Get yarn cache directory path
Expand Down Expand Up @@ -102,7 +102,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build the API docker image
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v3
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
path: 'packages/readabilityjs/test'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v4
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export class HeaderToggleGridIcon extends React.Component<IconProps> {
}}
>
<svg
width="40"
height="40"
width="38"
height="38"
viewBox="0 0 40 40"
fill="none"
xmlns="http://www.w3.org/2000/svg"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export class HeaderToggleListIcon extends React.Component<IconProps> {
}}
>
<svg
width="40"
height="40"
width="38"
height="38"
viewBox="0 0 40 40"
fill="none"
xmlns="http://www.w3.org/2000/svg"
Expand Down
2 changes: 1 addition & 1 deletion pkg/extension/src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"url": "https://omnivore.app/"
},
"homepage_url": "https://omnivore.app/",
"content_security_policy": "default-src 'none'; child-src 'none'; manifest-src 'none'; media-src 'none'; object-src 'none'; worker-src 'none'; connect-src https://storage.googleapis.com/ process.env.OMNIVORE_GRAPHQL_URL blob:; frame-src 'none'; font-src 'none'; img-src data:; script-src 'self'; script-src-elem 'self' 'unsafe-inline'; script-src-attr 'unsafe-inline'; style-src 'self' 'unsafe-inline'; style-src-elem 'self' 'unsafe-inline'; style-src-attr 'none'; base-uri 'none'; form-action 'none'; block-all-mixed-content; upgrade-insecure-requests; report-uri https://api.jeurissen.co/reports/csp/webext/omnivore/",
"content_security_policy": "default-src 'none'; child-src 'none'; manifest-src 'none'; media-src 'none'; object-src 'none'; worker-src 'none'; connect-src *; frame-src 'none'; font-src 'none'; img-src data:; script-src 'self'; script-src-elem 'self' 'unsafe-inline'; script-src-attr 'unsafe-inline'; style-src 'self' 'unsafe-inline'; style-src-elem 'self' 'unsafe-inline'; style-src-attr 'none'; base-uri 'none'; form-action 'none'; block-all-mixed-content; upgrade-insecure-requests; report-uri https://api.jeurissen.co/reports/csp/webext/omnivore/",
"icons": {
"16": "/images/extension/icon-16.png",
"24": "/images/extension/icon-24.png",
Expand Down
7 changes: 4 additions & 3 deletions pkg/extension/src/scripts/api.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
function gqlRequest(apiUrl, query) {
return getStorageItem('apiKey')
.then((apiKey) => {
return Promise.all([getStorageItem('apiKey'), getStorageItem('apiUrl')])
.then(([apiKey, savedUrl]) => {
const auth = apiKey ? { Authorization: apiKey } : {}
return fetch(apiUrl, {
const url = savedUrl ? `${savedUrl}/graphql` : apiUrl
return fetch(url, {
method: 'POST',
redirect: 'follow',
credentials: 'include',
Expand Down
43 changes: 43 additions & 0 deletions pkg/extension/src/scripts/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,40 @@ function clearAPIKey() {
})
}

function saveAPIUrl() {
var apiUrl = document.getElementById('api-url').value
if (!apiUrl) {
alert('No API URL specified.')
return
}

setStorage({
apiUrl: apiUrl,
}).then(() => {
alert('API URL saved!')
})
}

function loadAPIUrl() {
getStorageItem('apiUrl').then((apiUrl) => {
if (apiUrl) {
document.getElementById('api-url').value = apiUrl
} else {
alert('No API URL found in storage.')
}
})
}

function clearAPIUrl() {
document.getElementById('api-url').value = ''

setStorage({
apiUrl: undefined,
}).then(() => {
alert('API URL cleared!')
})
}

function autoDismissChanged(event) {
const value = document.getElementById('disable-auto-dismiss').checked
console.log(
Expand Down Expand Up @@ -91,6 +125,15 @@ function handleConsent() {
document
.getElementById('clear-api-key-btn')
.addEventListener('click', clearAPIKey)
document
.getElementById('save-api-url-btn')
.addEventListener('click', saveAPIUrl)
document
.getElementById('load-api-url-btn')
.addEventListener('click', loadAPIUrl)
document
.getElementById('clear-api-url-btn')
.addEventListener('click', clearAPIUrl)

getStorageItem('disableAutoDismiss').then((value) => {
document.getElementById('disable-auto-dismiss').checked = value
Expand Down
18 changes: 18 additions & 0 deletions pkg/extension/src/views/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@ <h1>API Key</h1>

<p>&nbsp;</p>

<h1>API URL</h1>
<p>For users self hosting their own instance of Omnivore, you can set the API URL here.
Note this should be the URL of the graphql endpoint, not the webserver.
</p>

<p>
For example, if you are running the Omnivore API at <a href="">https://api-omnivore.mydomain.com</a>,
the API URL would be <a href="">https://api-omnivore.mydomain.com/api</a>.
</p>

<label for="api-url">API URL:</label>
<input type="text" id="api-url">
<br><br>
<button id="save-api-url-btn">Save API URL</button>
<button id="load-api-url-btn">Load API URL</button>
<button id="clear-api-url-btn">Clear API URL</button>
<p>&nbsp;</p>

<h1>Settings</h1>

<p>
Expand Down

0 comments on commit 4ed102a

Please sign in to comment.