Skip to content

Commit

Permalink
Merge pull request #35 from unfoldingWord/develop
Browse files Browse the repository at this point in the history
Develop into main for release
  • Loading branch information
richmahn authored Jul 5, 2024
2 parents a3b45a0 + 6971291 commit 6d1e7ce
Show file tree
Hide file tree
Showing 28 changed files with 923 additions and 1,288 deletions.
2 changes: 1 addition & 1 deletion netlify/functions/cache-html/cache-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ exports.handler = async function (event, context) {

const path = event.queryStringParameters.path;

if (!path || !path.startsWith('u/') || !path.endsWith('.json.gzip')) {
if (!path || !path.startsWith('u/') || !path.endsWith('.json.gz')) {
return {
statusCode: 400,
message: 'Invalid Parameters',
Expand Down
6 changes: 3 additions & 3 deletions netlify/functions/get-cached-url/get-cached-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ exports.handler = async (event, context) => {
ref = "master";
}

const absoluteKey = `u/${owner}/${repo}/${ref}/${bookId}.json.gzip`;
const absoluteKey = `u/${owner}/${repo}/${ref}/${bookId}.json.gz`;

// Create an S3 instance
const s3 = new AWS.S3();
Expand Down Expand Up @@ -48,7 +48,7 @@ exports.handler = async (event, context) => {

try {
const data = await s3.listObjectsV2(params).promise();
const versions = new Set(data.Contents.filter(item => item.Key.endsWith(`/${bookId}.json.gzip`)).map(item => item.Key.split('/')[3])); // get the version part of the key
const versions = new Set(data.Contents.filter(item => item.Key.endsWith(`/${bookId}.json.gz`)).map(item => item.Key.split('/')[3])); // get the version part of the key
if (versions.size === 0) {
return {
statusCode: 404,
Expand All @@ -59,7 +59,7 @@ exports.handler = async (event, context) => {
const latestVersions = Array.from(versions).sort((a, b) => b.localeCompare(a, undefined, {numeric: true}));
const index = latestVersions.findIndex(version => version.localeCompare(ref, undefined, {numeric: true}) < 0);
const previousVersion = index !== -1 ? latestVersions[index] : latestVersions.includes('master') ? 'master' : latestVersions[0];
const downloadLink = `https://s3.us-west-2.amazonaws.com/${process.env.VITE_PREVIEW_S3_BUCKET_NAME}/u/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/${encodeURIComponent(previousVersion)}/${bookId}.json.gzip`;
const downloadLink = `https://s3.us-west-2.amazonaws.com/${process.env.VITE_PREVIEW_S3_BUCKET_NAME}/u/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/${encodeURIComponent(previousVersion)}/${bookId}.json.gz`;
return {
statusCode: 200,
body: downloadLink,
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "door43-preview-app",
"private": true,
"version": "1.0.13",
"version": "1.0.14",
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -24,7 +24,7 @@
"@vivliostyle/react": "^2.27.0",
"autosuggest-highlight": "^3.3.4",
"axios": "^1.6.7",
"bible-reference-rcl": "^1.4.0",
"bible-reference-rcl": "^1.4.1",
"dompurify": "^3.0.8",
"jszip": "^3.10.1",
"lodash": "4.17.21",
Expand All @@ -34,7 +34,7 @@
"papaparse": "^5.4.1",
"prop-types": "^15.8.1",
"proskomma-core": "^0.10.7",
"proskomma-json-tools": "0.8.8",
"proskomma-json-tools": "0.8.12",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-draggable": "^4.4.6",
Expand All @@ -47,7 +47,8 @@
"use-deep-compare-effect": "1.8.1",
"usfm-js": "^3.4.2",
"utf8": "^3.0.0",
"uw-quote-helpers": "^1.1.2",
"uw-quote-helpers": "^1.1.4",
"word-aligner-rcl": "^1.1.2",
"yaml": "^2.3.4"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit 6d1e7ce

Please sign in to comment.