Merge branch 'fix-dev-server-crash' into file-info-redesign
This commit is contained in:
commit
f18655e41b
|
@ -1 +0,0 @@
|
||||||
thirdparty
|
|
|
@ -1,60 +1,58 @@
|
||||||
{
|
{
|
||||||
"root": true,
|
"root": true,
|
||||||
"env": {
|
"parserOptions": {
|
||||||
"browser": true,
|
"project": ["./tsconfig.json"]
|
||||||
"es2021": true,
|
|
||||||
"node": true
|
|
||||||
},
|
},
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:react/recommended",
|
"next/core-web-vitals",
|
||||||
"eslint:recommended",
|
"eslint:recommended",
|
||||||
"plugin:@typescript-eslint/eslint-recommended",
|
"plugin:@typescript-eslint/recommended",
|
||||||
"google",
|
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
||||||
"prettier"
|
"prettier"
|
||||||
],
|
],
|
||||||
"parser": "@typescript-eslint/parser",
|
"plugins": ["@typescript-eslint"],
|
||||||
"parserOptions": {
|
|
||||||
"ecmaFeatures": {
|
|
||||||
"jsx": true
|
|
||||||
},
|
|
||||||
"ecmaVersion": 12,
|
|
||||||
"sourceType": "module"
|
|
||||||
},
|
|
||||||
"plugins": [
|
|
||||||
"react",
|
|
||||||
"@typescript-eslint"
|
|
||||||
],
|
|
||||||
"rules": {
|
"rules": {
|
||||||
"indent":"off",
|
"indent": "off",
|
||||||
"class-methods-use-this": "off",
|
"class-methods-use-this": "off",
|
||||||
"react/prop-types": "off",
|
"react/prop-types": "off",
|
||||||
"react/display-name": "off",
|
"react/display-name": "off",
|
||||||
"react/no-unescaped-entities": "off",
|
"react/no-unescaped-entities": "off",
|
||||||
"no-unused-vars": "off",
|
"no-unused-vars": "off",
|
||||||
"@typescript-eslint/no-unused-vars": [
|
"@typescript-eslint/no-unused-vars": ["error"],
|
||||||
"error"
|
|
||||||
],
|
|
||||||
"require-jsdoc": "off",
|
"require-jsdoc": "off",
|
||||||
"valid-jsdoc": "off",
|
"valid-jsdoc": "off",
|
||||||
"max-len": "off",
|
"max-len": "off",
|
||||||
"new-cap": "off",
|
"new-cap": "off",
|
||||||
"no-invalid-this": "off",
|
"no-invalid-this": "off",
|
||||||
"eqeqeq": "error",
|
"eqeqeq": "error",
|
||||||
"object-curly-spacing": [
|
"object-curly-spacing": ["error", "always"],
|
||||||
"error",
|
|
||||||
"always"
|
|
||||||
],
|
|
||||||
"space-before-function-paren": "off",
|
"space-before-function-paren": "off",
|
||||||
"operator-linebreak":["error","after", { "overrides": { "?": "before", ":": "before" } }]
|
"operator-linebreak": [
|
||||||
},
|
"error",
|
||||||
"settings": {
|
"after",
|
||||||
"react": {
|
{ "overrides": { "?": "before", ":": "before" } }
|
||||||
"version": "detect"
|
],
|
||||||
}
|
"@typescript-eslint/no-unsafe-member-access": "warn",
|
||||||
},
|
"@typescript-eslint/no-unsafe-return": "warn",
|
||||||
"globals": {
|
"@typescript-eslint/no-unsafe-assignment": "warn",
|
||||||
"JSX": "readonly",
|
"@typescript-eslint/no-inferrable-types": "warn",
|
||||||
"NodeJS": "readonly",
|
"@typescript-eslint/restrict-template-expressions": "warn",
|
||||||
"ReadableStreamDefaultController": "readonly"
|
"@typescript-eslint/ban-types": "warn",
|
||||||
|
"@typescript-eslint/no-floating-promises": "warn",
|
||||||
|
"@typescript-eslint/no-unsafe-call": "warn",
|
||||||
|
"@typescript-eslint/require-await": "warn",
|
||||||
|
"@typescript-eslint/restrict-plus-operands": "warn",
|
||||||
|
"@typescript-eslint/no-var-requires": "warn",
|
||||||
|
"@typescript-eslint/no-empty-interface": "warn",
|
||||||
|
"@typescript-eslint/no-misused-promises": "warn",
|
||||||
|
"@typescript-eslint/no-empty-function": "warn",
|
||||||
|
"@typescript-eslint/explicit-module-boundary-types": "warn",
|
||||||
|
"@typescript-eslint/no-explicit-any": "warn",
|
||||||
|
"@typescript-eslint/no-unnecessary-type-assertion": "warn",
|
||||||
|
"react-hooks/rules-of-hooks": "warn",
|
||||||
|
"react-hooks/exhaustive-deps": "warn",
|
||||||
|
"@next/next/no-img-element": "warn",
|
||||||
|
"@typescript-eslint/no-unsafe-argument": "warn"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
13
.lintstagedrc.js
Normal file
13
.lintstagedrc.js
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const buildEslintCommand = (filenames) =>
|
||||||
|
`next lint --fix --file ${filenames
|
||||||
|
.map((f) => path.relative(process.cwd(), f))
|
||||||
|
.join(' --file ')}`;
|
||||||
|
|
||||||
|
const buildPrettierCommand = (filenames) =>
|
||||||
|
`yarn prettier --write --ignore-unknown ${filenames.join(' ')}`;
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
'*.{js,jsx,ts,tsx}': [buildEslintCommand, buildPrettierCommand],
|
||||||
|
};
|
|
@ -37,11 +37,6 @@ module.exports = {
|
||||||
'report-to': ' https://csp-reporter.ente.io/local',
|
'report-to': ' https://csp-reporter.ente.io/local',
|
||||||
},
|
},
|
||||||
|
|
||||||
WORKBOX_CONFIG: {
|
|
||||||
swSrc: 'src/serviceWorker.js',
|
|
||||||
exclude: [/manifest\.json$/i],
|
|
||||||
},
|
|
||||||
|
|
||||||
ALL_ROUTES: '/(.*)',
|
ALL_ROUTES: '/(.*)',
|
||||||
|
|
||||||
buildCSPHeader: (directives) => ({
|
buildCSPHeader: (directives) => ({
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
const withBundleAnalyzer = require('@next/bundle-analyzer')({
|
const withBundleAnalyzer = require('@next/bundle-analyzer')({
|
||||||
enabled: process.env.ANALYZE === 'true',
|
enabled: process.env.ANALYZE === 'true',
|
||||||
});
|
});
|
||||||
const withWorkbox = require('@ente-io/next-with-workbox');
|
|
||||||
|
|
||||||
const { withSentryConfig } = require('@sentry/nextjs');
|
const { withSentryConfig } = require('@sentry/nextjs');
|
||||||
const { PHASE_DEVELOPMENT_SERVER } = require('next/constants');
|
const { PHASE_DEVELOPMENT_SERVER } = require('next/constants');
|
||||||
|
@ -19,7 +18,6 @@ const {
|
||||||
COOP_COEP_HEADERS,
|
COOP_COEP_HEADERS,
|
||||||
WEB_SECURITY_HEADERS,
|
WEB_SECURITY_HEADERS,
|
||||||
CSP_DIRECTIVES,
|
CSP_DIRECTIVES,
|
||||||
WORKBOX_CONFIG,
|
|
||||||
ALL_ROUTES,
|
ALL_ROUTES,
|
||||||
getIsSentryEnabled,
|
getIsSentryEnabled,
|
||||||
} = require('./configUtil');
|
} = require('./configUtil');
|
||||||
|
@ -30,42 +28,39 @@ const IS_SENTRY_ENABLED = getIsSentryEnabled();
|
||||||
|
|
||||||
module.exports = (phase) =>
|
module.exports = (phase) =>
|
||||||
withSentryConfig(
|
withSentryConfig(
|
||||||
withWorkbox(
|
withBundleAnalyzer(
|
||||||
withBundleAnalyzer(
|
withTM({
|
||||||
withTM({
|
compiler: {
|
||||||
compiler: {
|
styledComponents: {
|
||||||
styledComponents: {
|
ssr: true,
|
||||||
ssr: true,
|
displayName: true,
|
||||||
displayName: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
env: {
|
},
|
||||||
SENTRY_RELEASE: GIT_SHA,
|
env: {
|
||||||
},
|
SENTRY_RELEASE: GIT_SHA,
|
||||||
workbox: WORKBOX_CONFIG,
|
},
|
||||||
|
|
||||||
headers() {
|
headers() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
// Apply these headers to all routes in your application....
|
// Apply these headers to all routes in your application....
|
||||||
source: ALL_ROUTES,
|
source: ALL_ROUTES,
|
||||||
headers: convertToNextHeaderFormat({
|
headers: convertToNextHeaderFormat({
|
||||||
...COOP_COEP_HEADERS,
|
...COOP_COEP_HEADERS,
|
||||||
...WEB_SECURITY_HEADERS,
|
...WEB_SECURITY_HEADERS,
|
||||||
...buildCSPHeader(CSP_DIRECTIVES),
|
...buildCSPHeader(CSP_DIRECTIVES),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
// https://dev.to/marcinwosinek/how-to-add-resolve-fallback-to-webpack-5-in-nextjs-10-i6j
|
// https://dev.to/marcinwosinek/how-to-add-resolve-fallback-to-webpack-5-in-nextjs-10-i6j
|
||||||
webpack: (config, { isServer }) => {
|
webpack: (config, { isServer }) => {
|
||||||
if (!isServer) {
|
if (!isServer) {
|
||||||
config.resolve.fallback.fs = false;
|
config.resolve.fallback.fs = false;
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
)
|
|
||||||
),
|
),
|
||||||
{
|
{
|
||||||
release: GIT_SHA,
|
release: GIT_SHA,
|
||||||
|
|
36
package.json
36
package.json
|
@ -5,7 +5,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"albums": "next dev -p 3002",
|
"albums": "next dev -p 3002",
|
||||||
"lint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
|
"lint": "next lint",
|
||||||
"prebuild": "yarn lint",
|
"prebuild": "yarn lint",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"postbuild": "next export",
|
"postbuild": "next export",
|
||||||
|
@ -15,7 +15,6 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@date-io/date-fns": "^2.14.0",
|
"@date-io/date-fns": "^2.14.0",
|
||||||
"@ente-io/next-with-workbox": "^1.0.3",
|
|
||||||
"@mui/icons-material": "^5.6.2",
|
"@mui/icons-material": "^5.6.2",
|
||||||
"@mui/material": "^5.6.2",
|
"@mui/material": "^5.6.2",
|
||||||
"@mui/styled-engine": "npm:@mui/styled-engine-sc@latest",
|
"@mui/styled-engine": "npm:@mui/styled-engine-sc@latest",
|
||||||
|
@ -39,13 +38,13 @@
|
||||||
"jszip": "3.7.1",
|
"jszip": "3.7.1",
|
||||||
"libsodium-wrappers": "^0.7.8",
|
"libsodium-wrappers": "^0.7.8",
|
||||||
"localforage": "^1.9.0",
|
"localforage": "^1.9.0",
|
||||||
"next": "^12.3.1",
|
"next": "^13.0.4",
|
||||||
"next-transpile-modules": "^9.0.0",
|
"next-transpile-modules": "^10.0.0",
|
||||||
"photoswipe": "file:./thirdparty/photoswipe",
|
"photoswipe": "file:./thirdparty/photoswipe",
|
||||||
"piexifjs": "^1.0.6",
|
"piexifjs": "^1.0.6",
|
||||||
"react": "^17.0.2",
|
"react": "^18.2.0",
|
||||||
"react-bootstrap": "^1.3.0",
|
"react-bootstrap": "^1.3.0",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^18.2.0",
|
||||||
"react-dropzone": "^11.2.4",
|
"react-dropzone": "^11.2.4",
|
||||||
"react-otp-input": "^2.3.1",
|
"react-otp-input": "^2.3.1",
|
||||||
"react-select": "^4.3.1",
|
"react-select": "^4.3.1",
|
||||||
|
@ -54,11 +53,6 @@
|
||||||
"react-window": "^1.8.6",
|
"react-window": "^1.8.6",
|
||||||
"sanitize-filename": "^1.6.3",
|
"sanitize-filename": "^1.6.3",
|
||||||
"styled-components": "^5.3.5",
|
"styled-components": "^5.3.5",
|
||||||
"workbox-precaching": "^6.1.5",
|
|
||||||
"workbox-recipes": "^6.1.5",
|
|
||||||
"workbox-routing": "^6.1.5",
|
|
||||||
"workbox-strategies": "^6.1.5",
|
|
||||||
"workbox-window": "^6.1.5",
|
|
||||||
"xml-js": "^1.6.11",
|
"xml-js": "^1.6.11",
|
||||||
"yup": "^0.29.3"
|
"yup": "^0.29.3"
|
||||||
},
|
},
|
||||||
|
@ -76,16 +70,10 @@
|
||||||
"@types/react-window-infinite-loader": "^1.0.3",
|
"@types/react-window-infinite-loader": "^1.0.3",
|
||||||
"@types/styled-components": "^5.1.25",
|
"@types/styled-components": "^5.1.25",
|
||||||
"@types/yup": "^0.29.7",
|
"@types/yup": "^0.29.7",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.25.0",
|
"@typescript-eslint/eslint-plugin": "^5.43.0",
|
||||||
"@typescript-eslint/parser": "^4.25.0",
|
"eslint": "^8.28.0",
|
||||||
"eslint": "^7.27.0",
|
"eslint-config-next": "^13.0.4",
|
||||||
"eslint-config-airbnb": "^18.2.1",
|
"eslint-config-prettier": "^8.5.0",
|
||||||
"eslint-config-google": "^0.14.0",
|
|
||||||
"eslint-config-prettier": "^8.3.0",
|
|
||||||
"eslint-plugin-import": "^2.23.3",
|
|
||||||
"eslint-plugin-jsx-a11y": "^6.4.1",
|
|
||||||
"eslint-plugin-react": "^7.23.2",
|
|
||||||
"eslint-plugin-react-hooks": "^4.2.0",
|
|
||||||
"husky": "^7.0.1",
|
"husky": "^7.0.1",
|
||||||
"lint-staged": "^11.1.2",
|
"lint-staged": "^11.1.2",
|
||||||
"prettier": "2.3.2",
|
"prettier": "2.3.2",
|
||||||
|
@ -95,12 +83,6 @@
|
||||||
"standard": {
|
"standard": {
|
||||||
"parser": "babel-eslint"
|
"parser": "babel-eslint"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
|
||||||
"src/**/*.{js,jsx,ts,tsx}": [
|
|
||||||
"eslint --fix",
|
|
||||||
"prettier --write --ignore-unknown"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"@mui/styled-engine": "npm:@mui/styled-engine-sc@latest"
|
"@mui/styled-engine": "npm:@mui/styled-engine-sc@latest"
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import 'photoswipe/dist/photoswipe.css';
|
||||||
import 'styles/global.css';
|
import 'styles/global.css';
|
||||||
import EnteSpinner from 'components/EnteSpinner';
|
import EnteSpinner from 'components/EnteSpinner';
|
||||||
import { logError } from '../utils/sentry';
|
import { logError } from '../utils/sentry';
|
||||||
// import { Workbox } from 'workbox-window';
|
|
||||||
import { getData, LS_KEYS } from 'utils/storage/localStorage';
|
import { getData, LS_KEYS } from 'utils/storage/localStorage';
|
||||||
import HTTPService from 'services/HTTPService';
|
import HTTPService from 'services/HTTPService';
|
||||||
import FlashMessageBar from 'components/FlashMessageBar';
|
import FlashMessageBar from 'components/FlashMessageBar';
|
||||||
|
@ -121,34 +120,6 @@ export default function App({ Component, err }) {
|
||||||
const [notificationAttributes, setNotificationAttributes] =
|
const [notificationAttributes, setNotificationAttributes] =
|
||||||
useState<NotificationAttributes>(null);
|
useState<NotificationAttributes>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (
|
|
||||||
!('serviceWorker' in navigator) ||
|
|
||||||
process.env.NODE_ENV !== 'production'
|
|
||||||
) {
|
|
||||||
console.warn('Progressive Web App support is disabled');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// const wb = new Workbox('sw.js', { scope: '/' });
|
|
||||||
// wb.register();
|
|
||||||
|
|
||||||
if ('serviceWorker' in navigator && !isElectron()) {
|
|
||||||
navigator.serviceWorker.onmessage = (event) => {
|
|
||||||
if (event.data.action === 'upload-files') {
|
|
||||||
const files = event.data.files;
|
|
||||||
setSharedFiles(files);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
navigator.serviceWorker
|
|
||||||
.getRegistrations()
|
|
||||||
.then(function (registrations) {
|
|
||||||
for (const registration of registrations) {
|
|
||||||
registration.unregister();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
HTTPService.getInterceptors().response.use(
|
HTTPService.getInterceptors().response.use(
|
||||||
(resp) => resp,
|
(resp) => resp,
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
import { precacheAndRoute, cleanupOutdatedCaches } from 'workbox-precaching';
|
|
||||||
import { registerRoute, setDefaultHandler } from 'workbox-routing';
|
|
||||||
import { NetworkOnly } from 'workbox-strategies';
|
|
||||||
import { pageCache, offlineFallback } from 'workbox-recipes';
|
|
||||||
|
|
||||||
pageCache();
|
|
||||||
|
|
||||||
precacheAndRoute(self.__WB_MANIFEST);
|
|
||||||
cleanupOutdatedCaches();
|
|
||||||
|
|
||||||
registerRoute(
|
|
||||||
'/share-target',
|
|
||||||
async ({ event }) => {
|
|
||||||
event.waitUntil(
|
|
||||||
(async function () {
|
|
||||||
const data = await event.request.formData();
|
|
||||||
const client = await self.clients.get(
|
|
||||||
event.resultingClientId || event.clientId
|
|
||||||
);
|
|
||||||
const files = data.getAll('files');
|
|
||||||
setTimeout(() => {
|
|
||||||
client.postMessage({ files, action: 'upload-files' });
|
|
||||||
}, 1000);
|
|
||||||
})()
|
|
||||||
);
|
|
||||||
return Response.redirect('./');
|
|
||||||
},
|
|
||||||
'POST'
|
|
||||||
);
|
|
||||||
|
|
||||||
// Use a stale-while-revalidate strategy for all other requests.
|
|
||||||
setDefaultHandler(new NetworkOnly());
|
|
||||||
|
|
||||||
offlineFallback();
|
|
|
@ -39,7 +39,6 @@ import {
|
||||||
} from 'utils/file';
|
} from 'utils/file';
|
||||||
|
|
||||||
import { updateFileCreationDateInEXIF } from './upload/exifService';
|
import { updateFileCreationDateInEXIF } from './upload/exifService';
|
||||||
import { Metadata } from 'types/upload';
|
|
||||||
import QueueProcessor from './queueProcessor';
|
import QueueProcessor from './queueProcessor';
|
||||||
import { Collection } from 'types/collection';
|
import { Collection } from 'types/collection';
|
||||||
import {
|
import {
|
||||||
|
@ -460,11 +459,7 @@ class ExportService {
|
||||||
await this.exportMotionPhoto(fileStream, file, collectionPath);
|
await this.exportMotionPhoto(fileStream, file, collectionPath);
|
||||||
} else {
|
} else {
|
||||||
this.saveMediaFile(collectionPath, fileSaveName, fileStream);
|
this.saveMediaFile(collectionPath, fileSaveName, fileStream);
|
||||||
await this.saveMetadataFile(
|
await this.saveMetadataFile(collectionPath, fileSaveName, file);
|
||||||
collectionPath,
|
|
||||||
fileSaveName,
|
|
||||||
file.metadata
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,11 +478,7 @@ class ExportService {
|
||||||
file.id
|
file.id
|
||||||
);
|
);
|
||||||
this.saveMediaFile(collectionPath, imageSaveName, imageStream);
|
this.saveMediaFile(collectionPath, imageSaveName, imageStream);
|
||||||
await this.saveMetadataFile(
|
await this.saveMetadataFile(collectionPath, imageSaveName, file);
|
||||||
collectionPath,
|
|
||||||
imageSaveName,
|
|
||||||
file.metadata
|
|
||||||
);
|
|
||||||
|
|
||||||
const videoStream = generateStreamFromArrayBuffer(motionPhoto.video);
|
const videoStream = generateStreamFromArrayBuffer(motionPhoto.video);
|
||||||
const videoSaveName = getUniqueFileSaveName(
|
const videoSaveName = getUniqueFileSaveName(
|
||||||
|
@ -496,11 +487,7 @@ class ExportService {
|
||||||
file.id
|
file.id
|
||||||
);
|
);
|
||||||
this.saveMediaFile(collectionPath, videoSaveName, videoStream);
|
this.saveMediaFile(collectionPath, videoSaveName, videoStream);
|
||||||
await this.saveMetadataFile(
|
await this.saveMetadataFile(collectionPath, videoSaveName, file);
|
||||||
collectionPath,
|
|
||||||
videoSaveName,
|
|
||||||
file.metadata
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private saveMediaFile(
|
private saveMediaFile(
|
||||||
|
@ -516,11 +503,11 @@ class ExportService {
|
||||||
private async saveMetadataFile(
|
private async saveMetadataFile(
|
||||||
collectionFolderPath: string,
|
collectionFolderPath: string,
|
||||||
fileSaveName: string,
|
fileSaveName: string,
|
||||||
metadata: Metadata
|
file: EnteFile
|
||||||
) {
|
) {
|
||||||
await this.electronAPIs.saveFileToDisk(
|
await this.electronAPIs.saveFileToDisk(
|
||||||
getFileMetadataSavePath(collectionFolderPath, fileSaveName),
|
getFileMetadataSavePath(collectionFolderPath, fileSaveName),
|
||||||
getGoogleLikeMetadataFile(fileSaveName, metadata)
|
getGoogleLikeMetadataFile(fileSaveName, file)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,15 +128,18 @@ export const dedupe = (files: any[]) => {
|
||||||
|
|
||||||
export const getGoogleLikeMetadataFile = (
|
export const getGoogleLikeMetadataFile = (
|
||||||
fileSaveName: string,
|
fileSaveName: string,
|
||||||
metadata: Metadata
|
file: EnteFile
|
||||||
) => {
|
) => {
|
||||||
|
const metadata: Metadata = file.metadata;
|
||||||
const creationTime = Math.floor(metadata.creationTime / 1000000);
|
const creationTime = Math.floor(metadata.creationTime / 1000000);
|
||||||
const modificationTime = Math.floor(
|
const modificationTime = Math.floor(
|
||||||
(metadata.modificationTime ?? metadata.creationTime) / 1000000
|
(metadata.modificationTime ?? metadata.creationTime) / 1000000
|
||||||
);
|
);
|
||||||
|
const captionValue: string = file?.pubMagicMetadata?.data?.caption;
|
||||||
return JSON.stringify(
|
return JSON.stringify(
|
||||||
{
|
{
|
||||||
title: fileSaveName,
|
title: fileSaveName,
|
||||||
|
caption: captionValue,
|
||||||
creationTime: {
|
creationTime: {
|
||||||
timestamp: creationTime,
|
timestamp: creationTime,
|
||||||
formatted: formatDate(creationTime * 1000),
|
formatted: formatDate(creationTime * 1000),
|
||||||
|
|
|
@ -62,7 +62,8 @@ export function getUnixTimeInMicroSeconds(dateTime: Date) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const unixTime = dateTime.getTime() * 1000;
|
const unixTime = dateTime.getTime() * 1000;
|
||||||
if (unixTime <= 0) {
|
//ignoring dateTimeString = "0000:00:00 00:00:00";
|
||||||
|
if (unixTime === Date.UTC(0, 0, 0, 0, 0, 0, 0)) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return unixTime;
|
return unixTime;
|
||||||
|
|
|
@ -20,12 +20,6 @@
|
||||||
"downlevelIteration": true,
|
"downlevelIteration": true,
|
||||||
"incremental": true
|
"incremental": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.js"],
|
||||||
"next-env.d.ts",
|
"exclude": ["node_modules", "out", ".next", "thirdparty"]
|
||||||
"**/*.ts",
|
|
||||||
"**/*.tsx",
|
|
||||||
"src/pages/index.tsx",
|
|
||||||
"configUtil.js"
|
|
||||||
],
|
|
||||||
"exclude": ["node_modules"]
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue