Skip to content

Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.

Member sign-in as one call: startMemberSignIn(onDone(member)); Member or Studio wording

islandmed07e9fda60222
diff --git a/src/app/App.h b/src/app/App.h
index 209d0295..674f2db6 100644
--- a/src/app/App.h
+++ b/src/app/App.h
@@ -1324,10 +1324,14 @@ private:
// (from the keychain, refreshed when it has run out; false and `signedOut` when the sign-in is gone).
static void checkMemberBuilds(MemberAuth& auth, UpdateJob& job);
static bool memberAccessToken(MemberAuth& auth, std::string& token, std::string& error, bool& signedOut);
- void startMemberSignIn();
+ // The one member sign-in (GitHub device flow; Preferences > Updates and the membership card's "I'm already a
+ // member" both use it): `onDone(member)` runs on the main thread when it ends: true = signed in with an account
+ // that can see member builds (memberBuilds_ is then true); false = not a member, declined, failed or cancelled.
+ void startMemberSignIn(std::function<void(bool member)> onDone = {});
void memberSignOut();
std::shared_ptr<MemberAuth> memberAuth_;
std::shared_ptr<MemberSignIn> memberSignIn_;
+ std::function<void(bool member)> memberSignInDone_;
bool memberBuilds_ = false; // signed in (and the token is in the keychain); saved in the preferences
std::string memberLogin_; // the GitHub login shown ("Signed in as ..."); saved; not a secret
bool memberSessionOnly_ = false; // signed in, but no keychain kept it: not saved, gone at quit
diff --git a/src/app/PanelUpdate.cpp b/src/app/PanelUpdate.cpp
index 25f4cd08..151d9aa4 100644
--- a/src/app/PanelUpdate.cpp
+++ b/src/app/PanelUpdate.cpp
@@ -161,6 +161,10 @@ void App::tickSelfUpdate() {
} else if (!job->cancel) {
memberStatus_ = "Couldn't sign in: " + job->error;
}
+ if (auto done = std::move(memberSignInDone_)) {
+ memberSignInDone_ = nullptr;
+ done(job->ok);
+ }
}
if (confirmStartAt_ > 0.0 && nowSeconds() >= confirmStartAt_) {
confirmStartAt_ = 0.0;
@@ -458,8 +462,18 @@ void App::checkMemberBuilds(MemberAuth& auth, UpdateJob& job) {
}
}
-void App::startMemberSignIn() {
- if (memberSignIn_ && !memberSignIn_->done) return;
+void App::startMemberSignIn(std::function<void(bool member)> onDone) {
+ if (memberSignIn_ && !memberSignIn_->done) { // one at a time: a second caller hears the same outcome
+ if (onDone) {
+ auto first = std::move(memberSignInDone_);
+ memberSignInDone_ = [first, onDone](bool member) {
+ if (first) first(member);
+ onDone(member);
+ };
+ }
+ return;
+ }
+ memberSignInDone_ = std::move(onDone);
if (!memberAuth_) memberAuth_ = std::make_shared<MemberAuth>();
auto job = std::make_shared<MemberSignIn>();
memberSignIn_ = job;
@@ -514,7 +528,7 @@ void App::startMemberSignIn() {
r = memberGet(member::kReleasesUrl, tokens.access, 4u << 20);
if (r.status != 200) {
job->error = r.status == 404 || r.status == 403
- ? "this GitHub account has no access to member builds (Insider or Studio membership, "
+ ? "this GitHub account has no access to member builds (Member or Studio membership, "
"with the invitation to the member repository accepted)"
: r.error.empty() ? "GitHub answered " + std::to_string(r.status) : r.error;
return; // (the token is dropped)
@@ -551,7 +565,7 @@ void App::drawMemberBuildsSection() {
ImGui::Spacing();
ImGui::SeparatorText(tr("Member builds"));
ui::HelpText("Member builds", nullptr,
- "Insider and Studio members get each release early. Sign in with the GitHub account that has the "
+ "Member and Studio members get each release early. Sign in with the GitHub account that has the "
"invitation to the member repository: SculptForge then also offers the member builds, checked with "
"the same signature as every release. The sign-in can only read that repository's releases; it is "
"kept in your system's keychain and Sign out removes it.",
diff --git a/src/core/MemberBuilds.h b/src/core/MemberBuilds.h
index 65b5c817..1785b3de 100644
--- a/src/core/MemberBuilds.h
+++ b/src/core/MemberBuilds.h
@@ -1,8 +1,8 @@
// SculptForge - open source digital sculpting
// SPDX-License-Identifier: GPL-3.0-or-later
//
-// Member builds: Insider and Studio members are read collaborators on the private repository
-// islandmed/sculptforge-insiders, where the Insider previews are published. Preferences > Updates > Member builds
+// Member builds: Member and Studio members are read collaborators on the private repository
+// islandmed/sculptforge-insiders, where the members' betas are published. Preferences > Updates > Member builds
// signs in with GitHub's device flow for the GitHub App "SculptForge Member Builds", which is installed only on that
// repository with Contents: read. Its user-to-server token reaches only repositories both the app and the user can
// access, so it can read that repository's releases and nothing else. No server of ours, no client secret (the