Ionic support in MSAL Browser

Now that MSAL 2 has shipped this should be re-opened - currently there is no viable way to use MSAL with Ionic apps that are intended for both browser and native, and I imagine this is the same of other hybrid frameworks
Originally posted by @jjgriff93 in https://github.com/AzureAD/microsoft-authentication-library-for-js/issues/1439#issuecomment-672944505

@marshall86 : I transferred the issue to the MSAL.js repo.

@jasonnutter why this issue is been closed?

@marshall86 Sorry, our bot autoclosed this because it didnt have the correct template once I marked it as a feature request. Unfortunately, we have been busy with other higher priority work, and have not been able to prioritize Ionic support. I'll keep this open for tracking.

alright, i understand, but this is still a priority for many like myself encountering this issue...

any solution or workaround for this problem?

You can handle it manually by using capacitor deeplink

@chuannguyen1208 you have a full solution for me?

Solution for what ?
On Tue, 24 Jan 2023 at 18:55 Yannickvandenbos @.***>
wrote:

@chuannguyen1208 https://github.com/chuannguyen1208 you have a full
solution for me?
—
Reply to this email directly, view it on GitHub
https://github.com/AzureAD/microsoft-authentication-library-for-js/issues/4290#issuecomment-1401816990,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AWMLUNXDTYI5YZR4EY4HBC3WT67MBANCNFSM5JCUP4AQ
.
You are receiving this because you were mentioned.Message ID:
<AzureAD/microsoft-authentication-library-for-js/issues/4290/1401816990@
github.com>

@chuannguyen1208 getting a the token from the callback in a capacitor app

Any updates on this?

Continuing on this as it's still open and my issue seems related.
First of all, currently, MSAL seems working well in an IONIC env (V7 here). I'm using the InAppBrowser cordova plugin to handle the loginRedirect. In this case, we're using a B2C tenant, but afaik, it should be working with classic AD aswell.
Providing conf at the end of this comment for those that are interested.
My issue is that in my app, I need to be dealing with multiple user flows. Auth, EditProfile, ChangePassword.
I saw some examples on the official doc, and tried to port them to Ionic. Basically, calling the acquireTokenRedirect method, while providing a different authority :
const handleEditProfile = instance
  .acquireTokenRedirect({
    authority: import.meta.env.VITE_AUTH_EDIT_PROFILE,
  })

InAppBrowser opens the correct page, but here start my problems:

User is not authentified, I have to provide again email/password (still, I can continue the process, but basically, on a PWA, user stays authentified, so something is missing here)
When user confirms, he's well redirected to app but with a new token. I tried setting this new token as the active account in msal instance but still, user gets disconnected after a few seconds

From what I understand (more a guess tbh ^^), this new token is not valid in my auth context (authentication flow VS editprofile flow)
From what I witnessed, PublicClientApplication is not receiving the same events between PWA and Android after a profile edit:
// PWA
// First event
type:  msal:acquireTokenSuccess
payload.account: edit profile account (the HomeAccountId contains flow uri)

// Second event
type:  msal:acquireTokenSuccess
payload.account: authentication account (the HomeAccountId contains flow uri)

// Android
// Just one event
type: msal:loginSuccess
payload.account: edit profile account (the HomeAccountId contains flow uri)

All this seems related to the fact that auth is lost when opening the flow in the InAppBrowser (new auth required). Is there a way to avoid that ?
I thought it could be related to some missing cookies, but even tho I remove them on the PWA (remove cookies manually and refresh edit profile page) I still goes back to app, getting those acquireTokenSuccess events even tho I had to login again on the profile page.
I tried to put as much insights I could, hope it'll help. Feel free to ask for more if needed.
Working auth conf
/**  AuthProvider.jsx */

const configuration = {
  auth: {
    authority: import.meta.env.VITE_AUTH_AUTHORITY,
    knownAuthorities: [import.meta.env.VITE_AUTHORITY_DOMAIN],
    clientId: import.meta.env.VITE_CLIENT_ID,
    redirectUri: import.meta.env.VITE_REDIRECT_URI,
    postLogoutRedirectUri: `${import.meta.env.VITE_REDIRECT_URI}/logout`,
  },
  cache: {
    cacheLocation: 'localStorage',
    storeAuthStateInCookie: false,
  },
};

export const pca = new PublicClientApplication(configuration);
pca.addEventCallback((event) => {
  if (
    event.eventType === EventType.LOGIN_SUCCESS ||
    event.eventType === EventType.SSO_SILENT_SUCCESS ||
    event.eventType === EventType.ACQUIRE_TOKEN_SUCCESS
  ) {
    pca.setActiveAccount(event.payload.account);
  }
});

pca.setNavigationClient(new AuthenticationNavigationClient(pca));

const AuthProvider = ({ children }) => (
  <MsalProvider instance={pca}>{children}</MsalProvider>
);

/** AuthenticationNavigationClient.js */
class AuthenticationNavigationClient extends NavigationClient {
  constructor(msalInstance) {
    super();
    this.msalInstance = msalInstance;
  }

  async navigateExternal(url, options) {
    if (Capacitor.isNativePlatform()) {
      const browser = InAppBrowser.create(url, '_blank', {
        location: 'no',
        hidenavigationbuttons: 'yes',
        clearcache: 'yes',
        clearsessioncache: 'yes',
        hideurlbar: 'yes',
        fullscreen: 'yes',
        shouldPauseOnSuspend: 'yes',
        toolbar: 'no',
        zoom: 'no',
      });
      browser.on('loadstart').subscribe((event) => {
        if (
          event.url.includes('#state')
        ) {
          browser.close();
          const domain = event.url.split('#')[0];
          const updatedUrl = event.url.replace(domain, 'https://localhost');
          this.msalInstance.handleRedirectPromise(updatedUrl).catch((err) => {
            // FIXME what we gonna do if error here
            console.log(err);
          });
        }
        if (event.url.includes('/logout')) {
          browser.close();
          window.location.replace('/logout');
        }
      });
    } else if (options.noHistory) {
      window.location.replace(url);
    } else {
      window.location.assign(url);
    }
    return true;
  }
}

@EmLauber any update on this?

We do not currently have plans to build support for Ionic but are tracking interest through this issue and appreciate those that have commented with their interest. I will update this thread if we add support.
I'll add that MSAL.Browser is intended for single page applications in browsers, not native mobile scenarios. If you are looking to build an application for Android, I recommend MSAL for Android for authentication needs

@EmLauber I totally understand that. It's legit. But could you explain a bit more what can cause above issues so I could try to fix by myslef ? I mean, the same requests go back and forth, in a browser env (not the same tho)
So what could be the source of making this not behave the same?  Cookies? Headers? Any hint would be appreciated so I could deal with all your magic not happening ^^

@Boimb
For what it's worth, here is a solution i'm using to succesfully authenticate users in my ionic app:
`  const handleLogin = async () => {
App.addListener("appUrlOpen", (data) => {
if (data.url.startsWith("msauth")) {
const urlObject = new URL(data.url);
const hash = urlObject.hash.substring(1);
const params = new URLSearchParams(hash);
const accessToken = params.get("access_token");
    saveToStorage("jwt", accessToken!);

    Browser.close();

    setAuthenticated!();
  }
});

await Browser.open({
  url: "https://login.microsoftonline.com/${YOUR_TENTANT_ID}/oauth2/v2.0/authorize?client_id=${YOUR_CLIENT_ID}&response_type=token&redirect_uri=${YOUR_REDIRECT_URI_TO_APP}&scope=${YOUR_AD_SCOPE}”,
});

};`

Thx @Yannickvandenbos ! I already have successful auth working as mentionned here
What I'm struggling with is dealing with multiple user flows, not only auth. eg "change password", "edit profile"

Hi guys, currently i am working with SPA application with angular codebase where i implemented Msal but while using ionic cordova as a wrapper and run in iOS device after completing sso login flow at the time of redirect back to our app i am getting error server is unable to connect my redirecturl = http://localhost:4200/login. is there any way to return back to our app after login to sso in iOS device.

Hi,
I´m try developer a application angular ionic with msal (Azure AD), login web is working well, but login in android app not working.
After introduce credentials redirect to /home but res in msalInstance.handleRedirectPromise is null, and not login (this.authService.instance.getAllAccounts().length == 0).
Try with authRedirectUri: 'capacitor://localhost/home', (redirect to /home but not login)
and with authRedirectUri: 'http://localhost:8100', (open in system browser and error)
Output (Android studio with physical device):
Line 1 - Msg: --> login success 0
Line 1 - Msg: estoy en el else
Line 1 - Msg: res:  null
I have a CustomNavigationClient.ts for login android
import { Injectable } from '@angular/core';
import { InAppBrowser } from '@awesome-cordova-plugins/in-app-browser/ngx';
import { MsalService } from '@azure/msal-angular';
import type { IPublicClientApplication } from "@azure/msal-browser";
import { NavigationClient } from "@azure/msal-browser";
import { Capacitor } from "@capacitor/core";

@Injectable({ providedIn: 'root' })
export class CustomNavigationClient extends NavigationClient {

  private msalInstance: IPublicClientApplication;

  constructor(
    private iab: InAppBrowser,
    private authService: MsalService,
  ) {
    super();
    this.msalInstance = this.authService.instance;
  }

  override async navigateExternal(url: string, options: any) {
    // Cordova implementation
    if (Capacitor.isNativePlatform()) {
      console.log('ES PLATAFORMA NATIVA');

      var browser = this.iab.create(url, '_blank',
        {
          location: "yes",
          hidenavigationbuttons: "yes",
          clearcache: "yes",
          clearsessioncache: "yes",
          hideurlbar: "yes",
          fullscreen: "yes",
          shouldPauseOnSuspend: 'yes',
          toolbar: 'no',
          zoom: 'no',
        });

      browser.on('loadstart').subscribe(event => {
        if (event.url.includes('#code')) {
          browser.close();
          const domain = event.url.split('#')[0];

          const authCode = event.url.split('#code=')[1].split('&client_info')[0];

          //const url = event.url.replace(domain, 'capacitor://localhost/home');
          const url = `capacitor://localhost/home#code=${authCode}`;

          console.log('will redirect to:', url);
          //window.location.href = url;

          this.msalInstance
            .handleRedirectPromise(url)
            .then((res) => {
              console.log('res: ', res); //here res is null
              console.log('res account: ', res?.account);
              console.log(res?.account?.name + " has authenticated");

              window.location.href = url;
            })
            .catch((err) => {
              console.log('Hay error en handleRedirectPromise');
              console.log(err);
            });

        }
      });

    } else {
      console.log('NO es plataforma nativa');
      if (options.noHistory) {
        window.location.replace(url);
      } else {
        window.location.assign(url);
      }
    }
    return true;
  }
}

home.page.ts
import { InAppBrowser } from '@awesome-cordova-plugins/in-app-browser/ngx';
import { MsalBroadcastService, MsalService } from '@azure/msal-angular';

...
export class HomePage {
  isLogin: boolean = false;

  constructor(
      private authService: MsalService,
      private broadcastService: MsalBroadcastService,
      private iab: InAppBrowser,
      //private msalInstance: IPublicClientApplication
    ) {
      this.authService.instance.setNavigationClient(new CustomNavigationClient(this.iab, this.authService));
  }

