Skip to content

Commit

Permalink
Added support for self-hosted instances (outline#1)
Browse files Browse the repository at this point in the history
* added support for self-hosted instances

* replace subdomain variable with domain


Co-authored-by: Tom Moor <[email protected]>
  • Loading branch information
ravnoor and tommoor authored Sep 11, 2020
1 parent f22a316 commit 13b4730
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# alfred-outline

An Alfred workflow to search your team Outline from the comfort of your desktop.
An Alfred workflow to search your team Outline from the comfort of your desktop.

Simply type your keyword into Alfred (default: ou) to see instant search results from your Outline knowledge base. Selecting a search result takes you directly to that Outline document in your default web browser.

Expand All @@ -20,8 +20,8 @@ $ npm install --global alfred-outline

## Workflow Variables

- `apiToken`: Grab a personal API token from the settings page in Outline: https://www.getoutline.com/settings/tokens
- `subdomain`: This should be your just your teams Outline subdomain, whatever is listed between the protocol and getoutline.com in your browsers address bar: https://\<SUBDOMAIN\>.getoutline.com
- `apiToken`: Grab a personal API token from the settings page in Outline: `https://www.getoutline.com/settings/tokens` or `https://\<DOMAIN\>/settings/tokens`
- `domain`: This should be your just your teams Outline domain (`\<TEAM-SUBDOMAIN\>.getoutline.com`) for getoutline.com managed instances and `https://\<DOMAIN\>` for self-hosted instances.

## Usage

Expand Down
10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const path = require('path');
const alfy = require('alfy');

const results = await alfy.fetch(`https://www.getoutline.com/api/documents.search`, {
const protocolAndHost = `https://${process.env.domain || "app.getoutline.com"}`;

const results = await alfy.fetch(`${protocolAndHost}/api/documents.search`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.apiToken}`,
Expand All @@ -15,7 +17,7 @@ const results = await alfy.fetch(`https://www.getoutline.com/api/documents.searc
let items = results.data.map(result => ({
title: result.document.title,
subtitle: result.context.replace(/\<\/?b\>/g, ''),
arg: `https://${process.env.subdomain || "www"}.getoutline.com${result.document.url}`,
arg: `${protocolAndHost}${result.document.url}`,
icon: {
path: path.join(__dirname, "document.png")
}
Expand All @@ -24,8 +26,8 @@ let items = results.data.map(result => ({
if (!items.length) {
items = [{
title: "No results - go to Outline homepage",
arg: `https://${process.env.subdomain || "www"}.getoutline.com/home`
arg: `${protocolAndHost}/home`
}];
}

alfy.output(items);
alfy.output(items);
4 changes: 2 additions & 2 deletions info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@
<dict>
<key>apiToken</key>
<string></string>
<key>subdomain</key>
<key>domain</key>
<string></string>
</dict>
<key>variablesdontexport</key>
<array>
<string>subdomain</string>
<string>domain</string>
<string>apiToken</string>
</array>
<key>version</key>
Expand Down

0 comments on commit 13b4730

Please sign in to comment.