Merge branch 'main' into feat/mass-import

This commit is contained in:
Tom Moor
2021-02-17 23:57:45 -08:00
58 changed files with 2618 additions and 971 deletions

View File

@@ -17,6 +17,15 @@
]
],
"plugins": [
"transform-class-properties"
"transform-class-properties",
[
"transform-inline-environment-variables",
{
"include": [
"SOURCE_COMMIT",
"SOURCE_VERSION"
]
}
]
]
}

View File

@@ -114,10 +114,11 @@ if (isProduction) {
// catch errors in one place, automatically set status and response headers
onerror(app);
if (process.env.SENTRY_DSN) {
if (env.SENTRY_DSN) {
Sentry.init({
dsn: process.env.SENTRY_DSN,
environment: process.env.NODE_ENV,
dsn: env.SENTRY_DSN,
environment: env.ENVIRONMENT,
release: env.RELEASE,
maxBreadcrumbs: 0,
ignoreErrors: [
// emitted by Koa when bots attempt to snoop on paths such as wp-admin

View File

@@ -1,12 +1,17 @@
// @flow
// Note: This entire object is stringified in the HTML exposed to the client
// do not add anything here that should be a secret or password
export default {
URL: process.env.URL,
CDN_URL: process.env.CDN_URL || "",
DEPLOYMENT: process.env.DEPLOYMENT,
ENVIRONMENT: process.env.NODE_ENV,
SENTRY_DSN: process.env.SENTRY_DSN,
TEAM_LOGO: process.env.TEAM_LOGO,
SLACK_KEY: process.env.SLACK_KEY,
SLACK_APP_ID: process.env.SLACK_APP_ID,
SUBDOMAINS_ENABLED: process.env.SUBDOMAINS_ENABLED === "true",
GOOGLE_ANALYTICS_ID: process.env.GOOGLE_ANALYTICS_ID,
RELEASE: process.env.SOURCE_COMMIT || process.env.SOURCE_VERSION || undefined,
};

View File

@@ -1,6 +1,16 @@
// @flow
require("dotenv").config({ silent: true });
// If the DataDog agent is installed and the DD_API_KEY environment variable is
// in the environment then we can safely attempt to start the DD tracer
if (process.env.DD_API_KEY) {
require("dd-trace").init({
// SOURCE_COMMIT is used by Docker Hub
// SOURCE_VERSION is used by Heroku
version: process.env.SOURCE_COMMIT || process.env.SOURCE_VERSION,
});
}
if (
!process.env.SECRET_KEY ||
process.env.SECRET_KEY === "generate_a_new_key"

View File

@@ -67,6 +67,8 @@ router.get("/_health", (ctx) => (ctx.body = "OK"));
if (process.env.NODE_ENV === "production") {
router.get("/static/*", async (ctx) => {
ctx.set({
"Service-Worker-Allowed": "/",
"Access-Control-Allow-Origin": "*",
"Cache-Control": `max-age=${356 * 24 * 60 * 60}`,
});

View File

@@ -2,8 +2,11 @@
<html lang="en">
<head>
<title>Outline</title>
<meta name="theme-color" content="#FFF" />
<meta name="slack-app-id" content="//inject-slack-app-id//" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="description" content="A modern team knowledge base for your internal documentation, product specs, support answers, meeting notes, onboarding, &amp; more…">
//inject-prefetch//
<link
@@ -12,7 +15,12 @@
href="/favicon-32.png"
sizes="32x32"
/>
<link rel="manifest" href="/manifest.json" crossorigin="use-credentials" />
<link
rel="apple-touch-icon"
type="image/png"
href="/apple-touch-icon.png"
sizes="192x192"
/>
<link
rel="search"
type="application/opensearchdescription+xml"
@@ -46,7 +54,9 @@
</script>
<script>
if (window.localStorage && window.localStorage.getItem("theme") === "dark") {
window.document.querySelector("#root").style.background = "#111319";
var color = "#111319";
document.querySelector("#root").style.background = color;
document.querySelector('meta[name="theme-color"]').setAttribute("content", color);
}
</script>
</body>

View File

@@ -17,6 +17,11 @@ const s3 = new AWS.S3({
accessKeyId: AWS_ACCESS_KEY_ID,
secretAccessKey: AWS_SECRET_ACCESS_KEY,
region: AWS_REGION,
endpoint: process.env.AWS_S3_UPLOAD_BUCKET_URL.includes(
AWS_S3_UPLOAD_BUCKET_NAME
)
? undefined
: new AWS.Endpoint(process.env.AWS_S3_UPLOAD_BUCKET_URL),
signatureVersion: "v4",
});
@@ -110,7 +115,6 @@ export const uploadToS3FromBuffer = async (
Key: key,
ContentType: contentType,
ContentLength: buffer.length,
ServerSideEncryption: "AES256",
Body: buffer,
})
.promise();
@@ -135,7 +139,6 @@ export const uploadToS3FromUrl = async (
Key: key,
ContentType: res.headers["content-type"],
ContentLength: res.headers["content-length"],
ServerSideEncryption: "AES256",
Body: buffer,
})
.promise();