Second fix for MIME64 inconsistency in serverKey.
The previous fix https://github.com/mastodon/mastodon-android/pull/486 would break any connections to any instances using WEB_SAFE MIME64 encoding on the serverKey, which actually appears to be the usual case. This update reverts to the previous logic, but also converts standard MIME64 characters ('/' and '+') to their WEB_SAFE equivalents. This ensures the standard case of WEB_SAFE BASE64 serverKeys and the anomolous case of DEFAULT BASE64 keys both work.
This commit is contained in:
parent
7ed1b164b5
commit
def4960be6
|
@ -162,7 +162,9 @@ public class PushSubscriptionManager{
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(PushSubscription result){
|
public void onSuccess(PushSubscription result){
|
||||||
MastodonAPIController.runInBackground(()->{
|
MastodonAPIController.runInBackground(()->{
|
||||||
serverKey=deserializeRawPublicKey(Base64.decode(result.serverKey, Base64.DEFAULT));
|
result.serverKey=result.serverKey.replace('/','_');
|
||||||
|
result.serverKey=result.serverKey.replace('+','-');
|
||||||
|
deserializeRawPublicKey(Base64.decode(result.serverKey, Base64.URL_SAFE));
|
||||||
|
|
||||||
AccountSession session=AccountSessionManager.getInstance().tryGetAccount(accountID);
|
AccountSession session=AccountSessionManager.getInstance().tryGetAccount(accountID);
|
||||||
if(session==null)
|
if(session==null)
|
||||||
|
|
Loading…
Reference in New Issue