  ngOnInit() {
    this.broadcastService.inProgress$
      .pipe(
        filter((status: InteractionStatus) => status === InteractionStatus.None)
      )
      .subscribe(() => {
        console.log('--> login success 0'); //here when login
        this.setLoginDisplay();
      });
  }

  login() {
    this.authService.loginRedirect();
  }

  setLoginDisplay() {
    this.isLogin = this.authService.instance.getAllAccounts().length > 0

    if (this.authService.instance.getAllAccounts().length > 0) {
      console.log(this.authService.instance.getAllAccounts()[0])
      this.accountInfo = this.authService.instance.getAllAccounts()[0] as AccountInfo;
      console.log(this.accountInfo.username)
    } else {
      //here when login
      console.log('estoy en el else');
    }
  }

}

package.json:
"@angular/core": "^16.0.0",
"@awesome-cordova-plugins/in-app-browser": "^6.6.0",
"@azure/msal-angular": "^3.0.13",
"@azure/msal-browser": "^3.10.0",
"@capacitor/core": "5.6.0",
"@ionic/angular": "^7.0.0",
"cordova-plugin-inappbrowser": "^6.0.0",

I post here, because it is related with this issue, I think.
Can you help me? thanks!

@Boimb For that, I don't have a solution.
I've recently transferred my apps from Ionic React to React Native and it's a bliss. Expo has out of the box solutions for Azure AD and other authentication methods. From my experience certain support, like MSAL, is not great for the ionic framework.

With react native working login in web, android and ios?
Please can you tell me where I can see an example for try it?
Thanks!

I'd suggest you to switch to Auth0, it's easy to implement and free in some cases


added Mapper methods and granularity for marshalling

Simplified my previous implementation such that it doesn't use enums and doesn't modify any public facing API's.
To properly preserve backwards compatibility, my new method must delegate to the extra-arg free one, such that the chain of wrappers, on a call to the new method, also includes calling the old method. Since the method is looking for any positive result (ie, once anybody returns true in any context we're done), the solution to this was simply to have
public boolean isImmutableType(Class typeName, boolean includeBackwardsCompatible){
    return isImmutableType(typeName) || wrapped.isImmutableType(typeName, includeBackwardsCompatible)
}

This has the effect of invoking any user-written backwards-compatible-agnostic code to look for a result, and then look through the defaults in the proper scope.
The one issue I have with this implementation is that the performance of the Mapper.isImmutableType(Class, boolean) is porportional to the square of the number of wrappers.
For example, if we have:

StringeyMapper extends MapperWrapper
DomainishMapper extends MapperWrapper
ImmutableMapper extends MapperWrapper

and we get them wrapped in the sequence
StringeyMapper delegates to DomainishMapper delegates to ImmutableMapper delegates to defaultMapper
then the call stack would be

caller
call-site

consumer
stringyMapper.isImmutableType(t, true)

stringyMapper
stringyMapper.isImmutableType(t)

stringyMapper
domainishMapper.isImmutableType(t)

domainishMapper
immutableMapper.isImmutableType(t)

immutableMapper
defaultMapper.isImmutableType(t)

immutableMapper
1-arg method on defaultMapper returns

domainishMapper
1-arg method on immutableMapper returns

stringyMapper
1-arg method on domainishMapper returns

stringyMapper
domainishMapper.isImmutableType(t, true)

domainishMapper
redundantly domainishMapper.isImmutableType(t)

domainishMapper
redundantly immutableMapper.isImmutableType(t)

immutableMapper
redundantly defaultMapper.isImmutableType(t)

immutableMapper
1-arg method on defaultMapper returns

domainishMapper
1-arg method on immutableMapper returns

domainishMapper
immutableMapper.isImmutableType(t, true)

immutableMapper
redundantly immutableMapper.isImmutableType(t)

immutableMapper
redundantly defaultMapper.isImmutableType(t)

immutableMapper
1-arg method on defaultMapper returns

immutableMapper
defaultMapper.isImmutableType(t, true);

immutableMapper
2-arg method on defaultMapper returns

domainishMapper
2-arg method on immutableMapper returns

stringeyMapper
2-arg method on domainishMapper returns

consumer
2-arg method on stringeyMapper returns

If I'm not mistaken this should be equal to numWrappers ^2  /2, but 13 != 8 so I might be mistaken.
This means that any user-written code for Types must be re-entrant, which was not a requirement before (though no sane implementation wouldn't be). Further it means a user that puts a break-point inside his isIMmutableType overload is going to see it hit alot more frequently, though that doesn't seem like too much of a concern to me.
A bigger concern to me was performance: all those extra calls might make a negative impact on performance. To test this I created an array list of 1,000,000 ints, and implemented a solution that kept a map of currently-inspected types which it referenced, so as to remove the redundant calls. This implementation was slightly slower than the implementation that had the redundant calls, so performance appears not to be an issue, unless I made an error in writing the performance test.
using the test
        ArrayList<Integer> ints = new ArrayList<>();
        for(int i = 0; i < 1_000_000; i++){
            ints.add(i);
        }

        StopWatch watch = new StopWatch();
        watch.start();
        String document = xstream.toXML(ints);
        System.out.println("took " + watch.getTime() + "ms to serialize");
        watch.stop();
        watch.reset();
        watch.start();

        Object result = xstream.fromXML(document);
        System.out.print("took " + watch.getTime() + "ms to deserialize");

and the following to address the problem
//as a static field --ThreadLocal's have been around since java 1.2, and anonymous classes since 1.1
private static final ThreadLocal<Set<Class>> inspectingTypes = new ThreadLocal<Set<Class>>(){
    protected Set<Class> initialValue() { return new HashSet<>(); }
};

//in the isImmutableType(Class, boolean) method
Set<Class> classCallStack = inspectingTypes.get();

if( ! classCallStack.contains(type)) try {
    classCallStack.add(type);

    return isImmutableValueType(type)
            || wrapped.isImmutableValueType(type, includeBackwardsCompatibleTypes);
}
finally{
    classCallStack.remove(type);
}
else{
    return wrapped.isImmutableValueType(type, includeBackwardsCompatibleTypes);
}

I got

scenario
serialization time
deserialization time

with the problem
931ms
1720ms

without the problem
928ms
1672ms

with the wierd stack-set fix
948ms
1722ms

which to me means its all a wash, thus probably just accepting these extra calls is OK.

tagging @joehni for review!

I've completely screwed this up. Need to work on my boolean algebra.

OK, so I added a test to proove that the unmarshalling class does keep references when in backwards compatible mode, which was the problem I believe I was having.

Hi Geoff, IMHO it is still too complicated. Let's reiterate for a moment:
Basically we want to avoid the memory consuming references to the unmarshalled objects. Nothing changes while marshalling. The only problem is that XML written with older versions of XStream may contain such a reference and cannot be unmarshalled anymore. Therefore we need a configuration, which types have to be referenced at unmarshalling time.
The only question of the unmarshaller is now, do I have to keep a reference? The only way to access the configuration is the Mapper, so it requires a (new) method isReferenceable(Class type).
With the ImmutableMapper you've found the best place to keep this information. And we need a way to set the flag, e.g. by adding an overloaded addImmutableType(Class type, boolean referenceable) to the XStream facade.
I do not see any necessity that the new method of the mapper is connected with the method isImmutableType. And the only one requesting the information is currently the AbstractReferenceUnmarshaller. All we have to do is a default for XStream.addImmutableType with the flag set to true (i.e. type is referenceable) and add any type in setupImmutableTypes that was already declared immutable in XStream version < 1.4.0 with the flag set to false.
BTW: XStream master requires Java 1.6. So you have to keep all the generics and @Override annotations. They can be backported in a binary compatible way for the 1.4.x branch. That is just not possible for an enum.
Regarding the benchmark: Something like StopWatch is useless for code that is executed within fractions of milliseconds. Look at JMH if you want to have useful results.

The issue with adding an isReferentiable method is that if somebody has a complex behavior for isImmutable that they expect to have executed on deserialization, it wont be.
In our case, even a behavior as simple as
@Override
public boolean isImmutableType(Class type){
    return type.isAnnotationPresent(com.myCompany.ImmutableAnnotation.class)
        || super.isImmutable(type);
}

With this strategy users would then have to add
@Override
public boolean isReferentiable(Class type){
    return isImmutableType(type);
}

which is a surprise I wouldn't want to expose anyone too, and is effectively what I'm asking the library to do by default.
That said, whats more unexpected is that forking behaviour I mentioned above.

actually I'm being really silly, from a boolean algebra view this is quite simple.
Will do.

Alright, so I think I'm done tell me what you think @joehni.
I dont know if github has a way to generate diffs, but I can make them easily enough and send them to you on the mailing list easily enough.
I'm not sure whats involved in your back porting project, but I figured if you could tolerate some @Override annotations then you would be able to tolerate all the methods on the MapperWrapper being tagged with them, since I hate the idea of 2 of the overriding methods being tagged with it and the rest not being tagged with it.

ahah:
regarding generating diffs and patches, checkout thisPR.patch and thisPR.diff
nifty stuff github...

@joehni thanks for your patience in dealing with my bumbling around an obvious solution. Are you going to apply this to the latest build (and can I close this issue?)

Hi Geoff,
when I look at your diff, then I wonder, what did you use as parent for your XStream fork? It does not seem to be the current code base... ?!?

I  downloaded source + binaries from XStream/downloads "source distribution" of the stable version

I'll rebase that stuff into a proper fork


widgetset problem

I have my own widgetset which compiles fine, everything works fine with Vaadin 8.4.5 and Vaadin 8.7.1, but when I want to use vaadin-combobox-multiselect I get this
"Widgetset 'xyz.gwt.Mywidgetset' does not contain an implementation for org.vaadin.addons.ComboBoxMultiselect. Check the connector's @Connect mapping, the widgetset's GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to"
on the place I am trying to use that component.
Tried to add
""
into my Mywidgetset and gettting 'cannot resolve symbol'.
Any help would be appreciated.

Figured it out. Even though it says "No widgetset required.", I must have "" in my widgetset.


Support for liquid markup

Would be cool to have a template for liquid.

@namrodbui What do you mean by a template? Do you mean snippets?

Oh. That was fast!
More of a color scheme for the global variables in liquid.
There are a couple out there for sublime text.
https://github.com/siteleaf/liquid-syntax-mode
I really like atom.io a lot. Faster and crisper than Sublime. My buddy just
started at github last week, and he was telling me about atom.io. I've got
my whole team trying it out this week. Very impressed.
Kind Regards,
Brian Nam Bui
Look-Listen
678.386.8011 Mobile
+1<PHONE_NUMBER> Fax
<EMAIL_ADDRESS>On Tue, May 12, 2015 at 10:12 AM, Machisté N. Quintana <
<EMAIL_ADDRESS>wrote:

@namrodbui https://github.com/namrodbui What do you mean by a template?
Do you mean snippets?
—
Reply to this email directly or view it on GitHub
https://github.com/atom/atom/issues/6752#issuecomment-101296431.

It doesn't ship with Atom, but you can check out https://atom.io/packages/language-liquid - you can install it by opening Preferences / Settings in Atom, going to the Install section, and searching for language-liquid. That'll enable syntax highlighting and snippets for Liquid. Hope that helps!

Oh you already have it. Nice.


Support PSR-7

PSR-7 is out, so as Symfony's compatibility layer for PSR-7.
http://symfony.com/blog/psr-7-support-in-symfony-is-here
thephpleague/route#32

Just a heads up that once thephpleague/route/#32 is complete this will be implemented in Proton

thephpleague/route now has PSR7 compatibility in it's dev branch so this will come to Proton shortly


BuildContext now required!

@MATTYGILO
In my environment, it throws error The named parameter 'context' is not defined.
I don't think context is required in that method. https://api.flutter.dev/flutter/widgets/TextEditingController/buildTextSpan.html

@MATTYGILO I got this. It is required on flutter 2.2.x. Thank you for creating this PR


KinematicCollision2D.position obtained from get_slide_collision(i) is not precise enough.

Godot version:
3.1 release
OS/device including version:
Windows 10, Intel i7
Issue description:

Steps to reproduce:
Obtain KinematicCollision2D.position from get_slide_collision(i).

Cannot reproduce this behavior, with RectangleShape at least.
See the dots where collision points were reported on the borders:

The problem I see is another, the collision is correctly reported when going to the right (the end point of the platform) but is the rightmost point of the collider when going to the left.
All this can be reproduced with vertical motion and diagonal too.

And tested with CollisionPolygon2D and got the opposite result, the correct collision to the left and the leftmost point on the right...

@Iris-6 Please attach a reproduction project, perhaps this issue is related to  project settings such as the stretch mode or 2D pixel snap.

BugTest.zip

Any news on this issue?

Physics bugs can take some time to fix, even if the solution sometimes is a couple of lines the problem can be hard to track.
As a low precision workaround you can use the usual raycasts, put 3 or more Raycast2D nodes pointing down on the body and check them when you want to see how much is in the air.

still a problem in 3.2 beta 3

@Iris-6 The diagram you provided in the original issue description is not what I see in your example project:

When the KinematicBody2D object is moved off the edge of the StaticBody2D, the collision point does not hang off the edge and is in the position you describe as expected.
What is perhaps unexpected is that the collision point is the right-most point and not the centre:

The reason for this is that when the two surfaces are perfectly parallel, there two viable collision points: the left and the right and only one can be used. It makes no attempt to find the average. This can be verified by rotating the KinematicBody2D by only -1° to see the left side selected as the collision point:

Note, it will correctly move the collision point when the KinematicBody2D moves off the left edge of the StaticBody2D:

@eon-s and @securas if you're describing a different problem, I would suggest opening a separate issue and providing a sample project to demonstrate it.

Closing as resolved in 3.2.


I download a pre-train model myself

Hi!
I am working on a task of searching whether 2 code fragment is semantically similar( maybe similar with codeSearch task ) , I have done some simple attempts .
I download first and transform https://huggingface.co/microsoft/codebert-base/tree/main "pytorch_model.bin " into ckpt form, then load with bert4keras as mentioned in #24
config_path = 'pretrain_model/bert_config.json'
checkpoint_path = 'pretrain_model/bert_model.ckpt'
bert_model =  build_transformer_model (config_path, checkpoint_path,
                                                    seq_len=None)

But I found that the result is not better than the result of using the original bert model, which is very weired.
Am i configure it correct? If not, could you show me an example?

You need to fin-tune the model first: https://github.com/microsoft/CodeBERT/tree/master/GraphCodeBERT/codesearch#model-and-demo

You need to fin-tune the model first: https://github.com/microsoft/CodeBERT/tree/master/GraphCodeBERT/codesearch#model-and-demo

Thank you for your replying!
I have run the command in xxx
some errors occurred:
run.py: error: unrecognized arguments: --lang=java --data_flow_length 64
so I delete these2 lines. But I found that it stuck like below, could you let me know how to solve it? Thank you!
####################################
......- INFO - main -   device: cuda, n_gpu: 1
####################################

Please follow readme in model-and-demo.

Hi！Sorry for bothering again!
I have completed fine-tune the model

Then again I load with bert4keras as mentioned in #24 (I transform model.bin into xx.ckpt first)
config_path = 'pretrain_model/bert_config.json'
checkpoint_path = 'pretrain_model/bert_model.ckpt'
bert_model =  build_transformer_model (config_path, checkpoint_path,
                                                    seq_len=None)

then I load bert and concatenate it with other layers like
bert = build_transformer_model(config_path=config_path,checkpoint_path=checkpoint_path, ......)
cls=....(bert.model.output)
dense=keras.layers.Dense(...)(cls)
...

I intend to train this model on my dataset, but the result is still not better than the result of using the original bert model.
(1) Am I configuring codeBERT correctly in this way?
(2) Or is it some reason for explaining my results?

Sorry. Since I never use keras, I am not sure what goes wrong. Maybe you need to check whether the transformation from pytorch model to keras model is correct.


Missing Resource abstractor from 1-DOC

Short
The new resource abstractor service is missing from 1-DOC
Solution
Need to add the entires like
resource_abstractor:
    image: resource_abstractor
    build: resource-abstractor/
    container_name: resource_abstractor
    hostname: resource_abstractor
    expose:
      - "11011"
    ports:
      - "11011:11011"
    environment:
      - RESOURCE_ABSTRACTOR_PORT=11011
      - CLOUD_MONGO_URL=mongo
      - CLOUD_MONGO_PORT=10007
    depends_on:
      - mongo_root

to 1-DOC
Status
Implementing
Checklist

[ ] Discussed
[ ] Solved
[ ] Tested

Apologies for missing that entry.
Don't forget to add the environment variables to cloud_scheduler too.

No problem, it was my oversight as well, as I did not notice :D Anyway, I fixed it together with some parameters that were causing issues in the root scheduler. Probably, with the latest merges, something got overwritten.

Thank you for handling that @giobart 💪🏼.


Bokeh2 windbarb

Bokeh2.0 Windbarb code
Updates the wind barb code to a) work with Bokeh2 and b) accept negative u and v values ( by changing DistanceSpec to NumberSpec)
Check list
I have not checked the existing app works as expected because I'm not sure how you run it, but I think it should work.

