Skip to content
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

fix(AccountSession): load custom emoji with auth from GTS #528

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ public void onError(ErrorResponse errorResponse) {
}

private void updateInstanceEmojis(Instance instance, String domain){
new GetCustomEmojis()
GetCustomEmojis req=(GetCustomEmojis) new GetCustomEmojis()
.setCallback(new Callback<>(){
@Override
public void onSuccess(List<Emoji> result){
Expand All @@ -419,8 +419,14 @@ public void onError(ErrorResponse error){
wrapper.instance = instance;
MastodonAPIController.runInBackground(()->writeInstanceInfoFile(wrapper, domain));
}
})
.execNoAuth(domain);
});
if(instance.isGoToSocial()) {
// GTS requires auth for emojis
// https://github.com/superseriousbusiness/gotosocial/issues/2794
req.exec(lastActiveAccountID);
return;
}
req.execNoAuth(domain);
}

private File getInstanceInfoFile(String domain){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.joinmastodon.android.model;

import android.text.Html;
import android.text.TextUtils;
import android.util.Log;

import org.joinmastodon.android.api.ObjectValidationException;
Expand Down Expand Up @@ -91,6 +92,13 @@ public class Instance extends BaseModel{

public PleromaPollLimits pollLimits;

/**
* Url to the source code of the instance.
*
* Only found on GoToSocial instances
*/
public String sourceUrl;

/** like uri, but always without scheme and trailing slash */
public transient String normalizedUri;

Expand Down Expand Up @@ -154,6 +162,13 @@ public boolean isPixelfed() {
return version.contains("compatible; Pixelfed");
}

/**
* @return `true` if the instance is a GoToSocial instance
*/
public boolean isGoToSocial() {
return TextUtils.equals(sourceUrl, "https://github.com/superseriousbusiness/gotosocial");
}

public boolean hasFeature(Feature feature) {
Optional<List<String>> pleromaFeatures = Optional.ofNullable(pleroma)
.map(p -> p.metadata)
Expand Down
Loading