UI: Add per-profile browser panel cookie management
Allows the ability to switch cookies between profiles. Allows the ability to, for example, switch streaming service accounts between profiles for proper access to the pages displayed by the browser panels (such as chat windows).
This commit is contained in:
@@ -25,6 +25,10 @@
|
||||
#include "window-namedialog.hpp"
|
||||
#include "qt-wrappers.hpp"
|
||||
|
||||
extern void DestroyPanelCookieManager();
|
||||
extern void DuplicateCurrentCookieProfile(ConfigFile &config);
|
||||
extern void CheckExistingCookieId();
|
||||
|
||||
void EnumProfiles(std::function<bool (const char *, const char *)> &&cb)
|
||||
{
|
||||
char path[512];
|
||||
@@ -182,7 +186,7 @@ static bool CopyProfile(const char *fromPartial, const char *to)
|
||||
}
|
||||
|
||||
bool OBSBasic::AddProfile(bool create_new, const char *title, const char *text,
|
||||
const char *init_text)
|
||||
const char *init_text, bool rename)
|
||||
{
|
||||
std::string newName;
|
||||
std::string newDir;
|
||||
@@ -228,6 +232,12 @@ bool OBSBasic::AddProfile(bool create_new, const char *title, const char *text,
|
||||
config_set_string(App()->GlobalConfig(), "Basic", "ProfileDir",
|
||||
newDir.c_str());
|
||||
|
||||
if (create_new) {
|
||||
DestroyPanelCookieManager();
|
||||
} else if (!rename) {
|
||||
DuplicateCurrentCookieProfile(config);
|
||||
}
|
||||
|
||||
config_set_string(config, "General", "Name", newName.c_str());
|
||||
config.SaveSafe("tmp");
|
||||
config.Swap(basicConfig);
|
||||
@@ -380,7 +390,7 @@ void OBSBasic::on_actionRenameProfile_triggered()
|
||||
|
||||
/* Duplicate and delete in case there are any issues in the process */
|
||||
bool success = AddProfile(false, Str("RenameProfile.Title"),
|
||||
Str("AddProfile.Text"), curName.c_str());
|
||||
Str("AddProfile.Text"), curName.c_str(), true);
|
||||
if (success) {
|
||||
DeleteProfile(curName.c_str(), curDir.c_str());
|
||||
RefreshProfiles();
|
||||
@@ -446,6 +456,8 @@ void OBSBasic::on_actionRemoveProfile_triggered()
|
||||
config_set_string(App()->GlobalConfig(), "Basic", "ProfileDir",
|
||||
newDir);
|
||||
|
||||
DestroyPanelCookieManager();
|
||||
|
||||
config.Swap(basicConfig);
|
||||
InitBasicConfigDefaults();
|
||||
ResetProfileData();
|
||||
@@ -603,6 +615,8 @@ void OBSBasic::ChangeProfile()
|
||||
config_set_string(App()->GlobalConfig(), "Basic", "ProfileDir",
|
||||
newDir);
|
||||
|
||||
DestroyPanelCookieManager();
|
||||
|
||||
config.Swap(basicConfig);
|
||||
InitBasicConfigDefaults();
|
||||
ResetProfileData();
|
||||
|
Reference in New Issue
Block a user