[ ] Bump version number to reflect change, edit forest/__init__.py
(Use semantic version x.y.z where x is major, y is feature, z is patch)

@eardkdw thanks! This looks great, thanks for figuring out the Typescript changes needed to get the barbs working


Wrong positioning for indicator in TabNavigator

I'm having this issue where the indicator doesn't have the correct position in TabNavigator

We don't support  dynamic tab widths yet. Here your Acount info label is too big. Adjust the padding with tabStyle or set a width.
Right now, the only way we can set width automatically is by waiting for layout to calculate the width, which will cause 1 frame delay in rendering and is probably not the best experience. React Native's latest feature to provide percentage width will help with this, but it's not in stable version yet, and we'll proabably want to wait for few more versions before using it.


Add a new script for getting token to access EDB Cloud API

What
This PR adds a new script named get-token.sh to:

follow the standard OAuth0 Device Code flow to get a series of token used for accessing EDB Cloud API
refresh the tokens by using the standard refreshing flow

How to use it?
Usage
get-token.sh
Get Tokens for EDB Cloud API

Usage:
  ./get-token.sh [flags] [options]

      --format  json | plain         output format
      --refresh <refresh_token>      [optional] query for tokens again by the given refresh_token
                                     this revokes and rotates the given refresh token,
                                     please remember the newly returned refresh_token for
                                     the next use

Reference: https://www.enterprisedb.com/docs/edbcloud/latest/reference/

Get ordinary token
 ./get-token.sh -o plain
Please login to https://edbcloud.us.auth0.com/activate?user_code=ZMNX-VVJT with your EDB Cloud account
Have you finished the login successfully? (y/N) y

####### Access Token ################
eyxxxxxxxxxxxxxx

####### Refresh Token ###############
xxxxxxxxxx

#######   ID Token    ###############
xxxxxxxxxxxx

#####   Expires In Seconds ##########
86400

Refresh token
./get-token.sh -o json --refresh v1.MVZ9_-8C3rtdq5NvC0q61s1e6_1hfOaUukk8hz4sRdBhZpDCMKPHrprImxCPKlywS50utGXgFrsWq_bMB63OFRs
{
  "access_token": "xxxxxxxxxx",
  "refresh_token": "xxxxxxxxxxxx",
  "id_token": "xxxxxxxx",
  "scope": "openid profile email offline_access",
  "expires_in": 86400,
  "token_type": "Bearer"
}

This LGTM, but could you update the README to include a link to jq? Might be worth describing the two scripts in there now, too.

I pushed a new commit to address the requirement. https://github.com/EnterpriseDB/cloud-utilities/pull/5/commits/20f774b6cc3beb9b5b96cc450eb4ec1551bc5455
@drsm79 please again.


Module termcolor not recognized

Describe the bug
wa_kdbe.py doesn't detect the termcolor package.
To Reproduce
Steps to reproduce the behavior:

run 'python wa_kdbe.py'

Expected behavior
wa_kdbe.py to run
Screenshots

Desktop (please complete the following information):

OS: Windows 10, 20H2

requirements is installed with pip3 however program is run with python. Try python -m pip install -r requirements.txt or pip install -r requirements.txt

tried both, didn't work

Try some suggestions from StackOverflow. https://stackoverflow.com/questions/51530437/no-module-named-termcolor?answertab=active#tab-top

Now that is some issue LoL

Try some suggestions from StackOverflow. https://stackoverflow.com/questions/51530437/no-module-named-termcolor?answertab=active#tab-top

Sadly neither are the case for me, only python 3.9 here and correctly spelled termcolor.
Btw, whats termcolor for?

Sadly neither are the case for me, only python 3.9 here and correctly spelled termcolor

I don't know what we're missing here.

Btw, whats termcolor for?

Colorful texts in terminal. I will send modified CustomCI.py right away to work without termcolor.

import datetime

def CustomInput(textToInput, color='green', attr=[], getTime=True):
    time = GetTime() if getTime else ''
    return input(time + textToInput)

def CustomPrint(textToPrint, color='green', attr=[], getTime=True):
    time = GetTime() if getTime else ''
    textToPrint = str(textToPrint)
    print(time + textToPrint)

def GetTime():
    return '[' + str(datetime.datetime.now().time()) + '] '

Try this
pip3 install -r requirements.txt --user

Try this
pip3 install -r requirements.txt --user

same result

If you took the module reference out then this is solved right?

No this is just a workaround to continue without this module anyways.

Why not just remove the module reference and put the workaround in as the standard method? less dependencies

Why don't  I just put 10-20 commands in readme to copy paste in terminal? No dependencies.

well maybe not in readme, but somewhere where it can autorun

Why don't I just put 10-20 commands in readme to copy paste in terminal? No dependencies.

It was rhetorical

Closing because of inactivity.


Build pipeline

 Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.:x: ApinisMikelis sign nowYou have signed the CLA already but the status is still pending? Let us recheck it.


[Fix] EOF fixing

EOF fixing
Hey @abhi18av after your review, I'd like to fix the EOFs that were commited, here goes my changes. Hope they fix every EOF that are on the main code.
PR content

EOF inside code lines removed

Ending
Sorry for the EOFs in code lines, hope this code fix them. If there's something missing, tell me that I'll solve it.
Hope we have a merge!
Regards, Davi

@abhi18av :)) I'm just trying to do my best.


Fix #1915 Update property

Hello!

Type: bug fix
Link to issue: https://github.com/phalcon/zephir/issues/1915

In raising this pull request, I confirm the following:

[x] I have checked that another pull request for this purpose does not exist
[ ] I wrote some tests for this PR
[ ] I updated the CHANGELOG

Thanks

Thank you


Custom sound does not work when the app is in the background

My team is using Notifee to show push notifications. We decided to customize the flow by introducing a custom sound for those notifications. After trying to make this work, I managed to implement a custom sound when the app was in the foreground, but I got the default sound when the app was in the background or killed state. After reading a few articles, I am confused about whether this is possible, especially on IOS.
I was researching answers given in this issue but I didn't managed to find the solution for this there - https://github.com/invertase/notifee/issues/155
Test flow was next -> log in in the app and gave permissions for notifications. Then, while I am in the foreground I sent one notification and it has the custom sound. Then, I go in the background. Send one more notification and it has the default sound. Same behaviour on Android and on IOS.
Lib versions:

"@notifee/react-native": "5.7.0",
"@react-native-firebase/messaging": "14.2.4",
"react-native": "0.72.6",

My function for showing notifications looks like this
const displayNotification = async (message: FirebaseMessagingTypes.RemoteMessage) => {
  if (shouldDisplayNotification(message.data)){
    await notifee.requestPermission({ sound: true })
    await notifee.displayNotification({
      title: 'message.notification?.title',
      body: 'message.notification?.body',
      data: message.data,
      android: {
        pressAction: { id: 'default' },
        channelId: NOTIFICATION_CHANNEL_ID,
        sound: 'notification'
      },
      ios: {
        sound: 'notification.wav'
      }
    });
  }
};

Creating of Android channel
const createAndroidChannel = async () => {
  await notifee.deleteChannel(NOTIFICATION_CHANNEL_ID);
  await notifee.createChannel({
    id: NOTIFICATION_CHANNEL_ID,
    name: NOTIFICATION_CHANNEL_NAME,
    sound: 'notification'
  });
};

Initialisation of push notifications - getting all permissions
let listener = () => {};

export const initPushNotification = async () => {
  const authorizationStatus = await messaging().requestPermission();

  if (authorizationStatus === messaging.AuthorizationStatus.AUTHORIZED) {
    const token = await messaging().getToken();
    createAndroidChannel();

    listener();
    listener = messaging().onMessage((message: FirebaseMessagingTypes.RemoteMessage) => {
      ...code
      displayNotification(message);
    });

    onForegroundNotification();
    await onBackgroundNotification();
    return Promise.resolve(token);
  }

  return Promise.resolve(null);
};

I'm not sure I'll have time to answer the question in general but I certainly spend no time examining things on old versions:
"@notifee/react-native": "5.7.0",
"@react-native-firebase/messaging": "14.2.4",
At least for android - for iOS it has been a while since I looked so I'm not sure - once you create a channel you never get to update the channel settings other than the text (name + description), even if you delete/recreate the channel. The user is in control all of non-text parts of the channel post-creation. So that may have an effect on your test scenarios
You don't include the JSON of the FCM you send that would trigger a notification. If you're not specifying the correct android channel id, for instance, then you won't get the one you attempted to configure with custom sound (https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#AndroidNotification) - apple has something similar you put in the ApnsConfig payload section https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/generating_a_remote_notification?language=objc / https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#ApnsConfig

Thank you for fast response.
I will update Notifee version on the newest one. After that, I will test again and post the results here.

You don't include the JSON of the FCM you send that would trigger a notification.
I didn't provide FCM JSON because I didn't use it for this feature. What I am trying here to accomplish is to set the sound of all notifications from React Native code. I am familiar with the fact that we can do that if we add "sound": "someSound" into the FCM JSON, but that's not what I am trying to do. I read the documentation and didn't find the article telling me this cannot be done. If I am wrong, please correct me.

I didn't provide FCM JSON because I didn't use it for this feature. What I am trying here to accomplish is to set the sound of all notifications from React Native code

Then your example is incomplete and doesn't conform to philosophy of https://stackoverflow.com/help/how-to-ask / https://stackoverflow.com/help/minimal-reproducible-example - specifically:
onForegroundNotification(); is not defined
I assumed you were sending FCM JSON since I could not see any other location where you would construct a notification and post it. If you are not, please take care to provide a simple, complete example that shows the problem. Probably best to reduce the entire thing to one single simple App.js where you forget about what your app is currently doing and just try to isolate + demonstrate this problem, so it's easy to discuss with no missing parts.

I think we just have a misunderstanding here about what and how it's done. So, we have the system for handling push notifications in all three states - foreground, background and killed. And there everything works as expected. Notifications are received and handled properly.
The part where I think we don't understand each other is how we are handling background notifications. There, we are sending FCM JSON from our backend. That FCM JSON doesn't have "sound" field because I understood from the documentation that that's not necessary. So, in the code I provided I am trying to set custom sound for my background notifications on the front side. Is that possible at all?
Now, we want to introduce the custom sound for these notifications. I did a research on this topic and found Notifee's articles how that should be done. I will reference them here:

Android - https://notifee.app/react-native/docs/android/behaviour
IOS - https://notifee.app/react-native/docs/ios/behaviour#sound

I implemented everything like in these examples. The sound files are in the right folders, and the code is 1-1 match. I provided that code in my first message.
export const onBackgroundNotification = async () => {
  if (!messaging) return;

  const message = await messaging().getInitialNotification();

  if (message) {
    const { data } = message;
    handleNotificationTap(data);
  }

  messaging().onNotificationOpenedApp(({ data }) => {
    if (data) {
      handleNotificationTap(data);
    }
  });
};

Here, they said that we need "sound" field inside of a FCM JSON in order to play sound when the notification is received in the background - https://medium.com/@osamakhann118/custom-sound-for-react-native-push-notification-firebase-push-notification-sound-notification-f2b5ef5d00af . Is that true or not? Do I need "sound" field or I can set this custom sound without it?
This is a handler for the background push notifications. So, there we are just receiving notifications, extract the data and handle them. Nothing too special. So, the main question is "Can we implement custom sound for the background push notifications on the frontend side without using of the FCM JSON?".
Sorry if I didn't form the question well in the first try. I did my best to resolve that problem now.

In background states the underlying firebase-ios-sdk and firebase-android-sdk libraries will handle notification blocks before control flow ever reaches any other code here (including Notifee, unless you have a notification extension handler implemented...)
So I expect you will need to set the sound options in the FCM JSON and that seems to be configured by your experimental results
What happens when you use the sound fields I reference in the FCM JSON documentation upstream?

I implemented this using FCM JSON - added sound property and everything works fine. Thanks for the assistance.

@Hos1g4k1 can you share the FCM JSON sent from the server side???


Different renderer for install and update commands

I had this crazy idea when I was thinking about how bower output would look like in the rewrite. The initial idea was to use https://github.com/chjj/blessed to render a progress bar and state for each dependency. But I ended up implementing a multiple render mechanism, with a simple default renderer.
Though, this architecture allows us to easily implement new renderers. So what if we implemented the original idea as a new renderer that would be used for the install and update commands?

Not enough time to implement


Remove macOS DS_Store files

trivial fix

This change is

These test failures are not related to this PR.

Hey @philoserf! 👋
Thank you for submitting a PR to Cookiecutter 🍪
I'm afraid the test failures are in fact related to this PR. The .DS_Store files are needed for at least one test, see tests/test_generate_files.py.
assert os.path.isfile('inputbinary_files/.DS_Store')


mollysocket: 1.3.0 -> 1.4.0

Automatic update generated by nixpkgs-update tools. This update was made based on information from https://github.com/mollyim/mollysocket/releases.
meta.description for mollysocket is: Get Signal notifications via UnifiedPush
meta.homepage for mollysocket is: https://github.com/mollyim/mollysocket
meta.changelog for mollysocket is: https://github.com/mollyim/mollysocket/releases/tag/1.4.0
Updates performed

Rust version update

To inspect upstream changes

Release on GitHub

Compare changes on GitHub

Impact
Checks done

built on NixOS
The tests defined in passthru.tests, if any, passed
found 1.4.0 with grep in /nix/store/m251zb8pnyxad1ir6bmlgxz2pb33c62m-mollysocket-1.4.0
found 1.4.0 in filename of file in /nix/store/m251zb8pnyxad1ir6bmlgxz2pb33c62m-mollysocket-1.4.0

Rebuild report (if merged into master) (click to expand)

2 total rebuild path(s)

2 package rebuild(s)

First fifty rebuilds by attrpath

mollysocket

Instructions to test this update (click to expand)

Either download from Cachix:
nix-store -r /nix/store/m251zb8pnyxad1ir6bmlgxz2pb33c62m-mollysocket-1.4.0 \
  --option binary-caches 'https://cache.nixos.org/ https://nix-community.cachix.org/' \
  --option trusted-public-keys '
  nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=
  cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
  '

(The Cachix cache is only trusted for this store-path realization.)
For the Cachix download to work, your user must be in the trusted-users list or you can use sudo since root is effectively trusted.
Or, build yourself:
nix-build -A mollysocket https://github.com/r-ryantm/nixpkgs/archive/5b6a12e96e2eb638964d2ce6e1137e00c24c1b10.tar.gz

Or:
nix build github:r-ryantm/nixpkgs/5b6a12e96e2eb638964d2ce6e1137e00c24c1b10#mollysocket

After you've downloaded or built it, look at the files and if there are any, run the binaries:
ls -la /nix/store/m251zb8pnyxad1ir6bmlgxz2pb33c62m-mollysocket-1.4.0
ls -la /nix/store/m251zb8pnyxad1ir6bmlgxz2pb33c62m-mollysocket-1.4.0/bin

Pre-merge build results
We have automatically built all packages that will get rebuilt due to
this change.
This gives evidence on whether the upgrade will break dependent packages.
Note sometimes packages show up as failed to build independent of the
change, simply because they are already broken on the target branch.
Result of nixpkgs-review --extra-nixpkgs-config '{ allowInsecurePredicate = x: true; }' run on x86_64-linux 1

1 package built:

mollysocket

Maintainer pings
cc @dotlambda for testing.

Result of nixpkgs-review pr 313542 run on x86_64-linux 1

1 package built:

mollysocket


Error "The document object is not available" with Angular 19 with SSR and @angular-architects/native-federation 18.2.3

Reproduction step:
create new angular project: ng new shell --ssr
add native federation: ng add @angular-architects/native-federation --project shell --type dynamic-host --port 4200
run the project: npm run start
Expected result:
The application launch
Current result:
ng serve fails on open webpage with "The document object is not available"
Stackblitz with error:
https://stackblitz.com/~/github.com/hal1984/shell

Thanks for pointing this out.
This seems to be an issue with provideClientHydration -- if you skip this option in your app.config.ts it works. We will further look into this issue.

Thanks for pointing this out. This seems to be an issue with provideClientHydration -- if you skip this option in your app.config.ts it works. We will further look into this issue.

Thank you very much!

Just published version 18@latest and version 19. It should work now.

Just published version 18@latest and version 19. It should work now.

Hello, now appears to be problems loading a a remote component into the shell:
https://github.com/angular-architects/module-federation-plugin/issues/718

Thanks for this info. I'll look into it.


Suspend suspendable tasks on hook unmount

I don't get it why this was registered as a bug. It's an enhancement, given the weirdo-land of suspendability of fetch calls & whatnot in browserland


Password strength meter with progress bar.

