Skip to content

Add package uploading feature #1435

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

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

Oksamies
Copy link
Contributor

No description provided.

Copy link
Contributor Author

Oksamies commented Mar 25, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@Oksamies Oksamies force-pushed the 03-25-add_package_uploading_feature branch 2 times, most recently from a271640 to 6e1e6bd Compare March 26, 2025 19:44
@Oksamies Oksamies force-pushed the 03-25-add_package_uploading_feature branch from 09696da to 15bef47 Compare April 3, 2025 17:57
}
},
// eslint-disable-next-line @typescript-eslint/no-unused-vars
(_error) => {

Check failure

Code scanning / ESLint

Disallow unused variables Error

'_error' is defined but never used.

Copilot Autofix

AI 10 days ago

To fix the issue, we will remove the _error parameter from the .then callback function. Since the error is not being used, its removal will not affect the functionality of the code. Additionally, we will remove the eslint-disable-next-line comment on line 404, as it will no longer be necessary once the unused variable is removed.


Suggested changeset 1
apps/cyberstorm-remix/app/upload/upload.tsx

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/apps/cyberstorm-remix/app/upload/upload.tsx b/apps/cyberstorm-remix/app/upload/upload.tsx
--- a/apps/cyberstorm-remix/app/upload/upload.tsx
+++ b/apps/cyberstorm-remix/app/upload/upload.tsx
@@ -403,4 +403,3 @@
         },
-        // eslint-disable-next-line @typescript-eslint/no-unused-vars
-        (_error) => {
+        (/* error */) => {
           setSubmissionError({
EOF
@@ -403,4 +403,3 @@
},
// eslint-disable-next-line @typescript-eslint/no-unused-vars
(_error) => {
(/* error */) => {
setSubmissionError({
Copilot is powered by AI and may make mistakes. Always verify output.
@Oksamies Oksamies force-pushed the 03-25-add_package_uploading_feature branch from c432dc4 to 5df93c0 Compare April 24, 2025 01:18
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
return new Promise((resolve, _reject) => {

Check failure

Code scanning / ESLint

Disallow unused variables Error

'_reject' is defined but never used.

Copilot Autofix

AI about 1 month ago

To fix the problem, we can remove the unused _reject parameter from the Promise constructor on line 62. Since _reject is not used anywhere in the function body, its removal will not affect the functionality of the calculateMD5 method. This change will also satisfy the ESLint rule and eliminate the warning.

Suggested changeset 1
packages/ts-uploader/src/workers/MD5WorkerManager.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/ts-uploader/src/workers/MD5WorkerManager.ts b/packages/ts-uploader/src/workers/MD5WorkerManager.ts
--- a/packages/ts-uploader/src/workers/MD5WorkerManager.ts
+++ b/packages/ts-uploader/src/workers/MD5WorkerManager.ts
@@ -60,4 +60,3 @@
 
-    // eslint-disable-next-line @typescript-eslint/no-unused-vars
-    return new Promise((resolve, _reject) => {
+    return new Promise((resolve) => {
       worker!.onmessage = (event: MessageEvent) => {
EOF
@@ -60,4 +60,3 @@

// eslint-disable-next-line @typescript-eslint/no-unused-vars
return new Promise((resolve, _reject) => {
return new Promise((resolve) => {
worker!.onmessage = (event: MessageEvent) => {
Copilot is powered by AI and may make mistakes. Always verify output.
@Oksamies Oksamies force-pushed the 03-25-add_package_uploading_feature branch 2 times, most recently from 1b2cfc6 to 97b6fb4 Compare May 8, 2025 11:49
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

ESLint found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Oksamies added 12 commits May 27, 2025 12:59
… and better usability

The goal of these changes is to move the thunderstore-api package towards a state where it reflects the Django API endpoints better.

Additionally one of the more important changes is the; moving of result parsing responsibility to be on thunderstore-api package.
As thunderstore-api now does the parsing of the results; dapper-ts doesn't have to do it anymore.
Additionally add methods for submitting package submission and polling the state of submissions
The end result of the refactoring should reflect the previous changes to thunderstore-api
@Oksamies Oksamies force-pushed the 03-25-add_package_uploading_feature branch from a23db98 to 3a059f4 Compare May 27, 2025 10:35
HTMLInputElement,
SelectSearchProps
// eslint-disable-next-line @typescript-eslint/no-unused-vars
>(function SelectSearch(props, _forwardedRef) {

Check failure

Code scanning / ESLint

Disallow unused variables Error

'_forwardedRef' is defined but never used.

Copilot Autofix

AI 10 days ago

To fix the issue, we should remove the unused _forwardedRef parameter from the SelectSearch function. Since it is not used anywhere in the function body, its removal will not affect the existing functionality. Additionally, the ESLint directive // eslint-disable-next-line @typescript-eslint/no-unused-vars on line 76 can also be removed, as it will no longer be necessary.

Suggested changeset 1
packages/cyberstorm/src/newComponents/SelectSearch/SelectSearch.tsx

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/cyberstorm/src/newComponents/SelectSearch/SelectSearch.tsx b/packages/cyberstorm/src/newComponents/SelectSearch/SelectSearch.tsx
--- a/packages/cyberstorm/src/newComponents/SelectSearch/SelectSearch.tsx
+++ b/packages/cyberstorm/src/newComponents/SelectSearch/SelectSearch.tsx
@@ -75,4 +75,3 @@
   SelectSearchProps
-  // eslint-disable-next-line @typescript-eslint/no-unused-vars
->(function SelectSearch(props, _forwardedRef) {
+>(function SelectSearch(props) {
   const {
EOF
@@ -75,4 +75,3 @@
SelectSearchProps
// eslint-disable-next-line @typescript-eslint/no-unused-vars
>(function SelectSearch(props, _forwardedRef) {
>(function SelectSearch(props) {
const {
Copilot is powered by AI and may make mistakes. Always verify output.
};

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const rejectAndRemoveListener = (reason: any) => {

Check failure

Code scanning / ESLint

Disallow the `any` type Error

Unexpected any. Specify a different type.

Copilot Autofix

AI 10 days ago

To fix the issue, we need to replace the any type with a more specific type for the reason parameter in the rejectAndRemoveListener function. Since promises can be rejected with various types of values, we can use a union type such as unknown | Error to cover common cases. Alternatively, if the application has a specific set of expected rejection reasons, we can define a custom type for them. For this fix, we will use unknown as it is a safer alternative to any and still allows flexibility.

Suggested changeset 1
packages/graph-system/src/executor.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/graph-system/src/executor.ts b/packages/graph-system/src/executor.ts
--- a/packages/graph-system/src/executor.ts
+++ b/packages/graph-system/src/executor.ts
@@ -62,3 +62,3 @@
     // eslint-disable-next-line @typescript-eslint/no-explicit-any
-    const rejectAndRemoveListener = (reason: any) => {
+    const rejectAndRemoveListener = (reason: unknown) => {
       if (stopExecutionListener) {
EOF
@@ -62,3 +62,3 @@
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const rejectAndRemoveListener = (reason: any) => {
const rejectAndRemoveListener = (reason: unknown) => {
if (stopExecutionListener) {
Copilot is powered by AI and may make mistakes. Always verify output.
const uniqueId = "test-id";

// Mock worker response
const mockResponse = {

Check failure

Code scanning / ESLint

Disallow unused variables Error test

'mockResponse' is assigned a value but never used.

Copilot Autofix

AI 10 days ago

To fix the problem, we should remove the unused variable mockResponse from the code. This will eliminate the ESLint error and clean up the code. Since mockResponse is not used, its removal will not affect the functionality of the test.

Suggested changeset 1
packages/ts-uploader/src/workers/__tests__/MD5WorkerManager.test.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/ts-uploader/src/workers/__tests__/MD5WorkerManager.test.ts b/packages/ts-uploader/src/workers/__tests__/MD5WorkerManager.test.ts
--- a/packages/ts-uploader/src/workers/__tests__/MD5WorkerManager.test.ts
+++ b/packages/ts-uploader/src/workers/__tests__/MD5WorkerManager.test.ts
@@ -52,7 +52,3 @@
       // Mock worker response
-      const mockResponse = {
-        type: "complete",
-        md5: "mock-md5-hash",
-        uniqueId,
-      };
+
 
EOF
@@ -52,7 +52,3 @@
// Mock worker response
const mockResponse = {
type: "complete",
md5: "mock-md5-hash",
uniqueId,
};


Copilot is powered by AI and may make mistakes. Always verify output.
const uniqueId = "test-id";

// Mock worker error response
const mockError = {

Check failure

Code scanning / ESLint

Disallow unused variables Error test

'mockError' is assigned a value but never used.

Copilot Autofix

AI 10 days ago

To fix the issue, we should either use the mockError variable in the test case or remove it if it is not needed. Since the test case is about handling worker errors, it is likely that the intention was to use mockError to simulate an error response from the worker. We can fix the issue by modifying the onmessage handler to use mockError and ensure the test case properly validates the error handling logic.


Suggested changeset 1
packages/ts-uploader/src/workers/__tests__/MD5WorkerManager.test.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/ts-uploader/src/workers/__tests__/MD5WorkerManager.test.ts b/packages/ts-uploader/src/workers/__tests__/MD5WorkerManager.test.ts
--- a/packages/ts-uploader/src/workers/__tests__/MD5WorkerManager.test.ts
+++ b/packages/ts-uploader/src/workers/__tests__/MD5WorkerManager.test.ts
@@ -90,2 +90,3 @@
           mockWorker.onmessage = null;
+          mockWorker.postMessage(mockError); // Simulate error response
         }
EOF
@@ -90,2 +90,3 @@
mockWorker.onmessage = null;
mockWorker.postMessage(mockError); // Simulate error response
}
Copilot is powered by AI and may make mistakes. Always verify output.
Evidently it's a new feature and required for non-localhost hosts
Oksamies added 3 commits May 27, 2025 15:53
The session implementation is still super flaky (sowwy :3), as a result when me (Oksamies) added a session clearing function to prevent non-logged in users to access the new upload page; was ran when no currentUser was detected: the apihost was removed from the session.

This commit quick fixes the issue, but more concise planning of the session architecture needs to be done.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant