Port two upstream PRs: - PR #1207: Replace manual chunked download loop with HTTPClient::writeToStream via a FileWriteStream adapter, improving reliability for OPDS file downloads including chunked transfers. - PR #1209: Add support for multiple OPDS servers with a new OpdsServerStore (JSON persistence with MAC-based password obfuscation), OpdsServerListActivity and OpdsSettingsActivity UIs, per-server credentials passed to HttpDownloader, web UI management endpoints, and migration from legacy single-server settings. Made-with: Cursor
This commit is contained in:
40
src/activities/settings/OpdsSettingsActivity.h
Normal file
40
src/activities/settings/OpdsSettingsActivity.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "OpdsServerStore.h"
|
||||
#include "activities/ActivityWithSubactivity.h"
|
||||
#include "util/ButtonNavigator.h"
|
||||
|
||||
/**
|
||||
* Edit screen for a single OPDS server.
|
||||
* Shows Name, URL, Username, Password fields and a Delete option.
|
||||
* Used for both adding new servers and editing existing ones.
|
||||
*/
|
||||
class OpdsSettingsActivity final : public ActivityWithSubactivity {
|
||||
public:
|
||||
/**
|
||||
* @param serverIndex Index into OpdsServerStore, or -1 for a new server
|
||||
*/
|
||||
explicit OpdsSettingsActivity(GfxRenderer& renderer, MappedInputManager& mappedInput,
|
||||
const std::function<void()>& onBack, int serverIndex = -1)
|
||||
: ActivityWithSubactivity("OpdsSettings", renderer, mappedInput), onBack(onBack), serverIndex(serverIndex) {}
|
||||
|
||||
void onEnter() override;
|
||||
void onExit() override;
|
||||
void loop() override;
|
||||
void render(Activity::RenderLock&&) override;
|
||||
|
||||
private:
|
||||
ButtonNavigator buttonNavigator;
|
||||
|
||||
size_t selectedIndex = 0;
|
||||
const std::function<void()> onBack;
|
||||
int serverIndex;
|
||||
OpdsServer editServer;
|
||||
bool isNewServer = false;
|
||||
|
||||
int getMenuItemCount() const;
|
||||
void handleSelection();
|
||||
void saveServer();
|
||||
};
|
||||
Reference in New Issue
Block a user