Skip to content

Commit

Permalink
Merge pull request #4686 from coralproject/develop
Browse files Browse the repository at this point in the history
v9.5.0
  • Loading branch information
tessalt authored Oct 16, 2024
2 parents 1d2fe8e + 4208938 commit 2d14038
Show file tree
Hide file tree
Showing 84 changed files with 846 additions and 611 deletions.
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coralproject/talk",
"version": "9.4.1",
"version": "9.5.0",
"author": "The Coral Project",
"homepage": "https://coralproject.net/",
"sideEffects": [
Expand Down
7 changes: 6 additions & 1 deletion common/lib/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,5 +472,10 @@ export enum ERROR_CODES {
* priming of comments for the story in the data caches `commentCache` returns an undefined
* result. This usually means something went very wrong loading from Redis or Mongo.
*/
UNABLE_TO_PRIME_CACHED_COMMENTS_FOR_STORY = "UNABLE_TO_PRIME_CACHED_COMMENTS_FOR_STORY"
UNABLE_TO_PRIME_CACHED_COMMENTS_FOR_STORY = "UNABLE_TO_PRIME_CACHED_COMMENTS_FOR_STORY",
/**
* SITE_NOT_FOUND is returned when the site being looked up via an ID does not
* exist in the database or when a siteID has been deleted from a document.
*/
SITE_NOT_FOUND = "SITE_NOT_FOUND",
}
2 changes: 1 addition & 1 deletion common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "common",
"version": "9.4.1",
"version": "9.5.0",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "common",
"version": "9.4.1",
"version": "9.5.0",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
10 changes: 2 additions & 8 deletions server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coralproject/talk",
"version": "9.4.1",
"version": "9.5.0",
"author": "The Coral Project",
"homepage": "https://coralproject.net/",
"sideEffects": [
Expand Down Expand Up @@ -126,7 +126,7 @@
"metascraper-description": "^5.22.5",
"metascraper-image": "^5.22.5",
"metascraper-title": "^5.22.5",
"mongodb": "^3.5.9",
"mongodb": "^6.9.0",
"mongodb-core": "^3.2.7",
"ms": "^2.1.2",
"node-fetch": "^2.6.1",
Expand Down Expand Up @@ -201,7 +201,6 @@
"@types/luxon": "^1.22.0",
"@types/marked": "^0.7.3",
"@types/mini-css-extract-plugin": "^1.4.3",
"@types/mongodb": "3.1.22",
"@types/ms": "^0.7.31",
"@types/node": "^12.12.34",
"@types/node-fetch": "^2.5.5",
Expand Down Expand Up @@ -363,11 +362,6 @@
"Newer versions has problems with using nunjucks.",
"Update when the following issue is resolved:",
"https://github.com/tj/consolidate.js/issues/244"
],
"@types/mongodb@3.1.22": [
"Newer versions has problems with optional fields when querying with null",
"Update when the following issue is resolved:",
"https://github.com/DefinitelyTyped/DefinitelyTyped/issues/47686"
]
},
"graphql-schema-linter": {
Expand Down
117 changes: 79 additions & 38 deletions server/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions server/src/core/server/app/middleware/csp.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { patchTextUtil } from "coral-server/test/textEncoder";
patchTextUtil();

import { generateFrameOptions } from "coral-server/app/middleware/csp";
import { Request } from "coral-server/types/express";

Expand Down
5 changes: 5 additions & 0 deletions server/src/core/server/app/middleware/csp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { AppOptions } from "coral-server/app";
import { getOrigin, prefixSchemeIfRequired } from "coral-server/app/url";
import { Config } from "coral-server/config";
import { MongoContext } from "coral-server/data/context";
import { SiteNotFoundError } from "coral-server/errors";
import {
retrieveSite,
retrieveSiteByOrigin,
Expand Down Expand Up @@ -50,6 +51,10 @@ async function retrieveSiteFromQuery(
return null;
}

if (!story.siteID) {
throw new SiteNotFoundError(null, storyID);
}

// If the site can't be found based on it's allowed origins and the story
// URL (which is a allowed list), then we know it isn't allowed.
return retrieveSite(mongo, tenant.id, story.siteID);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { patchTextUtil } from "coral-server/test/textEncoder";
patchTextUtil();

import jwt from "jsonwebtoken";
import { DateTime } from "luxon";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { patchTextUtil } from "coral-server/test/textEncoder";
patchTextUtil();

import {
SSOTokenSchema,
SSOUserProfileSchema,
Expand Down
6 changes: 5 additions & 1 deletion server/src/core/server/app/middleware/tenant.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { v1 as uuid } from "uuid";

import { MongoContext } from "coral-server/data/context";
import { TenantNotFoundError } from "coral-server/errors";
import { SiteNotFoundError, TenantNotFoundError } from "coral-server/errors";
import logger from "coral-server/logger";
import {
retrieveSite,
Expand Down Expand Up @@ -110,6 +110,10 @@ async function retrieveSiteFromQuery(
return null;
}

if (!story.siteID) {
throw new SiteNotFoundError(null, storyID);
}

// If the site can't be found based on it's allowed origins and the story
// URL (which is a allowed list), then we know it isn't allowed.
return retrieveSite(mongo, tenant.id, story.siteID);
Expand Down
4 changes: 2 additions & 2 deletions server/src/core/server/data/cache/commentCache.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const createRedis = (): AugmentedRedis => {

const createMongo = async (): Promise<MongoContext> => {
const uri = "mongodb://127.0.0.1:27017/coral";
const live = await createMongoDB(uri);
const archive = await createMongoDB(uri);
const live = (await createMongoDB(uri)).db;
const archive = (await createMongoDB(uri)).db;

const context = new MongoContextImpl(live, archive);

Expand Down
Loading

0 comments on commit 2d14038

Please sign in to comment.