Please advice to implement password strength meter with progress and js:
Must have capital letter, numbers and lowercase letters
var strongRegex = new RegExp("^(?=.{8,})(?=.[A-Z])(?=.[a-z])(?=.[0-9])(?=.\W).*$", "g");
Must have either capitals and lowercase letters or lowercase and numbers
var mediumRegex = new RegExp("^(?=.{7,})(((?=.[A-Z])(?=.[a-z]))|((?=.[A-Z])(?=.[0-9]))|((?=.[a-z])(?=.[0-9]))).*$", "g");
Must be at least 6 characters long
var okRegex = new RegExp("(?=.{6,}).*", "g");
Thank you

Please ask your question on StackOverflow, this has nothing to do with Semantic UI.
In fact. https://stackoverflow.com/questions/34453420/password-strength-meter-with-semantic-ui


Initial project commit, take 2!

Hey, just thought it would be easier to make a pull request than have you manually upload the zip file.
Also, do you mind adding me (jutonz) as a collaborator? I should be able to add everyone else from there.
Thanks!

Looks good! You are being added as collaborators.


fix: Fix RN 0.73 compatibility for v2

What
This PR fixes build error on RN 0.73
file:///.../react-native-vision-camera/android/src/main/java/com/mrousavy/camera/frameprocessor/FrameProcessorRuntimeManager.kt:43:63 Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type JavaScriptContextHolder?

Changes
Updated the init block in FrameProcessorRuntimeManager.kt based on the changes proposed in https://github.com/mrousavy/react-native-vision-camera/pull/2260.

Tested on

Emulator (Pixel 2 API 31)

Related issues

Hey - sorry I just saw that I already merged this into v2! Thanks anyways!


How to setup Perplex?

I don't know much about Python but would love to use this script. Could you please provide a step-by-step tutorial? Thanks.

Install Python3 (from website for windows store)
Install dependancies (in a terminal, like powershell) :
pip3 install loguru plexAPI httpx pypresence pylint black
Edit config_example.json and enter your Plex logins and your API key from TMDB. Save it and rename it "config.json".
Run PowerShell, and cd into the directory where you extracted the repo and run :
python .\perplex.py


Add TF_CONTROL_SLOT to c_api

This lets users of TF_ImportGraphDefOptionsAddInputMapping remap control inputs without having to guess the magical value of the kControlSlot constant.
cf #7508

Can one of the admins verify this patch?

I signed it!

Actually, talking to @asimshankar offline, he came up with a different approach that seems more in line with the current API. Instead of exposing TF_CONTROL_SLOT, how about we add a new function instead:
TF_GraphImportGraphDefOptionsRemapControlDependency(
  TF_ImportGraphDefOptions* opts,
  const char* src_name,
  TF_Operation* dst);

This is similar to other parts of the API where we explicitly create functions for control dependencies (e.g. TF_AddControlInput, TF_ImportGraphDefOptionsAddControlDependency).

Makes sense to me. I'll code that up today.

OK, I took a shot at it.

Looks good to me, thanks!

@tensorflow-jenkins test this please

@malmaud PR merged. Thank you for the contribution!

Thanks guys.


Installation Failed (Pdx213)

Hi. I have a Sony Xperia 10 III (xq-bt52), which is referenced as the PDX-213.
After having Magisk up and running, I tried to install the module, but I get the following error:

Copying zip to temp directory
Installing pdx213_ga_remapper.zip
Current boot slot: _b
Device is system-as-root
Archive:  /data/user/0/com.topjohnwu.magisk/cache/flash/install.zip
inflating: module.prop

Xperia 10 III GA Button Remapper
by lufei

Powered by Magisk

Archive:  /data/user/0/com.topjohnwu.magisk/cache/flash/install.zip
inflating: customize.sh
Archive:  /data/user/0/com.topjohnwu.magisk/cache/flash/install.zip
inflating: customize.sh
inflating: module.prop
creating: system/
creating: system/vendor/
creating: system/vendor/usr/
creating: system/vendor/usr/keylayout/
inflating: system/vendor/usr/keylayout/gpio-keys.kl

Extracting module files
This module is meant for Xperia 10 III (Pdx213)
Aborting Module Installation
! Installation failed

I don't know what I'm doing wrong (kind of a noob), but I feel like this should work.
Hope the project isn't defunct and you can help me get the god dang side button to work as a camera button/shutter, as it should (instead of our dear overlords snoop trigger....as if constant mic/cam access wasn't enough).
Thanks

Try installing Termux, run getprop ro.build.product and give me the result. Maybe your phone just reports a different id than mine does

Hi again. I can't thank you enough for your help and taking your time with
this issue.
I did as you said and surprisingly, the product id came back as XQ-BT52.
I'm in Europe (Portugal) and I am unsure if this is a regionalization issue
(I believe this is the global version).
Is there a way to your remapper working (btw, I have looked up the model
name and it seems XQ-BT52 is the model name associated with the codename
PDX 213).
Thank you once again.
A segunda, 11/07/2022, 00:05, lufeidotcom @.***>
escreveu:

Try installing Termux, run getprop ro.build.product and give me the
result. Maybe your phone just reports a different id than mine does
—
Reply to this email directly, view it on GitHub
https://github.com/lufeidotcom/Xperia-10-III-GA-Remapper/issues/1#issuecomment-1179817786,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AH7ZUQNBYM4RI5MLJL5CM7TVTNJMVANCNFSM53FR2S2Q
.
You are receiving this because you authored the thread.Message ID:
@.***>

Mine reports pdx213, but I'm also on custom rom (GSI) so that might be why. You can try the new version I've uploaded (v1.2)

Hi, thank you again. Just letting you know that the updated version worked like a charm. There is still some issue with the software recognition. While the button now works, pressing it inside the camera app doesn't really do anything. I feel the vibration and hear the sound as if it was snapping a shot, but nothing ever happens. If I use another camera app, like Open Camera, it works perfectly.
I also tried using the Button Mapper app, to change the behaviour of the button, where it comes up as Camera_27. Again, I can now get long press behaviour to open the Camera app, double click to turn the flashlight on and off, and click to snap photo.
It works, except for snapping photos on the standard camera app. No such issue on the Open Camera app.
BTW, anyway I can donate something for your work/time and the very useful remapper. I mean, you are correcting a mistake Sony made..

Nice that it worked! I'll be quite busy this fall but if I'll have some time over I'll look into getting the stock camera or maybe gcam working somehow.
Thank you for offering to donate and there's details for that on my main github page, though it's not a big deal since I'm mostly just doing things like these for the fun/challenge
I'll mark this issue as solved but feel free to open another if there's something else that could be improved


Sync eng/common directory with azure-sdk-tools for PR 1688

Sync eng/common directory with azure-sdk-tools for PR https://github.com/Azure/azure-sdk-tools/pull/1688  See eng/common workflow

/check-enforcer override


Delete duplicated test codes

Delete duplicated test codes named ~UsingSingleClient()

Fix #18
Review

[x] @jhpark816
[x] @whchoi83

리뷰 완료했습니다~


skip_training configuration value overwritten

I was setting a value for skip_training in the configuration file, however this value is always overridden by the command line settings. The command lines settings are loaded onto the pre-loaded configuration file settings, and whenever this happens skip_training is always set to false, even when the command-line flag is not supplied to the command/invocation.

I looked at altering the code to prevent the command line option overwrite, from erasing the configuration file specification (for skip_training), but the code was too simple for me to want to rip it apart and expose the key being over written (due the default action taken).
For the sake of reducing code bloat, perhaps the documentation file should state if you wish to skip_training, do so by explicitly specifying the command line option --skip_training, as opposed to placing it in a configuration file.
FWIK: Typical command line syntax allows environment variables to persist, but also allows a configuration file to override the values, and similarly command line options override the other two. However if a command line option isn't specified, it should not overwrite either configuration file or environment variable alterations. In any regard now that I have found a solution, I am content.


Fix a minor typo in specs

Hello !
There is nothing much to this one, it's in the test's description so it shouldn't impact a thing and will make this line more greppable.

:heart: :green_heart: :blue_heart: :yellow_heart: :purple_heart:


Upgrade provwasm

Summary
A new version of the provwasm smart contract library (1.0.0-beta) is available here: https://crates.io/crates/provwasm-std along with an associated migration guide: https://github.com/CosmWasm/cosmwasm/blob/main/MIGRATING.md
Problem Definition

Need this to work with any of the 1.8.x release candidates for provenance.
Proposal

For Admin Use

[ ] Not duplicate issue
[ ] Appropriate labels applied
[ ] Appropriate contributors tagged
[ ] Contributor assigned/self-assigned

Oops we duplicated i created issue81


CPU 100% but memeory is low! But NumGC is growing!

Today while I am testing I note the following
I have an idle session, I sent an image as following
Alloc = 3 MiB   TotalAlloc = 30 MiB     Sys = 16 MiB    NumGC = 283
time="2020-05-05T12:50:46Z" level=info msg="Url /api/send/image"
[mysql] 2020/05/05 12:50:46 packets.go:122: closing bad idle connection: EOF
time="2020-05-05T12:50:46Z" level=info msg=2

CPU jump to 100%, I hade to kill the proc, am not sure if that because "packets.go:122: closing bad idle connection: EOF" !
Do you have any idea why we have such behavior?
Is it the number of NumGC ? it is quite big!
// NumGC is the number of completed GC cycles.
@x00b Any Idea ?

That's weird. This idle session when you tried to send the image was activated/online?
The high GC i think might be a default behavior of go garbage collector(which is not a good thing), but if you could give more details about it we will figure things out

I am not that expert in goLang, A freelancer make an API for me and he disappears :)
Well, I am trying to understand how things is going on, I am PHP dev.

That's weird. This idle session when you tried to send the image was activated/online?
Yes it was online.

PS: How can I contact you private?

That's weird. This idle session when you tried to send the image was activated/online?
The high GC i think might be a default behavior of go garbage collector(which is not a good thing), but if you could give more details about it we will figure things out
edit: i am thinking that the default gc behavior isn't helping at all. Theres quite a lot of articles talking about this spikes and high cycles and how it causes other problems that should not exist.

Agien i have the same situation , but I note that device sent :
Process Que Recieved Signal PAUSE
Then I sent the message vie the API....!

Again sending a message while PAUSE is activated turn CPU to 100%

SOLVED
There is an infinite loop checking the PAUSE


New icons!

The sizing is perfect for this. I've tested it out.

lmk what changes you might want to the icon, i forgot to upload the icns but have added it rn

Love it.


TypeError: Cannot read property 'get' of undefined

