Extract cloud upload form helper

This commit is contained in:
2026-06-15 20:11:08 +02:00
parent 63f0cd1773
commit 9efb080202
4 changed files with 63 additions and 10 deletions

File diff suppressed because one or more lines are too long

View File

@@ -88,6 +88,11 @@ instead of `App::upload` and `App::download`, leaving the remaining cloud debt
focused on save-before-upload execution, upload form/response handling,
prompt/progress lifetime, OpenGL context guarding, downloaded-project open,
layer refresh, and action-history reset.
The retained upload-form setup is now also isolated behind a dedicated helper
in `src/legacy_cloud_services.cpp`, so the remaining cloud debt is further
concentrated on save-before-upload execution, response/error handling,
prompt/progress lifetime, OpenGL context guarding, downloaded-project open,
layer refresh, and action-history reset.
Recent 2026-06-13 retained preview reductions continue to narrow DEBT-0036:
`NodeStrokePreview::draw_stroke_immediate()` now also routes

View File

@@ -410,6 +410,41 @@ Completed Task Log:
| --- | --- | ---: | --- | --- |
| 2026-06-15 | ADP-009 | +1 legacy adapter retirement | `ctest --preset desktop-fast --build-config Debug -R "pp_app_core_document_cloud" --output-on-failure`; `MSBuild.exe out\build\windows-msvc-default\tests\pp_app_core_document_cloud_tests.vcxproj /p:Configuration=Debug /p:Platform=x64`; `MSBuild.exe out\build\windows-msvc-default\panopainter_app.vcxproj /p:Configuration=Debug /p:Platform=x64`; `.\out\build\windows-msvc-default\tests\Debug\pp_app_core_document_cloud_tests.exe` | `ccde4d69` |
### ADP-010 - Extract Cloud Upload Form Construction Helper
Status: Done
Score: no score movement
Debt: `DEBT-0038`
Scope: `src/legacy_cloud_services.cpp` only
Goal:
Extract the retained cloud upload form-construction code from
`execute_cloud_upload_transfer(...)` into a dedicated local helper so the live
upload path keeps less inline CURL setup while preserving current behavior.
Done Checks:
- Upload form construction no longer lives inline in
`execute_cloud_upload_transfer(...)`.
- Field naming, upload URL construction, TLS policy, progress callbacks, and
retained cloud execution behavior stay unchanged.
- `DEBT-0038` and the roadmap note the reduced remaining upload-form setup
surface.
Validation:
```powershell
ctest --preset desktop-fast --build-config Debug -R "pp_app_core_document_cloud" --output-on-failure
& 'C:\Program Files\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin\MSBuild.exe' out\build\windows-msvc-default\panopainter_app.vcxproj /p:Configuration=Debug /p:Platform=x64
```
Completed Task Log:
| Date | Task | Score | Validation | Commit |
| --- | --- | ---: | --- | --- |
| 2026-06-15 | ADP-010 | no score movement | `ctest --preset desktop-fast --build-config Debug -R "pp_app_core_document_cloud" --output-on-failure`; `MSBuild.exe out\build\windows-msvc-default\panopainter_app.vcxproj /p:Configuration=Debug /p:Platform=x64` | `(pending)` |
Completed Task Log:
| Date | Task | Score | Validation | Commit |

View File

@@ -43,6 +43,20 @@ int progress_callback_upload(void* clientp, curl_off_t dltotal,
return 0;
}
struct curl_httppost* create_cloud_upload_form(const std::string& filename)
{
struct curl_httppost* formpost = NULL;
struct curl_httppost* lastptr = NULL;
curl_formadd(&formpost,
&lastptr,
CURLFORM_COPYNAME, "fileToUpload",
CURLFORM_FILE, filename.c_str(),
CURLFORM_END);
return formpost;
}
void execute_cloud_download_transfer(
App& app,
std::string url,
@@ -102,18 +116,10 @@ void execute_cloud_upload_transfer(
}
CURL* curl;
struct curl_httppost* formpost = NULL;
struct curl_httppost* lastptr = NULL;
auto* formpost = create_cloud_upload_form(filename);
//curl_global_init(CURL_GLOBAL_ALL);
curl_formadd(&formpost,
&lastptr,
CURLFORM_COPYNAME, "fileToUpload",
CURLFORM_FILE, filename.c_str(),
CURLFORM_END);
curl = curl_easy_init();
std::string res;