Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code smells: make more readonly #1740

Merged
merged 8 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ image: https://media.qdraw.nl/log/de-7-dingen-die-ik-miste-bij-het-beheren-van-m

So it was high time to optimise the time-consuming process of photo management. I really enjoy going out and taking pictures. But when I get home, it’s time to properly organise all those photos. That task is typically something we postpone, but it is nice to share the photos and experiences. I have developed a piece of software for this process and in this blog I will tell you what I have improved in this in 2022. This year it really started for the project. The first blog post about the project is a fact. In addition, a demo can also be viewed at [demo.qdraw.nl](https://demo.qdraw.nl)

/* truncate */

## 12 releases done in 2022

What have I worked on in the past year? For example, I’ve been working on real-time updates from the file system so you’re always up-to-date! Added a new type of sort in the list, write a temporary file first before writing a file, to avoid corrupted files. Upgraded to Microsoft’s .NET 6 framework. Added configuration to exclude directories from keeping index up to date. We now keep notifications in a uniform way, even if you have lost the connection for a while, you can retrieve the recent updates. Upgraded the front-end library: React 17 to 18 and the desktop app library: Electron upgraded to the latest version several times. The dependency on Exiftool to write the metadata has been reduced as it is already added during the build. Server side version added for M1/M2 Macs, the desktop version will follow at a later time, I’m running into Gatekeeper (security of Mac OS) issues there. The Diskwatcher functionality has been completely rewritten so that it takes a maximum of 20 seconds to check for duplicate events and filter them out, resulting in a huge performance gain. Furthermore, comparing the database and the file system has changed so that it is a lot faster than before. All this ensured that this works well and released version 0.5.0. Then worked on better documentation, there is still a lot to be gained here and adding locations manually. On to a good 2023!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ and a relentless commitment to enhancing the user experience.
In this blog post, we'll delve into the notable updates and advancements
encapsulated in the various releases of version 0.5.x of our software.

/* truncate */

## Version 0.5.13 - Front-end Accessibility and Code Refinement

The December release, version 0.5.13, showcased a concentrated effort on enhancing front-end accessibility.
Expand Down
2 changes: 2 additions & 0 deletions documentation/blog/20240315-new-release-version-060.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ image: https://media.qdraw.nl/log/de-7-dingen-die-ik-miste-bij-het-beheren-van-m
We're excited to unveil our latest release, Version 0.6.0, packed with exciting updates and
enhancements to elevate your user experience! Let's dive into the key highlights of this release:

/* truncate */

## Backend Enhancements:

- **Upgrade to .NET 8**: Our backend system has been upgraded to .NET 8 - SDK 8.0.202 and Runtime
Expand Down
1,776 changes: 1,502 additions & 274 deletions documentation/package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions history.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ Semantic Versioning 2.0.0 is from version 0.1.6+
- [x] (Fixed) _Back-end_ Query execution was interrupted, Regex Timeout (Issue #1628, #1590) (PR #1676)
- [x] (Fixed) _Back-end_ Download Exiftool did not work (PR #1677)
- [x] (Changed) _Back-end_ Change password hashing security and auto-upgrade path (PR #1688)
- [x] (Changed) _Back-end_ Fixed models for replace (PR #1740)
- [x] (Changed) _Tools_ Update cypress and eslint to 9 (PR #1740)
- [x] (Changed) _Front-end_ Make more properties readonly for internal security (PR #1740)

## version 0.6.1 - 2024-05-16 {#v0.6.1}

Expand Down
15 changes: 7 additions & 8 deletions starsky-tools/dropbox-import/package-lock.json

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

2 changes: 1 addition & 1 deletion starsky-tools/dropbox-import/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"update:install": "npx --yes npm-check-updates -u && npm install"
},
"dependencies": {
"axios": "^1.7.4",
"axios": "^1.7.7",
"dotenv": "^16.4.5"
},
"author": "",
Expand Down
25 changes: 0 additions & 25 deletions starsky-tools/end2end/.eslintrc.js

This file was deleted.

3 changes: 2 additions & 1 deletion starsky-tools/end2end/cypress/e2e/02-login/02-login.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Config } from 'support/config'
import { envName, envFolder } from '../../support/commands'
import configFile from './config.json'
import flow from './flow.json'
const config = configFile[envFolder][envName] as any
const config = configFile[envFolder][envName] as Config

describe('Login (02)', () => {
beforeEach('Check some config settings and do them before each test (02)', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ describe('Upload to folder (10)', () => {
cy.log('next upload 2')

cy.intercept('/starsky/api/upload', (req) => {
req.headers['to'] = config.mkdirPath + "/" + fileName2,
req.headers['to2'] = config.mkdirPath + "/" + fileName2
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
req.headers.to = config.mkdirPath + "/" + fileName2,
req.headers.to2 = config.mkdirPath + "/" + fileName2

}).as('upload2')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export function uploadFileName1 (url: string, fileName1: string, check = true) {
export function uploadFileName1 (url: string, fileName1: string) {
cy.visit(url)

cy.get('.item.item--more').click()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,54 +64,6 @@ describe('Archive (from upload) (21)', () => {
).should('have.length', 1)
})

it('test realtime update 2 websockets (21)', {
retries: { runMode: 4, openMode: 2 }
}, () => {
return new Cypress.Promise((resolve) => {

// skip this test currently for windows

if (!config.isEnabled || Cypress.platform === 'win32') {
cy.log(`test skipped isEnabled: ${config.isEnabled} platform: ${Cypress.platform}` )
resolve();
return;
}

const sourceTags = 'tete de balacha, bergtop, mist, flaine'
const url = Cypress.config().baseUrl
const socketUrl =
url
.replace(config.url, '')
.replace('http://', 'ws://')
.replace('https://', 'wss://') + config.realtime
const socket = new WebSocket(socketUrl)
const keyword = `realtime-update-test${Math.floor(Math.random() * 100)}`

socket.onmessage = function (message: any) {
if (
message.data.includes(keyword) &&
message.data.includes('/starsky-end2end-test/20200822_111408.jpg') &&
message.data.includes('"type":"MetaUpdate"')
) {
resolve()
}
}

cy.request({
method: 'POST',
url: config.updateApi, // baseUrl is prepend to URL
form: true, // indicates the body should be form urlencoded and sets Content-Type: application/x-www-form-urlencoded headers
body: {
append: false,
collections: true,
tags: keyword,
f: '/starsky-end2end-test/20200822_111408.jpg'
}
})
resetAfterwards(sourceTags)
})
})

it('test realtime update notification api 3 (21)', () => {
if (!config.isEnabled) return

Expand All @@ -135,8 +87,9 @@ describe('Archive (from upload) (21)', () => {
url: config.notificationApi as string
}).then((response3) => {
const notification = response3.body as [{ content: string }]
cy.log(notification[0].content)

const dataObjects: any[] = []
const dataObjects: string[] = []
for (const item1 of notification) {
if (
item1.content.includes(keyword) &&
Expand All @@ -160,52 +113,53 @@ describe('Archive (from upload) (21)', () => {
resetAfterwards(sourceTags)
})

// test fails always
// xit('test realtime update (21)', {
// retries: { runMode: 2, openMode: 2 }
// }, async () => {
// if (!config.isEnabled) return

// await new Cypress.Promise((resolve) => {
// if (!config.isEnabled) return

// const sourceTags = 'tete de balacha, bergtop, mist, flaine'
// const keyword = `realtime-update-test${Math.floor(Math.random() * 100)}`

// cy.window().should(({ window }) => {
// window.document.body.addEventListener(
// 'USE_SOCKETS',
// (dataItem: any) => {
// console.log(dataItem.detail.data)

// for (const item1 of dataItem.detail.data) {
// if (
// item1.tags.includes(keyword) &&
// item1.filePath.includes(
// '/starsky-end2end-test/20200822_111408.jpg'
// )
// ) {
// resolve()
// }
// }
// }
// )

// cy.request({
// method: 'POST',
// url: config.updateApi, // baseUrl is prepend to URL
// form: true, // indicates the body should be form urlencoded and sets Content-Type: application/x-www-form-urlencoded headers
// body: {
// append: false,
// collections: true,
// tags: keyword,
// f: '/starsky-end2end-test/20200822_111408.jpg'
// }
// })
// resetAfterwards(sourceTags)
// })
// })
// })
it('test realtime update 2 websockets (21)', {
retries: { runMode: 4, openMode: 2 }
}, () => {
return new Cypress.Promise((resolve) => {

// skip this test currently for windows

if (!config.isEnabled || Cypress.platform === 'win32') {
cy.log(`test skipped isEnabled: ${config.isEnabled} platform: ${Cypress.platform}` )
resolve();
return;
}

const sourceTags = 'tete de balacha, bergtop, mist, flaine'
const url = Cypress.config().baseUrl
const socketUrl =
url
.replace(config.url, '')
.replace('http://', 'ws://')
.replace('https://', 'wss://') + config.realtime
const socket = new WebSocket(socketUrl)
const keyword = `realtime-update-test${Math.floor(Math.random() * 100)}`

socket.onmessage = function (message: {data: string}) {
if (
message.data.includes(keyword) &&
message.data.includes('/starsky-end2end-test/20200822_111408.jpg') &&
message.data.includes('"type":"MetaUpdate"')
) {
resolve()
}
}

cy.request({
method: 'POST',
url: config.updateApi, // baseUrl is prepend to URL
form: true, // indicates the body should be form urlencoded and sets Content-Type: application/x-www-form-urlencoded headers
body: {
append: false,
collections: true,
tags: keyword,
f: '/starsky-end2end-test/20200822_111408.jpg'
}
})
resetAfterwards(sourceTags)
})
})

function resetAfterwards (sourceTags: string): void {
cy.log('next step: reset afterwards')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe("Create Rename Dir (22)", () => {

cy.visit(config.apiEnvEndpoint, {
headers: {
"x-force-html": true,
"x-force-html": "true",
},
});
cy.get("body")
Expand Down Expand Up @@ -218,7 +218,7 @@ describe("Create Rename Dir (22)", () => {

cy.request(config.apiTrash).then((response) => {
const message = response.body.fileIndexItems.find(
(x: any) =>
(x: {filePath: string}) =>
x.filePath === "/starsky-end2end-test/z_test_auto_created_update"
);
if (
Expand All @@ -238,7 +238,7 @@ describe("Create Rename Dir (22)", () => {

cy.request(config.apiTrash).then((response2) => {
const message2 = response2.body.fileIndexItems.find(
(x: any) =>
(x: {filePath: string}) =>
x.filePath === "/starsky-end2end-test/z_test_auto_created_update"
);
if (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { envName, envFolder } from '../../support/commands'
import configFile from './config.json'
import flow from './flow.json'
const config = configFile[envFolder][envName]

describe('Search -from upload (31)', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { envName, envFolder } from '../../support/commands'
import configFile from './config.json'
import flow from './flow.json'
const config = configFile[envFolder][envName]

describe('Search -from upload - update tags (32)', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { uploadFileName1 } from 'integration/10-upload-to-folder/upload-filename1'
import { envName, envFolder } from '../../support/commands'
import configFile from './config.json'
import flow from './flow.json'
Expand Down
Loading
Loading