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

Move sync-server into Actual repo #4334

Merged
merged 405 commits into from
Feb 10, 2025

Conversation

MikesGlitch
Copy link
Contributor

@MikesGlitch MikesGlitch commented Feb 7, 2025

Bringing the Actual Sync Server into the Actual workspace.

Looking for 3+ approvers before merging.

I had to update

  • Docker - updating paths because sync-server now lives in the packages folder
  • Git workflows - removed workflows that were already in Actual repo and updating references in the remaining workflows
  • Server loadConfig.js - changed the way it finds the Actual web client - due to the way node_modules are different in workspaces
  • Added yarn start:server and yarn install:server for some easy of use. yarn install:server isn't required, but it only installs servers dependencies so it'll be a faster/smaller download.

intiplink and others added 30 commits April 7, 2023 14:37
GitHub CI log:
```
[linux/arm/v6 base 6/8] RUN yarn workspaces focus --all --production
204.6 ➤ YN0007: │ bcrypt@npm:5.1.0 must be built because it never has been before or the last one failed
204.6 ➤ YN0007: │ better-sqlite3@npm:8.2.0 must be built because it never has been before or the last one failed
...
[linux/arm/v7 base 6/8] RUN yarn workspaces focus --all --production
203.8 ➤ YN0007: │ bcrypt@npm:5.1.0 must be built because it never has been before or the last one failed
203.8 ➤ YN0007: │ better-sqlite3@npm:8.2.0 must be built because it never has been before or the last one failed
```

It seems that both armv6 and armv7 have the same issues with `bcrypt`
and `better-sqlite3` not being built. These packages are required to
build from source, luckily QEMU use armv7l for compiling.

Tested and working on RPi Zero W.

---------

Co-authored-by: Jed Fox <[email protected]>
Seems like we already added `tsc` to build the project, but we use the
wrong babel preset (Flow) instead of the specific TS one. This is only
used in testing to make Jest work (from what I can tell).
CodeQL keeps yelling at us about this… I’m not sure if the filter is
smart enough to use this rate limit middleware to remove the warnings,
but at least we will be setting a reasonable bound on attempts to crack
the server password.
Co-authored-by: Matiss Janis Aboltins <[email protected]>
…192)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…(#190)

Helps with actualbudget#919 by adding the `all` field wit both
pending and booked transactions to the output of
`getTransactionsWithBalance()` and, by extension, the
`/nordigen/transactions` endpoint.

I could alter the `getTransactions()` to return the `all` field as well
but I figured that keeping it such that it returns the output from
Nordigen API 1:1 might be better so I left it as is. If you don't agree,
let me know and I'll update this.
A small fix: returning JSON response instead of plain-text.

The frontend always expects a JSON response. So a tiny fix here..
Previously, the latest artifact list was requested unauthenticated using
`ADD "https://api.github.com/..." /tmp/artifacts.json`. While this works
locally, on GitHub’s servers it seems that the per-IP rate limit was
exceeded. There isn’t a way to get Docker to pass the `Authorization`
header that I know of, so this work has been moved to an external shell
script that pulls down the relevant data.
Web: actualbudget#1087
Server: actualbudget/actual-server#207
Docs: actualbudget/docs#179

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Remove the bulk in favour of links to our core docs.

---------

Co-authored-by: Jed Fox <[email protected]>
Replaced contributing link

<!-- Thank you for submitting a pull request! Make sure to follow the
instructions to write release notes for your PR — it should only take a
minute or two:
https://github.com/actualbudget/docs#writing-good-release-notes -->
This allows running a health check from inside the container. Usage:
`npm run health-check`. That may not work inside of Alpine containers,
so you can do `node src/scripts/health-check.js` directly instead. Fixes
actualbudget#213.
- web: actualbudget#1280
 - server: actualbudget/actual-server#222
 - docs: actualbudget/docs#223

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1. upgrade `nordigen-node` to 1.2.6 (which uses the new gocardless
domain)
2. allow accessing `nordigen` functionality via `/gocardless` to unblock
using the new API path in actual-web
matt-fidd
matt-fidd previously approved these changes Feb 9, 2025
Copy link
Contributor

@matt-fidd matt-fidd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pulled down and it runs well! install:server is a great idea, makes it much smaller/quicker for people not interested in dev.

I tested SimpleFIN, GoCardless and OpenID and all worked as expected, alongside the usual Actual stuff.

Copy link
Member

@MatissJanis MatissJanis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of my comments are nitpicks that can be addressed post-merge.

The only blocker I would say is: aligning the prettier config. It will be easier to align the prettier config in this PR (& re-run prettier auto-fixer) than to do this later and submit another mega-pr with all the code-style modifications.

@@ -41,6 +41,7 @@
"devDependencies": {
"@actual-app/api": "workspace:^",
"@actual-app/crdt": "workspace:^",
"@actual-app/web": "workspace:^",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not great 😬
(but I get that your changes in this PR don't actually introduce this)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can move this file to root folder
(but I might be wrong)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can delete this file. It's the same as the LICENSE in the root dir.

@@ -0,0 +1,65 @@
{
"name": "actual-sync",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💬 suggestion: to align with the other pkg names‏

Suggested change
"name": "actual-sync",
"name": "@actual-app/sync-server",

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will tackle this in a follow up just to be safe

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these release note files supposed to be here? Should we instead move them to the root folder?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved them to the root folder

* feedback

* remove temp script
Comment on lines +293 to +297
const req = https.request(new URL(token), options, res => {
res.on('data', d => {
resolve(d.toString());
});
});

Check failure

Code scanning / CodeQL

Server-side request forgery Critical

The
URL
of this request depends on a
user-provided value
.
Comment on lines +361 to +386
const req = https.request(
new URL(`${sfin.baseUrl}/accounts${queryString}`),
options,
res => {
let data = '';
res.on('data', d => {
data += d;
});
res.on('end', () => {
if (res.statusCode === 403) {
reject(new Error('Forbidden'));
} else {
try {
const results = JSON.parse(data);
results.sferrors = results.errors;
results.hasError = false;
results.errors = {};
resolve(results);
} catch (e) {
console.log(`Error parsing JSON response: ${data}`);
reject(e);
}
}
});
},
);

Check failure

Code scanning / CodeQL

Server-side request forgery Critical

The
URL
of this request depends on a
user-provided value
.
@MikesGlitch MikesGlitch changed the title Merge sync-server into actual Move sync-server into Actual repo Feb 10, 2025
MatissJanis
MatissJanis previously approved these changes Feb 10, 2025
@MikesGlitch MikesGlitch merged commit ac08b87 into actualbudget:master Feb 10, 2025
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.