I've been getting a lot of this error lately:
eth_getBalance
/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/merkle-patricia-tree/baseTrie.js:117
    db.get(key, {
      ^

TypeError: Cannot read property 'get' of undefined
    at dbGet (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/merkle-patricia-tree/baseTrie.js:117:7)
    at /usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/merkle-patricia-tree/util.js:64:5
    at /usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/async/lib/async.js:181:20
    at iterate (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/async/lib/async.js:262:13)
    at /usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/async/lib/async.js:274:29
    at /usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/async/lib/async.js:44:16
    at /usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/merkle-patricia-tree/util.js:69:7
    at /usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/merkle-patricia-tree/baseTrie.js:122:9
    at dispatchError (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/merkle-patricia-tree/node_modules/levelup/lib/util.js:64:35)
    at /usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/merkle-patricia-tree/node_modules/levelup/lib/levelup.js:222:14

This causes testrpc to crash.
I don't know exactly what causes it, because if I restart testrpc and truffle deploy and build my project again it doesn't necessarily happen again. I think it happens when I do a lot of calls at the same time
Seems non-deterministic.

That's very odd. I haven't seen this error yet myself. If you can do more to track it down I'd appreciate it.
Does it seem reproduceable at all, at least with your app? Or does it seem random?

I haven't been able to reproduce it very effectively, no, but it seems to be happening more often during the start up phase of my dapp, when I am sending a lot of contract.foo.call() requests. With that and the fact that it comes randomly I am thinking that there is some parallelism involved, but otherwise I'm not sure. If I figure out a bit more details on when it happens I will let you know

@MrChico Can you clone testrpc from master and then do the following to run it:
cd ethereumjs-testrpc
./bin/testrpc [-p xxxx]

Does the problem still persist? There's been quite a few updates. Would love to know if we inadvertently fixed this.

Pulled the git and with 0.1.1 I still got a crash :/

This is one of the weirdest errors. You wouldn't have happened to use npm link on ethereumjs-vm awhile back, somehow causing you to use an older
version would you?
On Mon, Feb 15, 2016 at 9:45 AM, MrChico<EMAIL_ADDRESS>wrote:

Pulled the git and with 0.1.1 I still got a crash :/
—
Reply to this email directly or view it on GitHub
https://github.com/ethereumjs/testrpc/issues/9#issuecomment-184321634.

@MrChico This still an issue? Can you test it with the latest v1.1.0 npm release?

@MrChico ?

Have not had this error in a while, so I think this issue can be closed

i am getting this every 10-20 min on testrpc v4.0.1 (ganache-core:1.0.1)
on ubuntu 16.04

Having the same on TestRPC v4.1.3 (ganache-core: 1.1.3) on OS X, Node.js version 8.3.0:
eth_getBlockByNumber
eth_getTransactionReceipt
eth_getTransactionByHash
eth_call
TypeError: Cannot read property 'get' of undefined
    at dbGet (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:61465:7)
    at /usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:17652:5
    at /usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:23385:20
    at iterate (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:23466:13)
    at /usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:23478:29
    at /usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:23248:16
    at /usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:17657:7
    at /usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:61470:9
    at dispatchError (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:33014:36)
    at /usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:22881:14


Edits for Resources Table & View

The following are changes that are needed for the Resources table on the "View Checkins" page:

[ ] Add Time Stamp to Date Start & Date End column (When someone checks in a resource we want the time of check in displayed under the date in that column) *the user should not have to manually input the time rather pull the time when the server is pinged with the request

[x] Display Name of Organization & Name of user that checked in resource under "Organization" column of the Resources table. ex: CDC, John Smith

[x] Add to "Type" column the label "Hazard" , "Pamphlets Delivered", "Medical Services"

2ns and 3rd tasks addressed by #495

Thank you @mjmilan for the quick turnaround!

No problem...

The first task gives rise to some questions... Does it really make sense that we set the time according to the time when the transaction is made? If as a user I am saying that something will be available from next Tuesday until next Friday, does anyone care about the fact that I happen to be doing this at 14:17 the previous Monday?
Why is 14:17 considered as special?
Would it not make more sense to provide UI functionality so that they could choose the time, but  default it to something like 00:00?

Great question, in the long run we may be adding times to the commitments (pending discussions as for most all it will stay at the day level)
For now we want to know when theses are checked in for two reasons: timeliness/staleness of data and also as current excercises are looking to run this in 'real time' and the timestamps will help.
Separately I am editing the issue as it should actually not be for both start and end date and just be an 'entered date' as there aren't times for the start/end yet

For #3 this is handled by data entry that we will do for the exercise
Thanks again

first item is complete as well - verified


Doesn't work with ytmusicapi==1.x.x and pytube==15.x.x

Both ytmusicapi and pytube got updated beyond of what version 0.3.8 works with so the workaround is to install older versions instead:
pip uninstall ytmusicapi
pip install ytmusicapi==0.25.2
pip install pytube==12.1.0

(then restart mopidy)

The workaround doesn't work any more. Sponsored a one time coffee equivalent towards this PR - hopefully some more people will do so as well because Mopidy is the best way of listening to music on Linux and YTM algos are amazing at guessing which songs I'm gonna like. Cheers!

Maybe this should be in README.md for the time being?

Check this https://github.com/pytube/pytube/pull/1691
I've been searching the web for two days, but finally found the solution.
Rename your actual cipher.py to cipher.py.old o whatever. Create a new file named cipher.py, and paste the code from the last fixed cipher.py on git https://github.com/yogeshgirmal/pytube/blob/b0c9de965f7ec8b3140cc5a5a9eb15c039a5bd79/pytube/cipher.py
Restart mopidy, done.

@herkow this needs one more patch now: https://github.com/pytube/pytube/pull/1756

@selurvedu Today I tried to play some music and it didn't work.
Official Pytube cipher.py has not been modified in about a year. I could spend weeks ranting about python... The solution that worked for me is in this repo https://github.com/yogeshgirmal/pytube/tree/b0c9de965f7ec8b3140cc5a5a9eb15c039a5bd79/pytube wich is not offcial. Today it was NOT working. But I've modified the line:
var_regex = re.compile(r"^\w+\W")
to
var_regex = re.compile(r"^$*\w+\W")
and now it's working. Make sure you are using the cipher.py from the yogeshgirmal repo, not the official.

@herkow that's exactly what I did. Just tried it again and still getting pytube.exceptions.RegexMatchError: get_throttling_function_name: could not find match for multiple. I checked if I'm editing the right file – I do.

@herkow that's exactly what I did. Just tried it again and still getting pytube.exceptions.RegexMatchError: get_throttling_function_name: could not find match for multiple. I checked if I'm editing the right file – I do.

Let's give it a last shot... rename your actual cipher.py to whatever you like, create a new one and paste this:
"""
This module contains all logic necessary to decipher the signature.

YouTube's strategy to restrict downloading videos is to send a ciphered version
of the signature to the client, along with the decryption algorithm obfuscated
in JavaScript. For the clients to play the videos, JavaScript must take the
ciphered version, cycle it through a series of "transform functions," and then
signs the media URL with the output.

This module is responsible for (1) finding and extracting those "transform
functions" (2) maps them to Python equivalents and (3) taking the ciphered
signature and decoding it.

"""
import logging
import re
from itertools import chain
from typing import Any, Callable, Dict, List, Optional, Tuple

from pytube.exceptions import ExtractError, RegexMatchError
from pytube.helpers import cache, regex_search
from pytube.parser import find_object_from_startpoint, throttling_array_split

logger = logging.getLogger(__name__)

class Cipher:
    def __init__(self, js: str):
        self.transform_plan: List[str] = get_transform_plan(js)
        var_regex = re.compile(r"^\$*\w+\W")
        var_match = var_regex.search(self.transform_plan[0])
        if not var_match:
            raise RegexMatchError(
                caller="__init__", pattern=var_regex.pattern
            )
        var = var_match.group(0)[:-1]
        self.transform_map = get_transform_map(js, var)
        self.js_func_patterns = [
            r"\w+\.(\w+)\(\w,(\d+)\)",
            r"\w+\[(\"\w+\")\]\(\w,(\d+)\)"
        ]

        self.throttling_plan = get_throttling_plan(js)
        self.throttling_array = get_throttling_function_array(js)

        self.calculated_n = None

    def calculate_n(self, initial_n: list):
        """Converts n to the correct value to prevent throttling."""
        if self.calculated_n:
            return self.calculated_n

        # First, update all instances of 'b' with the list(initial_n)
        for i in range(len(self.throttling_array)):
            if self.throttling_array[i] == 'b':
                self.throttling_array[i] = initial_n

        for step in self.throttling_plan:
            curr_func = self.throttling_array[int(step[0])]
            if not callable(curr_func):
                logger.debug(f'{curr_func} is not callable.')
                logger.debug(f'Throttling array:\n{self.throttling_array}\n')
                raise ExtractError(f'{curr_func} is not callable.')

            first_arg = self.throttling_array[int(step[1])]

            if len(step) == 2:
                curr_func(first_arg)
            elif len(step) == 3:
                second_arg = self.throttling_array[int(step[2])]
                curr_func(first_arg, second_arg)

        self.calculated_n = ''.join(initial_n)
        return self.calculated_n

    def get_signature(self, ciphered_signature: str) -> str:
        """Decipher the signature.

        Taking the ciphered signature, applies the transform functions.

        :param str ciphered_signature:
            The ciphered signature sent in the ``player_config``.
        :rtype: str
        :returns:
            Decrypted signature required to download the media content.
        """
        signature = list(ciphered_signature)

        for js_func in self.transform_plan:
            name, argument = self.parse_function(js_func)  # type: ignore
            signature = self.transform_map[name](signature, argument)
            logger.debug(
                "applied transform function\n"
                "output: %s\n"
                "js_function: %s\n"
                "argument: %d\n"
                "function: %s",
                "".join(signature),
                name,
                argument,
                self.transform_map[name],
            )

        return "".join(signature)

    @cache
    def parse_function(self, js_func: str) -> Tuple[str, int]:
        """Parse the Javascript transform function.

        Break a JavaScript transform function down into a two element ``tuple``
        containing the function name and some integer-based argument.

        :param str js_func:
            The JavaScript version of the transform function.
        :rtype: tuple
        :returns:
            two element tuple containing the function name and an argument.

        **Example**:

        parse_function('DE.AJ(a,15)')
        ('AJ', 15)

        """
        logger.debug("parsing transform function")
        for pattern in self.js_func_patterns:
            regex = re.compile(pattern)
            parse_match = regex.search(js_func)
            if parse_match:
                fn_name, fn_arg = parse_match.groups()
                return fn_name, int(fn_arg)

        raise RegexMatchError(
            caller="parse_function", pattern="js_func_patterns"
        )

def get_initial_function_name(js: str) -> str:
    """Extract the name of the function responsible for computing the signature.
    :param str js:
        The contents of the base.js asset file.
    :rtype: str
    :returns:
        Function name from regex match
    """

    function_patterns = [
        r"\b[cs]\s*&&\s*[adf]\.set\([^,]+\s*,\s*encodeURIComponent\s*\(\s*(?P<sig>[a-zA-Z0-9$]+)\(",  # noqa: E501
        r"\b[a-zA-Z0-9]+\s*&&\s*[a-zA-Z0-9]+\.set\([^,]+\s*,\s*encodeURIComponent\s*\(\s*(?P<sig>[a-zA-Z0-9$]+)\(",  # noqa: E501
        r'(?:\b|[^a-zA-Z0-9$])(?P<sig>[a-zA-Z0-9$]{2})\s*=\s*function\(\s*a\s*\)\s*{\s*a\s*=\s*a\.split\(\s*""\s*\)',  # noqa: E501
        r'(?P<sig>[a-zA-Z0-9$]+)\s*=\s*function\(\s*a\s*\)\s*{\s*a\s*=\s*a\.split\(\s*""\s*\)',  # noqa: E501
        r'(["\'])signature\1\s*,\s*(?P<sig>[a-zA-Z0-9$]+)\(',
        r"\.sig\|\|(?P<sig>[a-zA-Z0-9$]+)\(",
        r"yt\.akamaized\.net/\)\s*\|\|\s*.*?\s*[cs]\s*&&\s*[adf]\.set\([^,]+\s*,\s*(?:encodeURIComponent\s*\()?\s*(?P<sig>[a-zA-Z0-9$]+)\(",  # noqa: E501
        r"\b[cs]\s*&&\s*[adf]\.set\([^,]+\s*,\s*(?P<sig>[a-zA-Z0-9$]+)\(",  # noqa: E501
        r"\b[a-zA-Z0-9]+\s*&&\s*[a-zA-Z0-9]+\.set\([^,]+\s*,\s*(?P<sig>[a-zA-Z0-9$]+)\(",  # noqa: E501
        r"\bc\s*&&\s*a\.set\([^,]+\s*,\s*\([^)]*\)\s*\(\s*(?P<sig>[a-zA-Z0-9$]+)\(",  # noqa: E501
        r"\bc\s*&&\s*[a-zA-Z0-9]+\.set\([^,]+\s*,\s*\([^)]*\)\s*\(\s*(?P<sig>[a-zA-Z0-9$]+)\(",  # noqa: E501
        r"\bc\s*&&\s*[a-zA-Z0-9]+\.set\([^,]+\s*,\s*\([^)]*\)\s*\(\s*(?P<sig>[a-zA-Z0-9$]+)\(",  # noqa: E501
    ]
    logger.debug("finding initial function name")
    for pattern in function_patterns:
        regex = re.compile(pattern)
        function_match = regex.search(js)
        if function_match:
            logger.debug("finished regex search, matched: %s", pattern)
            return function_match.group(1)

    raise RegexMatchError(
        caller="get_initial_function_name", pattern="multiple"
    )

def get_transform_plan(js: str) -> List[str]:
    """Extract the "transform plan".

    The "transform plan" is the functions that the ciphered signature is
    cycled through to obtain the actual signature.

    :param str js:
        The contents of the base.js asset file.

    **Example**:

    ['DE.AJ(a,15)',
    'DE.VR(a,3)',
    'DE.AJ(a,51)',
    'DE.VR(a,3)',
    'DE.kT(a,51)',
    'DE.kT(a,8)',
    'DE.VR(a,3)',
    'DE.kT(a,21)']
    """
    name = re.escape(get_initial_function_name(js))
    pattern = r"%s=function\(\w\){[a-z=\.\(\"\)]*;(.*);(?:.+)}" % name
    logger.debug("getting transform plan")
    return regex_search(pattern, js, group=1).split(";")

def get_transform_object(js: str, var: str) -> List[str]:
    """Extract the "transform object".

    The "transform object" contains the function definitions referenced in the
    "transform plan". The ``var`` argument is the obfuscated variable name
    which contains these functions, for example, given the function call
    ``DE.AJ(a,15)`` returned by the transform plan, "DE" would be the var.

    :param str js:
        The contents of the base.js asset file.
    :param str var:
        The obfuscated variable name that stores an object with all functions
        that descrambles the signature.

    **Example**:

    >>> get_transform_object(js, 'DE')
    ['AJ:function(a){a.reverse()}',
    'VR:function(a,b){a.splice(0,b)}',
    'kT:function(a,b){var c=a[0];a[0]=a[b%a.length];a[b]=c}']

    """
    pattern = r"var %s={(.*?)};" % re.escape(var)
    logger.debug("getting transform object")
    regex = re.compile(pattern, flags=re.DOTALL)
    transform_match = regex.search(js)
    if not transform_match:
        raise RegexMatchError(caller="get_transform_object", pattern=pattern)

    return transform_match.group(1).replace("\n", " ").split(", ")

def get_transform_map(js: str, var: str) -> Dict:
    """Build a transform function lookup.

    Build a lookup table of obfuscated JavaScript function names to the
    Python equivalents.

    :param str js:
        The contents of the base.js asset file.
    :param str var:
        The obfuscated variable name that stores an object with all functions
        that descrambles the signature.

    """
    transform_object = get_transform_object(js, var)
    mapper = {}
    for obj in transform_object:
        # AJ:function(a){a.reverse()} => AJ, function(a){a.reverse()}
        name, function = obj.split(":", 1)
        fn = map_functions(function)
        mapper[name] = fn
    return mapper

def get_throttling_function_name(js: str) -> str:
    """Extract the name of the function that computes the throttling parameter.

    :param str js:
        The contents of the base.js asset file.
    :rtype: str
    :returns:
        The name of the function used to compute the throttling parameter.
    """
    function_patterns = [
        # https://github.com/ytdl-org/youtube-dl/issues/29326#issuecomment-865985377
        # https://github.com/yt-dlp/yt-dlp/commit/48416bc4a8f1d5ff07d5977659cb8ece7640dcd8
        # var Bpa = [iha];
        # ...
        # a.C && (b = a.get("n")) && (b = Bpa[0](b), a.set("n", b),
        # Bpa.length || iha("")) }};
        # In the above case, `iha` is the relevant function name
        r'a\.[a-zA-Z]\s*&&\s*\([a-z]\s*=\s*a\.get\("n"\)\)\s*&&\s*'
        r'\([a-z]\s*=\s*([a-zA-Z0-9$]+)(\[\d+\])?\([a-z]\)',
    ]
    logger.debug('Finding throttling function name')
    for pattern in function_patterns:
        regex = re.compile(pattern)
        function_match = regex.search(js)
        if function_match:
            logger.debug("finished regex search, matched: %s", pattern)
            if len(function_match.groups()) == 1:
                return function_match.group(1)
            idx = function_match.group(2)
            if idx:
                idx = idx.strip("[]")
                array = re.search(
                    r'var {nfunc}\s*=\s*(\[.+?\]);'.format(
                        nfunc=re.escape(function_match.group(1))),
                    js
                )
                if array:
                    array = array.group(1).strip("[]").split(",")
                    array = [x.strip() for x in array]
                    return array[int(idx)]

    raise RegexMatchError(
        caller="get_throttling_function_name", pattern="multiple"
    )

def get_throttling_function_code(js: str) -> str:
    """Extract the raw code for the throttling function.

    :param str js:
        The contents of the base.js asset file.
    :rtype: str
    :returns:
        The name of the function used to compute the throttling parameter.
    """
    # Begin by extracting the correct function name
    name = re.escape(get_throttling_function_name(js))

    # Identify where the function is defined
    pattern_start = r"%s=function\(\w\)" % name
    regex = re.compile(pattern_start)
    match = regex.search(js)

    # Extract the code within curly braces for the function itself, and merge any split lines
    code_lines_list = find_object_from_startpoint(js, match.span()[1]).split('\n')
    joined_lines = "".join(code_lines_list)

    # Prepend function definition (e.g. `Dea=function(a)`)
    return match.group(0) + joined_lines

def get_throttling_function_array(js: str) -> List[Any]:
    """Extract the "c" array.

    :param str js:
        The contents of the base.js asset file.
    :returns:
        The array of various integers, arrays, and functions.
    """
    raw_code = get_throttling_function_code(js)

    array_start = r",c=\["
    array_regex = re.compile(array_start)
    match = array_regex.search(raw_code)

    array_raw = find_object_from_startpoint(raw_code, match.span()[1] - 1)
    str_array = throttling_array_split(array_raw)

    converted_array = []
    for el in str_array:
        try:
            converted_array.append(int(el))
            continue
        except ValueError:
            # Not an integer value.
            pass

        if el == 'null':
            converted_array.append(None)
            continue

        if el.startswith('"') and el.endswith('"'):
            # Convert e.g. '"abcdef"' to string without quotation marks, 'abcdef'
            converted_array.append(el[1:-1])
            continue

        if el.startswith('function'):
            mapper = (
                (r"{for\(\w=\(\w%\w\.length\+\w\.length\)%\w\.length;\w--;\)\w\.unshift\(\w.pop\(\)\)}", throttling_unshift),  # noqa:E501
                (r"{\w\.reverse\(\)}", throttling_reverse),
                (r"{\w\.push\(\w\)}", throttling_push),
                (r";var\s\w=\w\[0\];\w\[0\]=\w\[\w\];\w\[\w\]=\w}", throttling_swap),
                (r"case\s\d+", throttling_cipher_function),
                (r"\w\.splice\(0,1,\w\.splice\(\w,1,\w\[0\]\)\[0\]\)", throttling_nested_splice),  # noqa:E501
                (r";\w\.splice\(\w,1\)}", js_splice),
                (r"\w\.splice\(-\w\)\.reverse\(\)\.forEach\(function\(\w\){\w\.unshift\(\w\)}\)", throttling_prepend),  # noqa:E501
                (r"for\(var \w=\w\.length;\w;\)\w\.push\(\w\.splice\(--\w,1\)\[0\]\)}", throttling_reverse),  # noqa:E501
            )

            found = False
            for pattern, fn in mapper:
                if re.search(pattern, el):
                    converted_array.append(fn)
                    found = True
            if found:
                continue

        converted_array.append(el)

    # Replace null elements with array itself
    for i in range(len(converted_array)):
        if converted_array[i] is None:
            converted_array[i] = converted_array

    return converted_array

def get_throttling_plan(js: str):
    """Extract the "throttling plan".

    The "throttling plan" is a list of tuples used for calling functions
    in the c array. The first element of the tuple is the index of the
    function to call, and any remaining elements of the tuple are arguments
    to pass to that function.

    :param str js:
        The contents of the base.js asset file.
    :returns:
        The full function code for computing the throttlign parameter.
    """
    raw_code = get_throttling_function_code(js)

    transform_start = r"try{"
    plan_regex = re.compile(transform_start)
    match = plan_regex.search(raw_code)

    transform_plan_raw = find_object_from_startpoint(raw_code, match.span()[1] - 1)

    # Steps are either c[x](c[y]) or c[x](c[y],c[z])
    step_start = r"c\[(\d+)\]\(c\[(\d+)\](,c(\[(\d+)\]))?\)"
    step_regex = re.compile(step_start)
    matches = step_regex.findall(transform_plan_raw)
    transform_steps = []
    for match in matches:
        if match[4] != '':
            transform_steps.append((match[0],match[1],match[4]))
        else:
            transform_steps.append((match[0],match[1]))

    return transform_steps

def reverse(arr: List, _: Optional[Any]):
    """Reverse elements in a list.

    This function is equivalent to:

    .. code-block:: javascript

        function(a, b) { a.reverse() }

    This method takes an unused ``b`` variable as their transform functions
    universally sent two arguments.

    **Example**:

    >>> reverse([1, 2, 3, 4])
    [4, 3, 2, 1]
    """
    return arr[::-1]

def splice(arr: List, b: int):
    """Add/remove items to/from a list.

    This function is equivalent to:

    .. code-block:: javascript

        function(a, b) { a.splice(0, b) }

    **Example**:

    >>> splice([1, 2, 3, 4], 2)
    [1, 2]
    """
    return arr[b:]

def swap(arr: List, b: int):
    """Swap positions at b modulus the list length.

    This function is equivalent to:

    .. code-block:: javascript

        function(a, b) { var c=a[0];a[0]=a[b%a.length];a[b]=c }

    **Example**:

    >>> swap([1, 2, 3, 4], 2)
    [3, 2, 1, 4]
    """
    r = b % len(arr)
    return list(chain([arr[r]], arr[1:r], [arr[0]], arr[r + 1 :]))

def throttling_reverse(arr: list):
    """Reverses the input list.

    Needs to do an in-place reversal so that the passed list gets changed.
    To accomplish this, we create a reversed copy, and then change each
    indvidual element.
    """
    reverse_copy = arr.copy()[::-1]
    for i in range(len(reverse_copy)):
        arr[i] = reverse_copy[i]

def throttling_push(d: list, e: Any):
    """Pushes an element onto a list."""
    d.append(e)

def throttling_mod_func(d: list, e: int):
    """Perform the modular function from the throttling array functions.

    In the javascript, the modular operation is as follows:
    e = (e % d.length + d.length) % d.length

    We simply translate this to python here.
    """
    return (e % len(d) + len(d)) % len(d)

def throttling_unshift(d: list, e: int):
    """Rotates the elements of the list to the right.

    In the javascript, the operation is as follows:
    for(e=(e%d.length+d.length)%d.length;e--;)d.unshift(d.pop())
    """
    e = throttling_mod_func(d, e)
    new_arr = d[-e:] + d[:-e]
    d.clear()
    for el in new_arr:
        d.append(el)

def throttling_cipher_function(d: list, e: str):
    """This ciphers d with e to generate a new list.

    In the javascript, the operation is as follows:
    var h = [A-Za-z0-9-_], f = 96;  // simplified from switch-case loop
    d.forEach(
        function(l,m,n){
            this.push(
                n[m]=h[
                    (h.indexOf(l)-h.indexOf(this[m])+m-32+f--)%h.length
                ]
            )
        },
        e.split("")
    )
    """
    h = list('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_')
    f = 96
    # by naming it "this" we can more closely reflect the js
    this = list(e)

    # This is so we don't run into weirdness with enumerate while
    #  we change the input list
    copied_list = d.copy()

    for m, l in enumerate(copied_list):
        bracket_val = (h.index(l) - h.index(this[m]) + m - 32 + f) % len(h)
        this.append(
            h[bracket_val]
        )
        d[m] = h[bracket_val]
        f -= 1

def throttling_nested_splice(d: list, e: int):
    """Nested splice function in throttling js.

    In the javascript, the operation is as follows:
    function(d,e){
        e=(e%d.length+d.length)%d.length;
        d.splice(
            0,
            1,
            d.splice(
                e,
                1,
                d[0]
            )[0]
        )
    }

    While testing, all this seemed to do is swap element 0 and e,
    but the actual process is preserved in case there was an edge
    case that was not considered.
    """
    e = throttling_mod_func(d, e)
    inner_splice = js_splice(
        d,
        e,
        1,
        d[0]
    )
    js_splice(
        d,
        0,
        1,
        inner_splice[0]
    )

def throttling_prepend(d: list, e: int):
    """

    In the javascript, the operation is as follows:
    function(d,e){
        e=(e%d.length+d.length)%d.length;
        d.splice(-e).reverse().forEach(
            function(f){
                d.unshift(f)
            }
        )
    }

    Effectively, this moves the last e elements of d to the beginning.
    """
    start_len = len(d)
    # First, calculate e
    e = throttling_mod_func(d, e)

    # Then do the prepending
    new_arr = d[-e:] + d[:-e]

    # And update the input list
    d.clear()
    for el in new_arr:
        d.append(el)

    end_len = len(d)
    assert start_len == end_len

def throttling_swap(d: list, e: int):
    """Swap positions of the 0'th and e'th elements in-place."""
    e = throttling_mod_func(d, e)
    f = d[0]
    d[0] = d[e]
    d[e] = f

def js_splice(arr: list, start: int, delete_count=None, *items):
    """Implementation of javascript's splice function.

    :param list arr:
        Array to splice
    :param int start:
        Index at which to start changing the array
    :param int delete_count:
        Number of elements to delete from the array
    :param *items:
        Items to add to the array

    Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice  # noqa:E501
    """
    # Special conditions for start value
    try:
        if start > len(arr):
            start = len(arr)
        # If start is negative, count backwards from end
        if start < 0:
            start = len(arr) - start
    except TypeError:
        # Non-integer start values are treated as 0 in js
        start = 0

    # Special condition when delete_count is greater than remaining elements
    if not delete_count or delete_count >= len(arr) - start:
        delete_count = len(arr) - start  # noqa: N806

    deleted_elements = arr[start:start + delete_count]

    # Splice appropriately.
    new_arr = arr[:start] + list(items) + arr[start + delete_count:]

    # Replace contents of input array
    arr.clear()
    for el in new_arr:
        arr.append(el)

    return deleted_elements

def map_functions(js_func: str) -> Callable:
    """For a given JavaScript transform function, return the Python equivalent.

    :param str js_func:
        The JavaScript version of the transform function.
    """
    mapper = (
        # function(a){a.reverse()}
        (r"{\w\.reverse\(\)}", reverse),
        # function(a,b){a.splice(0,b)}
        (r"{\w\.splice\(0,\w\)}", splice),
        # function(a,b){var c=a[0];a[0]=a[b%a.length];a[b]=c}
        (r"{var\s\w=\w\[0\];\w\[0\]=\w\[\w\%\w.length\];\w\[\w\]=\w}", swap),
        # function(a,b){var c=a[0];a[0]=a[b%a.length];a[b%a.length]=c}
        (
            r"{var\s\w=\w\[0\];\w\[0\]=\w\[\w\%\w.length\];\w\[\w\%\w.length\]=\w}",
            swap,
        ),
    )

    for pattern, fn in mapper:
        if re.search(pattern, js_func):
            return fn
    raise RegexMatchError(caller="map_functions", pattern="multiple")

Restart mopidy, and let's see if it works.

I just want to say I tested it and it still works without issues on up to date Ubuntu with the workaround I mentioned in the first post. Although I have same issues as everyone no Arch / Manjaro so it'd be beneficial if this PR got accepted.

Something strange is happening now. When I "sing-in" to my account via the auth_json file, I can not play (and can not search) any tracks. But when Youtube de-authorizes me, I can search and play.
Is this happening to you to?

@herkow Sorry for late response. I switched to jmcdo29's fork of this repository. As soon as @jmcdo29 accepts my PR his fork will be working out of the box - it's already used by Arch user repo package with some minor patching. For the time being you can use my fork which already includes that PR.

@herkow Sorry for late response. I switched to jmcdo29's fork of this repository. ~As soon as @jmcdo29 accepts my PR his fork will be~ working out of the box - it's already used by Arch user repo package.
edit: the PR got accepted, jmcdo29's repo is the most current one right now

I've installed from jmcdo29, but it cannot even setup:
hk@MEDIA:/etc/mopidy$ sudo mopidyctl ytmusic setup
Running "/usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf ytmusic setup" as user mopidy
INFO     [MainThread] mopidy.__main__ Starting Mopidy 3.4.1
INFO     [MainThread] mopidy.config Loading config from builtin defaults
INFO     [MainThread] mopidy.config Loading config from file:///usr/share/mopidy/conf.d/mopidy.conf
INFO     [MainThread] mopidy.config Loading config from file:///etc/mopidy/mopidy.conf
INFO     [MainThread] mopidy.config Loading config from command line options
INFO     [MainThread] mopidy.__main__ Enabled extensions: file, softwaremixer, m3u, stream, http
INFO     [MainThread] mopidy.__main__ Disabled extensions: ytmusic
WARNING  [MainThread] mopidy.__main__ Found ytmusic configuration errors. The extension has been automatically disabled:
WARNING  [MainThread] mopidy.__main__   ytmusic/oauth_json config key not found.
WARNING  [MainThread] mopidy.__main__ Please fix the extension configuration errors or disable the extensions to silence these messages.
ERROR    [MainThread] mopidy.__main__ Unable to run command provided by disabled extension ytmusic

ytmusic/oauth_json config key not found.

You need oauth_json in your mopidy [ytmusic] section with a path to where you want to keep the oauth.json file as there's no default location for it, e.g.:
[ytmusic]
oauth_json = /home/herkow/.config/mopidy/oauth.json

Run setup after you add it, it should work - it worked for me when I made that change.

ytmusic/oauth_json config key not found.

You need oauth_json in your mopidy [ytmusic] section with a path to where you want to keep the oauth.json file as there's no default location for it, e.g.:
[ytmusic]
oauth_json = /home/herkow/.config/mopidy/oauth.json

Run setup after you add it, it should work - it worked for me when I made that change.

Still unable to setup:
hk@MEDIA:/etc/mopidy$ sudo mopidyctl ytmusic setup
Running "/usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf ytmusic setup" as user mopidy
INFO     [MainThread] mopidy.__main__ Starting Mopidy 3.4.1
INFO     [MainThread] mopidy.config Loading config from builtin defaults
INFO     [MainThread] mopidy.config Loading config from file:///usr/share/mopidy/conf.d/mopidy.conf
INFO     [MainThread] mopidy.config Loading config from file:///etc/mopidy/mopidy.conf
INFO     [MainThread] mopidy.config Loading config from command line options
INFO     [MainThread] mopidy.__main__ Enabled extensions: ytmusic, file, stream, m3u, softwaremixer, http
INFO     [MainThread] mopidy.__main__ Disabled extensions: none
ERROR    [MainThread] mopidy.__main__ cannot import name 'setup_oauth' from 'ytmusicapi.setup' (/usr/local/lib/python3.11/dist-packages/ytmusicapi/setup.py)
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/mopidy/__main__.py", line 143, in main
    return args.command.run(args, proxied_config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/mopidy_ytmusic/command.py", line 20, in run
    from ytmusicapi.setup import setup_oauth
ImportError: cannot import name 'setup_oauth' from 'ytmusicapi.setup' (/usr/local/lib/python3.11/dist-packages/ytmusicapi/setup.py)
Traceback (most recent call last):
  File "/usr/bin/mopidy", line 33, in <module>
    sys.exit(load_entry_point('Mopidy==3.4.1', 'console_scripts', 'mopidy')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/mopidy/__main__.py", line 143, in main
    return args.command.run(args, proxied_config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/mopidy_ytmusic/command.py", line 20, in run
    from ytmusicapi.setup import setup_oauth
ImportError: cannot import name 'setup_oauth' from 'ytmusicapi.setup' (/usr/local/lib/python3.11/dist-packages/ytmusicapi/setup.py)
hk@MEDIA:/etc/mopidy$

Well, I've been trying to solve this, and cloned the repo (which says v0.3.9) just in case git+ is doing something crazy... But when I check the installed version, still shows 0.3.8... Last shot was to copy the old auth.json to oauth.json and now YTMusic appears in the client but is not possible to search, I can only access to YTMUSIC lists (mosts palyed, best of my country, etc.) There is no way to excute ytmusic setup and of course is not possible to reauth.
Any ideas?

@herkow I have no idea what you've done but you definitely had some mismatch in your installed packages because this:
ImportError: cannot import name 'setup_oauth' from 'ytmusicapi.setup' (/usr/local/lib/python3.11/dist-packages/ytmusicapi/setup.py)

says you don't have setup_oauth function in the linked file and it should be there in the current version.
I see you've managed to fix that part and the function imports and calls but on my setup it opens the default browser (or at least displays the URL to open in the browser manually) to login to YT, however, I'm not using sudo or mopidyctl or global configs in /etc so maybe it's that. AFAICT it's working fine on my Manjaro/Arch setup out of the box. Since you don't have any further errors displayed I'd suggest to install all dependencies from scratch, make sure they're the newest versions, and try to debug the code. It should work OK as long as this line is called:
    return RefreshingToken.prompt_for_token(oauth_credentials, open_browser, filepath)