Fix: Workspace picture not update in LHN

Details
Added avatar prop to the policySelector which will help to re-render the sidebar component when workspace avatar gets changed.
Fixed Issues

$ https://github.com/Expensify/App/issues/18226
PROPOSAL: https://github.com/Expensify/App/issues/18226#issuecomment-1529957726
Tests

Goto Settings -> Workspaces
Select any workspace -> General Settings
Upload photo
Verify the photo is updated in the LHN/sidebar option

[X] Verify that no errors appear in the JS console

Offline tests

Goto Settings -> Workspaces
Select any workspace -> General Settings
Upload photo
Verify the photo is updated in the LHN/sidebar option

QA Steps

Goto Settings -> Workspaces
Select any workspace -> General Settings
Upload photo
Verify the photo is updated in the LHN/sidebar option

[X] Verify that no errors appear in the JS console

PR Author Checklist

[X] I linked the correct issue in the ### Fixed Issues section above
[X] I wrote clear testing steps that cover the changes made in this PR

[X] I added steps for local testing in the Tests section
[X] I added steps for the expected offline behavior in the Offline steps section
[X] I added steps for Staging and/or Production testing in the QA steps section
[X] I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
[X] I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
[X] I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).

[X] I included screenshots or videos for tests on all platforms
[X] I ran the tests on all platforms & verified they passed on:

[X] Android / native
[X] Android / Chrome
[X] iOS / native
[X] iOS / Safari
[X] MacOS / Chrome / Safari
[X] MacOS / Desktop

[X] I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
[X] I followed proper code patterns (see Reviewing the code)

[X] I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
[X] I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
[X] I verified that comments were added to code that is not self explanatory
[X] I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
[X] I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method

[X] If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:

[X] I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
[X] I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
[X] I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
[X] I verified the JSDocs style guidelines (in STYLE.md) were followed

[X] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
[X] I followed the guidelines as stated in the Review Guidelines
[X] I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
[X] I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
[X] I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
[X] I verified that if a function's arguments changed that all usages have also been updated correctly
[X] If a new component is created I verified that:

[X] A similar component doesn't exist in the codebase
[X] All props are defined accurately and each prop has a /** comment above it */
[X] The file is named correctly
[X] The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
[X] The only data being stored in the state is data necessary for rendering and nothing else
[X] For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
[X] Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
[X] All JSX used for rendering exists in the render method
[X] The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions

[X] If any new file was added I verified that:

[X] The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory

[X] If a new CSS style is added I verified that:

[X] A similar style doesn't already exist
[X] The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))

[X] If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
[X] If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
[X] If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
[X] If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
[X] If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
[X] I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
https://user-images.githubusercontent.com/14358475/235992626-afb84b85-1e1f-4490-97d9-2b8ef9815388.mov
https://user-images.githubusercontent.com/14358475/235992750-05297a3e-9ede-4d39-8577-17451871d029.mov

Mobile Web - Chrome
https://user-images.githubusercontent.com/14358475/235997973-c81dec2f-80d8-4280-935c-2d805fa1814f.mov

Mobile Web - Safari
https://user-images.githubusercontent.com/14358475/235998303-197be670-b2e5-406a-81c4-ab669e5a70fc.mov

Desktop
https://user-images.githubusercontent.com/14358475/235999878-559ca775-82b1-4b68-8f38-ed20fc4932c9.mp4

iOS
https://user-images.githubusercontent.com/14358475/235998610-ca2fdf08-f202-43fa-ada8-cb4f0421c0cd.mp4

Android
https://user-images.githubusercontent.com/14358475/235999682-a2fb071d-1401-4f38-9ff7-540e94f40caf.mp4

@bondydaa @parasharrajat One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

My workspace chats are not visible on different devices. It is only visible on the device where I created it. @Pujan92 is it same for you?

@parasharrajat I am seeing that on the diff devices.

🚀 Deployed to staging by https://github.com/bondydaa in version: 1.3.11-1 🚀

platform
result

🤖 android 🤖
success ✅

🖥 desktop 🖥
success ✅

🍎 iOS 🍎
success ✅

🕸 web 🕸
success ✅

🚀 Deployed to production by https://github.com/roryabraham in version: 1.3.12-0 🚀

platform
result

🤖 android 🤖
success ✅

🖥 desktop 🖥
success ✅

🍎 iOS 🍎
success ✅

🕸 web 🕸
success ✅


[gradle] Concurrency issue with many simultaneous builds

Description of the issue: In a project that can run dozens of jib build tasks concurrently, an exception was thrown when working with the cache
Step #3 - "curio-generated-build-all": Caused by: com.google.cloud.tools.jib.plugins.common.BuildStepsExecutionException: Build image failed
Step #3 - "curio-generated-build-all": at com.google.cloud.tools.jib.plugins.common.BuildStepsRunner.build(BuildStepsRunner.java:269)
Step #3 - "curio-generated-build-all": at com.google.cloud.tools.jib.gradle.BuildImageTask.buildImage(BuildImageTask.java:119)
Step #3 - "curio-generated-build-all": at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Step #3 - "curio-generated-build-all": at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Step #3 - "curio-generated-build-all": at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Step #3 - "curio-generated-build-all": at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
Step #3 - "curio-generated-build-all": ... 133 more
Step #3 - "curio-generated-build-all": Caused by: java.nio.file.FileSystemException: /root/.cache/google-cloud-tools-java/jib/tmp/10954747174794241924 -> /root/.cache/google-cloud-tools-java/jib/layers/096ebeedeeb6534eadf6d1ae8173145e8f43aedf29f5ae179f8b2e899f84f344: Directory not empty
Step #3 - "curio-generated-build-all": at com.google.cloud.tools.jib.cache.DefaultCacheStorageWriter.moveIfDoesNotExist(DefaultCacheStorageWriter.java:75)
Step #3 - "curio-generated-build-all": at com.google.cloud.tools.jib.cache.DefaultCacheStorageWriter.write(DefaultCacheStorageWriter.java:154)
Step #3 - "curio-generated-build-all": at com.google.cloud.tools.jib.cache.DefaultCacheStorage.write(DefaultCacheStorage.java:74)
Step #3 - "curio-generated-build-all": at com.google.cloud.tools.jib.cache.Cache.writeCompressedLayer(Cache.java:68)
Step #3 - "curio-generated-build-all": at com.google.cloud.tools.jib.builder.steps.PullAndCacheBaseImageLayerStep.call(PullAndCacheBaseImageLayerStep.java:81)
Step #3 - "curio-generated-build-all": at com.google.cloud.tools.jib.builder.steps.PullAndCacheBaseImageLayerStep.call(PullAndCacheBaseImageLayerStep.java:36)
Step #3 - "curio-generated-build-all": at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
Step #3 - "curio-generated-build-all": at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57)
Step #3 - "curio-generated-build-all": at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
Step #3 - "curio-generated-build-all":

Expected behavior: The build succeeds
Steps to reproduce:  This only happens sometimes, and on a build with dozens of projects. I suspect it will be hard to reproduce with a small build.
Environment: Linux, Gradle 5.0-rc-4, Java 11, gradle-jib-plugin 0.10.0
jib-gradle-plugin Configuration:
Standard configuration, just lots of subprojects
Log output:
Step #3 - "curio-generated-build-all": Caused by: com.google.cloud.tools.jib.plugins.common.BuildStepsExecutionException: Build image failed
Step #3 - "curio-generated-build-all": at com.google.cloud.tools.jib.plugins.common.BuildStepsRunner.build(BuildStepsRunner.java:269)
Step #3 - "curio-generated-build-all": at com.google.cloud.tools.jib.gradle.BuildImageTask.buildImage(BuildImageTask.java:119)
Step #3 - "curio-generated-build-all": at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Step #3 - "curio-generated-build-all": at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Step #3 - "curio-generated-build-all": at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Step #3 - "curio-generated-build-all": at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
Step #3 - "curio-generated-build-all": ... 133 more
Step #3 - "curio-generated-build-all": Caused by: java.nio.file.FileSystemException: /root/.cache/google-cloud-tools-java/jib/tmp/10954747174794241924 -> /root/.cache/google-cloud-tools-java/jib/layers/096ebeedeeb6534eadf6d1ae8173145e8f43aedf29f5ae179f8b2e899f84f344: Directory not empty
Step #3 - "curio-generated-build-all": at com.google.cloud.tools.jib.cache.DefaultCacheStorageWriter.moveIfDoesNotExist(DefaultCacheStorageWriter.java:75)
Step #3 - "curio-generated-build-all": at com.google.cloud.tools.jib.cache.DefaultCacheStorageWriter.write(DefaultCacheStorageWriter.java:154)
Step #3 - "curio-generated-build-all": at com.google.cloud.tools.jib.cache.DefaultCacheStorage.write(DefaultCacheStorage.java:74)
Step #3 - "curio-generated-build-all": at com.google.cloud.tools.jib.cache.Cache.writeCompressedLayer(Cache.java:68)
Step #3 - "curio-generated-build-all": at com.google.cloud.tools.jib.builder.steps.PullAndCacheBaseImageLayerStep.call(PullAndCacheBaseImageLayerStep.java:81)
Step #3 - "curio-generated-build-all": at com.google.cloud.tools.jib.builder.steps.PullAndCacheBaseImageLayerStep.call(PullAndCacheBaseImageLayerStep.java:36)
Step #3 - "curio-generated-build-all": at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
Step #3 - "curio-generated-build-all": at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57)
Step #3 - "curio-generated-build-all": at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
Step #3 - "curio-generated-build-all":

Additional Information:
The OS is Linux (more specifically Google's Cloud Build VM with a build image based on debian), so I think atomic moves should work and would not expect #1044 to be related.

Also to clarify, /root/.cache is not saved across builds so it isn't related to having an old cache leftover (am looking forward to save the cache though after #1238 :) )

Looking at the javadocs, it seems like it is implementation specific whether existing files cause an exception or not when doing ATOMIC_MOVE. In my experience, ATOMIC_MOVE on Linux does indeed try to replace the existing file and FileAlreadyExistsExeception will never be thrown.

Your stack trace seems really odd: why is FileSystemException being thrown, and how is it being thrown from DefaultCacheStorageWriter.moveIfDoesNotExist() rather than the Files.move()?  After all, Files.move() is not a native function.
Can you describe your setup a bit more, @anuraaga?  I ran 20 different builds multiple times in parallel using copies of the same project, and didn't manage to trigger this.  I'm feeling a bit jealous :-)

This code in DefaultCacheStorageWriter.moveIfDoesNotExist() needs to catch and handle the general FileSystemException.  When a native function errors, UnixException#translateToIOException() handles a few specific errnos and otherwise throws a general FileSystemException, including ENOTEMPTY.
But in examining the underlying implementations of Files.move() I think our moveIfDoesNotExist() can be greatly simplified.  In UnixCopyFile#move(), which handles the bulk of the move implementation for Linux and MacOS, first calls out to rename(2); ATOMIC_MOVE only means that it stops there, otherwise it continues on to try copying-into-place.
We know that moveIfDoesNotExist() is only for moving a formed cache layer into place: if a directory by that name exists, then its contents should be exactly the same.
So I think we could just do:
  private static void moveIfDoesNotExist(Path source, Path destination) throws IOException {
    if (Files.exists(destination)) {
      return;
    }

    try {
      Files.move(source, destination, StandardCopyOption.ATOMIC_MOVE);

    } catch (FileSystemException ex) {
      if (!Files.exists(destination)) {
        throw ex;
      }
    }
  }

We could be conservative in the destination-exists case and ensure our content matched.  But we don't do any such validation in the already-exists case.

You mean not giving the ATOMIC_MOVE in the simpified code, right? I am not confident if it is a good idea to make our code depend on the specific platform implementation.

@briandealwis Thanks for the digging! As for our setup, some other info is

All base images are openjdk:11-slim (base images is quite larger than distroless so may trigger more?)

We are using a highcpu-32 build machine on Cloud Build. Lots and lots of cores available.

Other than that, just simple Java builds getting built by jib, nothing special

@chanseokoh you're right, I meant to not include the ATOMIC_MOVE.  The standard implementation does try to do an atomic-move and then copies and moves otherwise, similar to what we're doing.

Hello - just wondering, does it make sense to make a PR with the change from https://github.com/GoogleContainerTools/jib/issues/1273#issuecomment-441086981 ? Then I can try reenabling parallel builds again :D

@anuraaga I pushed up a branch at
https://github.com/GoogleContainerTools/jib/tree/i1273
Is it possible for you to build it locally and see if you can reproduce the issue?

Hmm - we use this build to push alpha servers from the master branch in our CI, which is a much more powerful machine than my workstation. So I'm not confident I could repro this with a local build. I was sort of hoping the stacktrace would be definitive enough even if it's hard to repro.
Does jib have snapshot builds on sonatype or similar? It'd be hard to try a local build on our CI but I would be able to try a published snapshot without too much difficulty.

You can use the build from jitpack.io:
https://jitpack.io/#GoogleContainerTools/jib/i1273-SNAPSHOT

I managed to coax a build from JitPack but the Maven deems the plugin as invalid as the JitPack coordinates don't match the plugin descriptor's coordinates:
[ERROR] Invalid plugin descriptor for com.github.GoogleContainerTools.jib:jib-maven-plugin:i1273-SNAPSHOT (/Users/bsd/.m2/repository/com/github/GoogleContainerTools/jib/jib-maven-plugin/i1273-fdf8a19181-1/jib-maven-plugin-i1273-fdf8a19181-1.jar), Plugin's descriptor contains the wrong group ID: com.google.cloud.tools, Plugin's descriptor contains the wrong version: 0.10.2-SNAPSHOT -> [Help 1]

and there doesn't seem to be any way to ignore this validation.

That link looks like it's about maven - as my PR title shows I'm using Gradle :) Gradle didn't seem to complain when I tried this locally and I'm going to try on our master build tomorrow.

Thanks for testing @anuraaga!


Binance Exception -1013 : LOT_SIZE

When placing an order on Binance, I get the error below.
Have tried both, version 4.3.1 and the development source, but no luck. Also checked the Binance API description directly, but could not find any useful references.
Any suggestions how to resolve this issue would be greatly appreciated.
Exception in thread "main" org.knowm.xchange.binance.dto.BinanceException: -1013: Filter failure: LOT_SIZE
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.fasterxml.jackson.databind.introspect.AnnotatedConstructor.call(AnnotatedConstructor.java:124)
at com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.createFromObjectWith(StdValueInstantiator.java:274)
at com.fasterxml.jackson.databind.deser.ValueInstantiator.createFromObjectWith(ValueInstantiator.java:228)
at com.fasterxml.jackson.databind.deser.impl.PropertyBasedCreator.build(PropertyBasedCreator.java:189)
at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeUsingPropertyBased(BeanDeserializer.java:421)
at com.fasterxml.jackson.databind.deser.std.ThrowableDeserializer.deserializeFromObject(ThrowableDeserializer.java:65)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:159)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4001)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3030)
at si.mazi.rescu.serialization.jackson.JacksonResponseReader.read(JacksonResponseReader.java:53)
at si.mazi.rescu.serialization.jackson.JacksonResponseReader.readException(JacksonResponseReader.java:58)
at si.mazi.rescu.ResponseReader.read(ResponseReader.java:82)
at si.mazi.rescu.RestInvocationHandler.mapInvocationResult(RestInvocationHandler.java:169)
at si.mazi.rescu.RestInvocationHandler.receiveAndMap(RestInvocationHandler.java:157)
at si.mazi.rescu.RestInvocationHandler.invoke(RestInvocationHandler.java:120)
at com.sun.proxy.$Proxy16.newOrder(Unknown Source)
at org.knowm.xchange.binance.service.BinanceTradeServiceRaw.newOrder(BinanceTradeServiceRaw.java:32)
at org.knowm.xchange.binance.service.BinanceTradeService.placeLimitOrder(BinanceTradeService.java:70)
...

I had the same problem placing orders on binance using amounts like 762.223344. I think they only accept 2 digits after the point. I think they have some pre-defined sizes depending on the currency you want to place an order on.

I found something similar via google: https://www.reddit.com/r/binance/comments/7ej5cn/api_error_code1013_filter_falinure_price_filter/
There is a list of pais with min amount, etc. here: https://support.binance.com/hc/en-us/articles/115000594711-Trading-Rule, which someone could compile in the binance.json file to make it available via the MetaData.

@timmolter it seems like, at least on Binance, that exchange.getExchangeInfo() allows to see all the necessary information to round up our quantities or prices accordingly with Xchange?
Was it a recent implementation? If yes, I would be interested to see the commits, to know if it applies to more exchanges than Binance :)
For all, here is the utility Java class I've prepared to automatically round my prices or quantities accordingly to the exchange and coins being traded (first version here is only for Binance for now):
https://pastebin.com/rNiwK9h9

i i wonder if rounding should be done automatically, eg gnt/btc 100 ok, 100.1 not ok lot error
BinanceException: -1013: Filter failure: LOT_SIZE
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
java.lang.reflect.Constructor.newInstance(Constructor.java:423)


adjustments to README.md

Thank you very much @smoothdeveloper . This improvements are appreciated a lot!


fix: ci builds for 3.x, using github instead of travis

travis was not behaving and this upset me greatly, this should do the things with github ci


Trying to link to FASTlib static library from another program

Hi,
I am trying to link my project to the FASTlib static library (after compiling vs-build/FAST). I added FASTlib_x64_Debug.lib as one additional dependencies and created a new module (in my project) in which I am calling FAST_Subs module and some FAST variables:
MODULE OPENFAST

USE FAST_SUBS

IMPLICIT NONE

CONTAINS

SUBROUTINE OPENFAST_Lib_Coupling(InFile)
    REAL(DbKi),             PARAMETER     :: t_initial = 0.0_DbKi
    INTEGER(IntKi),         PARAMETER     :: NumTurbines = 1
    TYPE(FAST_TurbineType)                :: Turbine(NumTurbines)
...

After trying to build my project it seems I cannot open the compiled (FAST) modules which I think should be available in the library:

Might be possible to get a word of advice in the correct way to get this coupling between FAST library with another module?
Thanks,
Juan

During compilation, the compiler needs to know where the "mod" files are to know the "interface" of the functions/types/variables from FASTlib that you are using.  The error message tells you which "mod" files are not found.
Look for the directory where the "*.mod" files of OpenFAST are, typically vs-build/FASTlib/x64/Debug . You'll need to add this directory to your include directory:

Using the command line, include directories are added with the option -I DIRECTORY .
Using the Visual studio GUI, you have to go to: Configuration Properties > Fortran > Additional Include Directories.

You might need to add several directories, I'm not sure.
During linking,  the linker (librarian) will need to know where the additional libraries/objects are (in your case FASTLib.lib).  In Visual Studio this is in: Librarian > General > Additional dependencies.

Thank you @ebranlard. That worked!


Cannot call AlertWindow.addProgressBarComponent from Lua

The wrapper for addProgressBarComponent() method on LAlertWindow.cpp cannot be called from Lua because it requires the progressValue parameter to be passed as reference (which is not possible from Lua, unless I'm missing something).
We really need a way to handle progress bars in Ctrlr to give feedback to the user while a long running MIDI operation is being performed. Having it in a modal window seems a good option since we don't want the user to perform other operations while a MIDI dump is in progress.
I've been trying to use the ThreadWithProgressWindow but threading in Lua seems to cause some problems (Ctrlr crashes every once in a while...).

THis might be problematic but i will try to do something that will make a progress bar usable.

That would be great ! ;-)
I'm not sure we need threading for the progress bar : in my case, progress update is triggered by an incoming midi message (ack sent by the device when a frame is received).
You can check my current implementation based on ThreadWithProgressWindow here : http://ctrlr.org/hughes-kettner-grandmeister-36/
The thread method only does that :
function progressThreadFunction()
while presetsToSend ~= nil and presetsToSendIndex <= presetsToSendSize do
lastThreadCall = Time.getMillisecondCounterHiRes()
sleep(100)
end
end
It's only used to detect a user cancellation (since putting lua code after the modal window is closed by a user cancel makes Ctrlr crash).

I added a component called uiProgressBar, you can control it using standard Lua methods. Just create one of those on the panel, and set it's value like
c = panel:getComponent("progressBar")
c:setComponentValue (0.5, true) -- for 50%
c:setComponentValue (-1, true) -- to make the progress bar spin
c:setComponentValue (0.1, true) -- for 10%
c:setComponentText("What's up?") -- to set what's displayed on the progress bar

Great, thank you for that !
I just tested it, it works perfectly.
Could you generate an OSX build of the 5.6.32 ?


Flyout in ListView doesn't open for selected item

Describe the bug
Sample: https://github.com/davidegiacometti/flyout-bug
ListView with an AttachedFlyout on the item.
RightTapped on the item show the flyout.
Steps to reproduce the bug
Usually happens if you reproduce the steps 2 or 3 times in a row fast.
1 select an item of the list
2 right click
3 flyout not showed
Expected behavior
Flyout should always be opened
Screenshots

Red dot: mouse right click
NuGet package version
WinUI 3 - Windows App SDK 1.1.5
Windows app type

[ ] UWP
[X] Win32

Device form factor
Desktop
Windows version
Windows 10 (21H2): Build 19044
Additional context
No response

I have news.
The issue is in the ShowAt call:
flyoutBase.ShowAt(owner, new FlyoutShowOptions
{
    Position = e.GetPosition(owner),
});

If I pass ShowMode = FlyoutShowMode.Transient the issue doesn't happen but the context menu doesn't get focus.

Still happening with latest stable 1.3.230602002 and latest preview 1.4.230628000.

This seems to work fine for me. I do see that sometime the flyout does not open. That might be because the right_tapped handler is on the TextBlock and there is area outside the TextBlock where you can click. Adding the handler on the ListViewItem itself might avoid that.


Get FCM token without using Firebase SDK

Is there a way having the firebase apiKey, to get the registering serviceworker IID_TOKEN? (without using firebase libraries I mean.. with a fetch)
From javascript in a webapp I use:
iid_token=await firebase.messaging().getToken()
Is there a way to do the same without the firebase libraries?
I am trying to code a very minmal app.
Thanks.

No answer???
Today it seems I can't even get the token using iid_token=await firebase.messaging().getToken()
The promise stays pending :(

You may be able to do this by following the Chrome docs: https://developers.google.com/web/updates/2015/03/push-notifications-on-the-open-web#sending_a_push_message
@kroikie any tips?

/
Details


Create a logging scope per connection

After seeing HostingLogScope, I realized we need the equivalent for Kestrel connections.
11 of the 13 special log functions defined in KestrelTrace take the connect id as a logging parameter. Of the remaining 2, KestrelTrace.ApplicationError really should log the connection id but doesn't. It would be far more elegant to create a logging scope that includes the connection id assuming that these can be nested. This will also prevent future oversights like the one in ApplicationError.
An added benefit is that we could lazily serialize the connection id like we do with the request id since we're not constantly passing a connection id string to logging methods. See #638
Note: we will have to be careful when logging outside of the connection's async loop (such as in callbacks on the libuv thread) since the AsyncLocal backing for the scope (I assume that what's being used) won't be available. In those cases I imagine we log connection id's like we do today, but check the loglevel before calling the log method so we don't have to serialize the connection id unnecessarily. That's assuming we can't delay the logging until we get back on the async loop.

Isn't AsyncLocal for HostingLogScope as AsyncLocal modifies the execution context from default and would be seeing lots of ExectionContext allocations like you see when using the HttpContextAccessor

Ultimately I think it's up to the logger how they implement scopes. The console logger uses AsyncLocal/CallContext, but it seems you would only pay for it if you use it.
It looks like our NLogLoggerProvider uses a NestedDiagnosticsContext for scopes which is only backed by a thread-local structure. I imagine this would be more efficient, but completely break HostingLogScope and the suggested connection scope. Maybe we should use MappedDiagnosticsLogicalContext instead?
I don't think performance should be a concern here since Hosting creates even more scopes, and Hosting's request scopes will be implemented the same way as connection scopes.

I don't think performance should be a concern here since Hosting creates even more scopes,

Working on it ;-) https://github.com/aspnet/Hosting/pull/609 and https://github.com/aspnet/Logging/issues/366

Cool. We can follow whatever pattern we decide on for Hosting then :smile:

Max pooling (https://github.com/aspnet/Performance/pull/67) allocs cirrently looks like this over 1M req

Backlogging for now, we'll bring it back as needed.

cc @shirhatti, what's the wanted behavior?

We should do this in 2.1

Turns out this is a little more complicated than the current implementation as it doesn't work for multiple requests.

Turns out this is a false alarm. Seems like I was running old kestrel bits...


Slider maximums (and sometimes also minimums) should be more dynamic

Problems now:

sometimes slider ranges have been set so wide, that imputing a normal number is just ridiculously difficult
sometimes slider ranges are too low and do not allow your value

One of the ideas I like (courtesy of @dennisschoenmakers) is to allow the user to drag some sliders beyond their current range:

This would provide a lot of flexibility without having to change the look and feel of the current interface.


updated site content

updated site data, updated events

Great job, Remove the bundle, bin, ruby, etc folders, and commit only changes to the website in that folder.


SOAP T-Shirt

Original placeholder = 21 points
Reducing to 13 points 8/20 due to adding two cards:

https://app.zenhub.com/workspace/o/smartcitiesdata/smartcitiesdata/issues/865 (3pts)
https://app.zenhub.com/workspace/o/smartcitiesdata/smartcitiesdata/issues/859 (5pts)

Reducing to 10pts per conversation with Jarred on 9/4 regarding remaining work.

Removing remaining points. Epic is complete.


chore(main): release 0.1.0

:robot: I have created a release beep boop
0.1.0 (2024-04-12)
Miscellaneous Chores

release 0.1.0 (11dc471)

This PR was generated with Release Please. See documentation.

:robot: Release is at https://github.com/luisgabrielroldan/ddogzip/releases/tag/v0.1.0 :sunflower:


EXT: Assembly diagram shows <> stereotype

Issue and tracking information
Developer's time Estimated effort to fix (hours):
Developer's Actual time spent on fix (hours)
Issue reporter to provide a detailed description of the issue in the space below
Assembly diagram shows <> stereotype in the title which is misleading to the average developer. We would prefer for assembly diagrams to show <>

Fix merged to the papyrus branch

I have verified this fix. Thank you.

Thanks


Remove wrong import from middleware context example

I just noticed I left this import in my example code (A)

thanks!


[Desktop][Mobile] Display Playstore and Apple store icon on Organization profile.

As a user,
When, I have entered the Google Playstore or Apple Playstore link in the organization profile info,
Then I should see the Google Playstore icon or Apple Playstore icon on my Organization profile.
Google Playstore icon: https://zpl.io/beRoykP
Apple Playstore icon: https://zpl.io/brwWGMD
Related to #1089 issue.

This is a duplicate. Let's add the context to 1089...


Table th tabIndex cant be unset

Column headerAttrs param can't be used to unset default tabIndex behaviour
column.headerAttrs: () => ({ tabIndex: false })
does not work.
Line 44 tabIndex: 0 should be moved before headerAttrs in following code
https://github.com/react-bootstrap-table/react-bootstrap-table2/commit/4ec02b294afa876155088fc7140c2f13ec2b0aa2

@jendamozna I will fix it soon

@jendamozna please upgrade react-bootstrap-table-next to newest version so that you can set tabIndex.  As default, tabIndex is still 0

thanks


Remote Desktop started

Is it possible when I start a remote desktop for the notification to not pop up on the victim? They said everytime I start it they get a notification

Please read the docs: https://github.com/quasar/Quasar/wiki/Client-deployment-settings#unattended-mode

so if I check unattended mode they wont get a nitofication?

Yes


int(x) warnings suppressed

these lines generate deprecated warnings with julia 0.4

Looks good, thanks!


Original  is lost when body tag is emitted due to illegal tag in

Consider the following document:
<!doctype html>
<html>
  <head>
    <img>
  </head>
  <body class='cls'>
  </body>
</html>

The browser parses this as containing a body with class cls. (JSFiddle)
When using Markup.ml the attributes on the body tag are lost because a replacement body tag seems to be generated because of the img in the head.
This is unfortunate, because in my use case the body element has structured data attributes that I want to extract.
I've added an incomplete start to a test case on my branch body-attrs-after-bad-head, but I don't really know how to resolve this without losing the desirable semantics of generating a body tag if it is missing altogether.
Hope you have some ideas.  Thanks for your time.

This is caused by a limitation of Markup.ml's design, namely that Markup.ml is a streaming parser (it deliberately does not parse the whole document before emitting signals). In contrast, HTML5 specifies a non-streaming parser that has access to the entire DOM tree throughout parsing, and can make non-local modifications to elements based on input that occurs much later than the input which created the elements. The conversion to streaming is mostly faithful, but there are a few cases (I recall three) where a correct conversion is impossible, all because they would inherently require reading the whole document in order to emit a given element correctly:

Nested (explicitly or due to error recovery) <body> elements, as in this issue. The spec requires

for each attribute on the token, check to see if the attribute is already present on the body element (the second element) on the stack of open elements, and if it is not, add the attribute and its corresponding value to that element.

Nested <html> elements, for the same kind of reason.

Certain bad <table> inputs.

This is described with much less detail in Conformance status.
My idea for addressing this was to change the parser to emit richer nesting errors, so that a user who is building a DOM can implement the non-local correction themselves. It is already possible to observe the errors emitted by the parser by using the ?report argument of parse_html:
Markup.(parse_html
  ?report:(fun location e -> prerr_endline (Error.to_string ~location e))
  input

I think Error.t can be extended to carry attribute information, which can then be included when reporting the nested body tag here:
https://github.com/aantron/markup.ml/blob/6d082308caa9ef01894e5d2d0485b1d16b58f2be/src/html_parser.ml#L1647-L1648
I'd probably also add a helper that can implement the spec's check

for each attribute on the token, check to see if the attribute is already present on the body element (the second element) on the stack of open elements, and if it is not, add the attribute and its corresponding value to that element.

by walking along two attribute lists, but maybe this isn't so useful, as it depends on the user's DOM representation. At least, I would document what should be done in this case according to the spec (which the user can choose to ignore if they want to).

Thanks for your quick and elucidating response.
I'm using Lambda Soup.  It looks like Lambda Soup is not currently using ~report.  If I understand correctly, we could extend markup.ml to include attribute data in the error, and Lambda Soup to propagate attributes on misnested body elements to the generated body element using ~report.
We can define `Misnested_tag of string * string * (string * string list), or `Misnested_tag of Token_tag.t * string.  The latter would appear more sensible to me as it simplifies a lot of the code generating this error:
    | l, `Start t ->
      report l (`Misnested_tag (t, "head")) !throw mode

instead of:
    | l, `Start {name = "head"; attributes} ->
      report l (`Misnested_tag ("head", "head", attributes)) !throw mode

What do you think?

we could extend markup.ml to include attribute data in the error, and Lambda Soup to propagate attributes on misnested body elements to the generated body element using ~report.

That seems right.

We can define `Misnested_tag of string * string * (string * string list), or `Misnested_tag of Token_tag.t * string.

At least at first glance, I prefer the former, for two reasons:

To avoid exposing an extra type or type abbreviation in the interface.
Token_tag.t, in particular, has an additional self_closing field, and may have other fields that are not meant for the user to depend on. In general, it's an internal type and I'd like to retain the ability to change it at will, in principle.

As for the syntax in the source code of Markup.ml itself, it seems that we can get the shorter syntax by just defining a helper that will take the right parts out of t anyway, though I probably would first just use patterns like in your second example, until I became convinced that it is too annoying to do it that way :)

The Markup.ml part of this was addressed by @apeschar in #55. Thanks again!

Closing this, problem should be fixed wherever one uses Markup.ml.  I will probably submit a PR for Lambda Soup soon.


FF-309

Coverage remained the same at 50.24% when pulling d0609d470de3a1590191541f7a7fc60a42073447 on Add_geo into a64dfeeaad1ebfa6e959179e365c77e331d3c6e3 on master.


Gettiing Started

Greetings,
I am very interested in using OBS in my project. Are there directions on how best to get started?

Best place to get started is readme of this repo. Most of instructions are given there. Most APIs are same as bonescript so it should not be of much issue.

I guess what I was wondering is how to use this as a replacement for bonescript. I now understand that one can just npm install it, and begin using it by require('octalbonescript').
Is it necessary to disable the bonescript server?
via systemctl disable bonescript-autorun.service and systemctl disable bonescript.socket

@TechplexEngineer I have completed documentation at https://github.com/theoctal/octalbonescript/tree/master/docs You can check it and suggest edits if you find some improvements. Even though I wrote unit tests, it would be great if you can test the library on beagle bone to check for any issues.
I will release v1.0 after 2-3 days of testing on my own.


Feature request: haptic feedback

Hi,
I thought that adding haptic feedback to the device would be very cost effective and give a very professional touch. It can be easily done through one of these cheap devices https://cdn-shop.adafruit.com/970x728/1201-01.jpg (just as an example) that are super easy to integrate.
What do you think?

The Keypress Beep function, coupled w/ a motor controller and small vibration motor should get this done!


VDP_setTileMapEx WINDOW not functional

hi  i test ..  the sgdk  and in doc  of  function VDP_setTileMapEx
the plane can be window but i try  with "BG_A" of "BG_B"  the tilmap as displayed
but with "WINDOW" plane nothing
VDP_setTileMapEx(BG_B, ctmap, TILE_ATTR_FULL(PAL1, FALSE, FALSE, FALSE, idx2), 0, 0, 0, 0, 20, 28, CPU); functional
VDP_setTileMapEx(WINDOW, ctmap, TILE_ATTR_FULL(PAL1, FALSE, FALSE, FALSE, idx2), 0, 0, 0, 0, 20, 28, CPU);  not diplayed
i change just  the first  argument   ? i forgot something ?

You need to enable the window first using the VDP_setWindowHPos() and VDP_setWindowVPos() method

oh i have thinks that use VDP_setWindowHPos()  but ... after not before

Yeah it's normal, BG_A and window are shared so they can't display on same area.

ok thank for  precisions


Image not displaying in ImageCell from external path

I'm using ListView with ImageCell. Binded With ObservableCollection, ListView shows images from resources but when I add new ImageSource of external Image -- Out of the project, Gallary on Android, other drives or directory on UWP, Does not display.

Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ID: 3218187d-58a5-a214-4a23-bd2093e771b7
Version Independent ID: 7a506e7e-e8c9-2bc4-148b-34529ce3afad
Content: Xamarin.Forms ListView - Xamarin
Content Source: docs/xamarin-forms/user-interface/listview/index.md
Product: xamarin
GitHub Login: @davidbritch
Microsoft Alias: dabritch

@yawarali please report product issues by clicking on the Product feedback button at the bottom of the documentation page, or visit the Developer Community site directly to search and add issues or suggestions.


Google Social Authentication throws Invalid id_token

I'm using dj-rest-auth on the backend and NextAuth.js on the frontend. After successfully logging in via NextAuth.js I get the following account passed to my signIn callback:
{
  provider: "google",
  type: "oauth",
  providerAccountId: "177780422328299215542",
  access_token: "%access_token%",
  expires_at:<PHONE_NUMBER>,
  refresh_token: "%refresh_token%",
  scope: "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile openid",
  token_type: "Bearer",
  id_token: "%id_token%"
}

access_token is a random string of characters. Not decodable by jwt.io.
id_token is a JWT token (header.payload.signature). It is decodable by jwt.io.

I then forward the access_token and id_token to my dj-rest-auth Google endpoint defined like this:
from allauth.socialaccount.providers.google.views import GoogleOAuth2Adapter
from allauth.socialaccount.providers.oauth2.client import OAuth2Client, OAuth2Error
from dj_rest_auth.registration.views import SocialLoginView

class GoogleLogin(SocialLoginView):  # Authorization Code grant
    adapter_class = GoogleOAuth2Adapter
    callback_url = "http://localhost:3000/api/auth/callback/google"
    client_class = OAuth2Client

I use the following request code:
const options = {
  method: 'POST',
  url: 'http://<IP_ADDRESS>:8000/api/auth/google/',
  headers: {
    'Content-Type': 'application/json'
  },
  data: {
    access_token: '%access_token%',
    id_token: '%id_token%'
  }
};

axios.request(options).then(function (response) {
  console.log(response.data);
}).catch(function (error) {
  console.error(error);
});

This request fails with an error saying:
Not enough segments
Internal Server Error: /api/auth/google/
Traceback (most recent call last):
  File ".\venv\lib\site-packages\jwt\api_jws.py", line 251, in _load
    header_segment, payload_segment = signing_input.split(b".", 1)
ValueError: not enough values to unpack (expected 2, got 1)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File ".\authentication\views.py", line 33, in complete_login
    identity_data = jwt.decode(
  File ".\venv\lib\site-packages\jwt\api_jwt.py", line 168, in decode
    decoded = self.decode_complete(
  File ".\venv\lib\site-packages\jwt\api_jwt.py", line 120, in decode_complete
    decoded = api_jws.decode_complete(
  File ".\venv\lib\site-packages\jwt\api_jws.py", line 191, in decode_complete
    payload, signing_input, header, signature = self._load(jwt)
  File ".\venv\lib\site-packages\jwt\api_jws.py", line 253, in _load
    raise DecodeError("Not enough segments") from err
jwt.exceptions.DecodeError: Not enough segments

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File ".\venv\lib\site-packages\django\core\handlers\exception.py", line 55, in inner
    response = get_response(request)
  File ".\venv\lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File ".\venv\lib\site-packages\django\views\decorators\csrf.py", line 56, in wrapper_view
    return view_func(*args, **kwargs)
  File ".\venv\lib\site-packages\django\views\generic\base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
  File ".\venv\lib\site-packages\django\utils\decorators.py", line 46, in _wrapper
    return bound_method(*args, **kwargs)
  File ".\venv\lib\site-packages\django\views\decorators\debug.py", line 92, in sensitive_post_parameters_wrapper
    return view(request, *args, **kwargs)
  File ".\venv\lib\site-packages\dj_rest_auth\views.py", line 48, in dispatch
    return super().dispatch(*args, **kwargs)
  File ".\venv\lib\site-packages\rest_framework\views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File ".\venv\lib\site-packages\rest_framework\views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File ".\venv\lib\site-packages\rest_framework\views.py", line 480, in raise_uncaught_exception
    raise exc
  File ".\venv\lib\site-packages\rest_framework\views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File ".\venv\lib\site-packages\dj_rest_auth\views.py", line 125, in post
    self.serializer.is_valid(raise_exception=True)
  File ".\venv\lib\site-packages\rest_framework\serializers.py", line 227, in is_valid
    self._validated_data = self.run_validation(self.initial_data)
  File ".\venv\lib\site-packages\rest_framework\serializers.py", line 429, in run_validation
    value = self.validate(value)
  File ".\venv\lib\site-packages\dj_rest_auth\registration\serializers.py", line 151, in validate
    login = self.get_social_login(adapter, app, social_token, response={'id_token': token})
  File ".\venv\lib\site-packages\dj_rest_auth\registration\serializers.py", line 60, in get_social_login
    social_login = adapter.complete_login(request, app, token, response=response)
  File ".\authentication\views.py", line 46, in complete_login
    raise OAuth2Error("Invalid id_token") from e
allauth.socialaccount.providers.oauth2.client.OAuth2Error: Invalid id_token

After some testing I figured out that response["id_token"] in complete_login returns the request's access_token and not the id_token.
print(response["id_token"])
# prints out {'id_token': '%access_token%'}

Sending your id_token as the access_token without providing id_token seems to work:
const options = {
  method: 'POST',
  url: 'http://<IP_ADDRESS>:8000/api/auth/google/',
  headers: {
    'Content-Type': 'application/json'
  },
  data: {
    access_token: '%id_token%'
  }
};

axios.request(options).then(function (response) {
  console.log(response.data);
}).catch(function (error) {
  console.error(error);
});

Is this the expected behaviour? Am I missing something?

I had this same problem and came to the similar conclusion. In my case I overrode GoogleOAuth2Adapter and changed response["id_token"] to response["id_token"]["id_token"] which fixed it.

Yeah, I only passed access_token to dj_rest_auth endpoint and it worked, as
there was nothing as id_token returned from the Google client library..
On Mon, 24 Apr 2023, 16:54 Nik Tomazic, @.***> wrote:

I'm using dj-rest-auth on the backend and NextAuth.js
https://next-auth.js.org/ on the frontend. After successfully logging
in via NextAuth.js I get the following account passed to my signIn
callback:
{
provider: "google",
type: "oauth",
providerAccountId: "177780422328299215542",
access_token: "%access_token%",
expires_at:<PHONE_NUMBER>,
refresh_token: "%refresh_token%",
scope: "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile openid",
token_type: "Bearer",
id_token: "%id_token%"
}

access_token is a random string of characters. Not decodable by
jwt.io.
id_token is a JWT token (header.payload.signature). It is decodable
by jwt.io.

I then forward the access_token and id_token to my dj-rest-auth Google
endpoint defined like this:
from allauth.socialaccount.providers.google.views import GoogleOAuth2Adapterfrom allauth.socialaccount.providers.oauth2.client import OAuth2Client, OAuth2Errorfrom dj_rest_auth.registration.views import SocialLoginView
class GoogleLogin(SocialLoginView):  # Authorization Code grant
adapter_class = GoogleOAuth2Adapter
callback_url = "http://localhost:3000/api/auth/callback/google"
client_class = OAuth2Client
I use the following request code:
const options = {
method: 'POST',
url: 'http://<IP_ADDRESS>:8000/api/auth/google/',
headers: {
'Content-Type': 'application/json'
},
data: {
access_token: '%access_token%',
id_token: '%id_token%'
}};
axios.request(options).then(function (response) {
console.log(response.data);}).catch(function (error) {
console.error(error);});
This request fails with an error saying:
Not enough segments
Internal Server Error: /api/auth/google/
Traceback (most recent call last):
File ".\venv\lib\site-packages\jwt\api_jws.py", line 251, in _load
header_segment, payload_segment = signing_input.split(b".", 1)
ValueError: not enough values to unpack (expected 2, got 1)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File ".\authentication\views.py", line 33, in complete_login
identity_data = jwt.decode(
File ".\venv\lib\site-packages\jwt\api_jwt.py", line 168, in decode
decoded = self.decode_complete(
File ".\venv\lib\site-packages\jwt\api_jwt.py", line 120, in decode_complete
decoded = api_jws.decode_complete(
File ".\venv\lib\site-packages\jwt\api_jws.py", line 191, in decode_complete
payload, signing_input, header, signature = self._load(jwt)
File ".\venv\lib\site-packages\jwt\api_jws.py", line 253, in _load
raise DecodeError("Not enough segments") from err
jwt.exceptions.DecodeError: Not enough segments
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File ".\venv\lib\site-packages\django\core\handlers\exception.py", line 55, in inner
response = get_response(request)
File ".\venv\lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File ".\venv\lib\site-packages\django\views\decorators\csrf.py", line 56, in wrapper_view
return view_func(*args, **kwargs)
File ".\venv\lib\site-packages\django\views\generic\base.py", line 104, in view
return self.dispatch(request, *args, **kwargs)
File ".\venv\lib\site-packages\django\utils\decorators.py", line 46, in _wrapper
return bound_method(*args, **kwargs)
File ".\venv\lib\site-packages\django\views\decorators\debug.py", line 92, in sensitive_post_parameters_wrapper
return view(request, *args, **kwargs)
File ".\venv\lib\site-packages\dj_rest_auth\views.py", line 48, in dispatch
return super().dispatch(*args, **kwargs)
File ".\venv\lib\site-packages\rest_framework\views.py", line 509, in dispatch
response = self.handle_exception(exc)
File ".\venv\lib\site-packages\rest_framework\views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File ".\venv\lib\site-packages\rest_framework\views.py", line 480, in raise_uncaught_exception
raise exc
File ".\venv\lib\site-packages\rest_framework\views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
File ".\venv\lib\site-packages\dj_rest_auth\views.py", line 125, in post
self.serializer.is_valid(raise_exception=True)
File ".\venv\lib\site-packages\rest_framework\serializers.py", line 227, in is_valid
self._validated_data = self.run_validation(self.initial_data)
File ".\venv\lib\site-packages\rest_framework\serializers.py", line 429, in run_validation
value = self.validate(value)
File ".\venv\lib\site-packages\dj_rest_auth\registration\serializers.py", line 151, in validate
login = self.get_social_login(adapter, app, social_token, response={'id_token': token})
File ".\venv\lib\site-packages\dj_rest_auth\registration\serializers.py", line 60, in get_social_login
social_login = adapter.complete_login(request, app, token, response=response)
File ".\authentication\views.py", line 46, in complete_login
raise OAuth2Error("Invalid id_token") from e
allauth.socialaccount.providers.oauth2.client.OAuth2Error: Invalid id_token

After some testing I figured out that response["id_token"] in
complete_login returns the request's access_token and not the id_token.
print(response["id_token"])# prints out {'id_token': '%access_token%'}
Sending your id_token as the access_token without providing id_token
seems to work:
const options = {
method: 'POST',
url: 'http://<IP_ADDRESS>:8000/api/auth/google/',
headers: {
'Content-Type': 'application/json'
},
data: {
access_token: '%id_token%'
}};
axios.request(options).then(function (response) {
console.log(response.data);}).catch(function (error) {
console.error(error);});
Is this the expected behaviour? Am I missing something?
—
Reply to this email directly, view it on GitHub
https://github.com/iMerica/dj-rest-auth/issues/503, or unsubscribe
https://github.com/notifications/unsubscribe-auth/ASMTYPFSD6SPWZ4HZRZX2Y3XCZSXPANCNFSM6AAAAAAXJO35P4
.
You are receiving this because you are subscribed to this thread.Message
ID: @.***>

I'm very resistant to passing id_token to access_token, but it works anyway.
Furthermore, in my case, I am also currently getting an error in the response where the refresh_token is returned as "".

@cplanck Actually I'm using dj-rest-auth with djangorestframework-simplejwt (https://django-rest-framework-simplejwt.readthedocs.io/en/latest/getting_started.html# ), so I guess it is not dj-rest-auth's fault.
But I'm looking for someone in  the same situation.

This error only occurs with dj-rest-auth version 3.0.0. I fixed downgraded to2.2.8.

This error only occurs with dj-rest-auth version 3.0.0. I fixed downgraded to2.2.8.

I suppose this response is referring to the JWT problem, correct? I tried it with 2.2.8 and I still get Invalid id_token if I don't pass my id_token as the access_token.

Yeah, I only passed access_token to dj_rest_auth endpoint and it worked, as there was nothing as id_token returned from the Google client library..

Interesting @iamrizwan077, I tried passing the id_token and access_token from the official Google OAuth 2.0 Playground and it didn't seem to fix anything. They were both included in the response though.

Yeah, I only passed access_token to dj_rest_auth endpoint and it worked, as there was nothing as id_token returned from the Google client library..

Interesting @iamrizwan077, I tried passing the id_token and access_token from the official Google OAuth 2.0 Playground and it didn't seem to fix anything. They were both included in the response though.

@duplxey   Here is the relevant frontend code that I used:
import { GoogleLogin, GoogleOAuthProvider } from '@react-oauth/google';
const Login = () => {
const responseGoogle = (response) => {
// Send the response (code or token) to your Django backend to authenticate the user
axios('https://iamrizwan066.pythonanywhere.com/dj-rest-auth/google/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: JSON.stringify({
access_token: response.credential,  // for Implicit Grant
}),
})
.then((res) => {
if (res.status === 200) {
navigate('/')
}
//Sending credential(Access token) part to django for token
responseToken(jwt_decode(response.credential));
})
.catch((err) => {
...
}
);
};
return (
    <div>
        ...
        {/* Google Sign In button */}
        <GoogleOAuthProvider clientId={`${googleClientId}`}>
            <GoogleLogin
                onSuccess={(credentialResponse) => {
                    responseGoogle(credentialResponse)
                }}
                onError={() => {
                    console.log('Login Failed');
                    toast("Login failed!")
                }}
            ...
            />
        </GoogleOAuthProvider>
    </div>
    );

}
The given Google Client library returns me a credential (jwt access token), client_id and select_by attribute. I send that credential to dj-rest-auth endpoint and it works. User is registered in the database..
Since I am using Django Tokens for auth, so I am sending a further request to my custom URL for retrieving Django token from database based on user data sent through that credential..

This error only occurs with dj-rest-auth version 3.0.0. I fixed downgraded to2.2.8.

I suppose this response is referring to the JWT problem, correct @agent-Y? I tried it with 2.2.8 and I still get Invalid id_token if I don't pass my id_token as the access_token.

Sorry. My explanation is inadequate.
refresh_token was meant to be a downgrade response to an error that returned with "".
Sorry for the confusion.

I had the same problem then I switched to dj-rest-auth[with_social]==2.2.5 and It just worked fine.

I had the same problem,
I have fixed the following two dependencies: (because those were the values before I've tried to update dj-rest-auth and django-allauth)
django-allauth==0.47.0
dj-rest-auth==2.1.11

None of these solutions have worked for me. This is very frustrating.

I had the same problem, and I solved it by fixing the following dependency:
django-allauth==0.50.0

This solution works with dj-rest-auth==4.0.1

Downgrading to 0.50.0 worked for me, hoping this is fixed soon in newer releases

I had the same problem, and I solved it by fixing the following dependency:
django-allauth==0.50.0

This solution works with dj-rest-auth==4.0.1

Gracias bro!

I can confirm that this is working, i use reactjs-social-login==2.6.2 to obtain the access_code from google
django-allauth==0.50.0
dj-rest-auth==4.0.1

this is the response i get from reactjs-social-login
{
    "access_token": "access_token",
    "token_type": "Bearer",
    "expires_in": 3599,
    "scope": "email profile openid https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile",
    "authuser": "0",
    "prompt": "none",
    "sub": "sub",
    "name": "Me",
    "given_name": "Me",
    "family_name": "And I",
    "picture": "url",
    "email"<EMAIL_ADDRESS>    "email_verified": true,
    "locale": "en"
}

my backend looks like this, no config needed:
from dj_rest_auth.registration.views import SocialLoginView
from allauth.socialaccount.providers.google.views import GoogleOAuth2Adapter

class GoogleLogin(SocialLoginView):
    adapter_class = GoogleOAuth2Adapter

Hope it will help someone!

More information on the issue
As of Aug, 08, 2023, with django-allauth latest version 0.54.0 it seems to have a bug that results in function being unable to pass user identity to other funcitons, resulting in a frustrating code breake. If you face this error it can be worked around by a downgrade, pip install django-allauth==0.50.0 to resolve an issue with allauth library that results in error The above exception (not enough values to unpack (expected 2, got 1)). Issue in hand is with a response["id_token"] which in upgraded version the new function seems to have change unpack parameters, but older version 0.50.0 works fine.
This is an annoying and poorly documented error, so notes came handy to work arround until bug is fixed:
Environment Information for reproducing this error:
Django version: 3.2.18
Python version 3.11.4
django-allauth                0.54.0
google-auth                   2.21.0
google-auth-httplib2          0.1.0
google-auth-oauthlib          1.0.0
googleapis-common-protos      1.59.1
djangorestframework           3.14.0
djangorestframework-simplejwt 5.2.2
dj-rest-auth                  4.0.1
Error reproduction
Trying to hook oauth using a simple general GoogleLogin function to call Google Oauth api with library resources returns an error response suggesting an invalid token id.
class GoogleLogin(SocialLoginView):
    adapter_class = GoogleOAuth2Adapter

Calling api http://<IP_ADDRESS>:8000/api/rest-auth/google/ with provided credentials generated at Google Playground will result in an Invalid Token error.
{
  "access_token": <access_token>,
  "id_token": <id_token>,
  "expires_in": 3599,
  "token_type": "Bearer",
  "scope": "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile openid",
  "refresh_token": <refresh_token>
}

The above exception (not enough values to unpack (expected 2, got 1)) was the direct cause of the following exception: /opt/venv//lib/python3.11/site-packages/allauth/socialaccount/providers/google/views.py, line 42, in complete_login*
class GoogleOAuth2Adapter(OAuth2Adapter):
    provider_id = GoogleProvider.id
    access_token_url = ACCESS_TOKEN_URL
    authorize_url = AUTHORIZE_URL
    id_token_issuer = ID_TOKEN_ISSUER

    def complete_login(self, request, app, token, response, **kwargs):
        try:
            identity_data = jwt.decode(
                response["id_token"],
                # Since the token was received by direct communication
                # protected by TLS between this library and Google, we
                # are allowed to skip checking the token signature
                # according to the OpenID Connect Core 1.0
                # specification.
                # https://openid.net/specs/openid-connect-core-1_0.html#IDTokenValidation
                options={
                    "verify_signature": False,
                    "verify_iss": True,
                    "verify_aud": True,
                    "verify_exp": True,
                },
                issuer=self.id_token_issuer,
                audience=app.client_id,
            )
        except jwt.PyJWTError as e:
            raise OAuth2Error("Invalid id_token") from e
        login = self.get_provider().sociallogin_from_response(request, identity_data)
        return login

Class handeling this in version 0.50.0 seems to work fine:
class GoogleOAuth2Adapter(OAuth2Adapter):
    provider_id = GoogleProvider.id
    access_token_url = "https://accounts.google.com/o/oauth2/token"
    authorize_url = "https://accounts.google.com/o/oauth2/auth"
    profile_url = "https://www.googleapis.com/oauth2/v1/userinfo"

    def complete_login(self, request, app, token, **kwargs):
        resp = requests.get(
            self.profile_url,
            params={"access_token": token.token, "alt": "json"},
        )
        resp.raise_for_status()
        extra_data = resp.json()
        login = self.get_provider().sociallogin_from_response(request, extra_data)
        return login

The changes between the versions seem to reflect a transition from a simple OAuth 2.0 flow (where user data is fetched from the provider) to an OpenID Connect flow (where user identity information is embedded in the id_token). The OpenID Connect is an extension of OAuth 2.0 and provides richer identity features.
However, as with any update, there might be some changes in the library's internal handling that could lead to issues if not properly addressed in integration. As you observed, there seems to be a bug or unexpected behavior in the newer version that resulted in the "not enough values to unpack" error. Downgrading to an older version that doesn't have this problem is a reasonable short-term fix, but it's always good to monitor the library for any patches or updates that address the issue in future versions.
I hope this detailed report helps others facing similar issues and aids in the quicker resolution of this bug. Thank you to the community and maintainers for their continuous efforts in maintaining and improving this library.

I was working through @duplxey's excellent tutorial article on Django REST Framework Authentication with Auth.js, and ran into this issue.
I wanted to note that duplexy has two similar example apps:

https://github.com/duplxey/django-rest-allauth – This is older, and I believe has this same issue (I first found it via Reddit)
https://github.com/duplxey/django-rest-authjs – This is newer, and works great.

The new app uses:
django-allauth==0.54.0
dj-rest-auth==4.0.1

@DerekHill thanks for that, this allauth <--> dj-rest-auth gave me some awful headache

While trying to implement the previous guide (https://testdriven.io/blog/django-rest-authjs/), my team also faced some of the issues described above:

versions mismatch between django-allauth and dj-rest-auth
In the end, using version 0.54.0 (allauth) and 4.0.1 (dj-rest-auth) as suggested above seemed to work but these are not the latest versions of these packages which we would like to use

passing the id_token in the access_token field was the only way we managed to properly authenticate with the backend. Is this intended? Will it change in the future?

@ap-pjgr, it works if you pass both access_token and id_token. Tested with dj-rest-auth==5.0.2 and django-allauth==0.57.0.
See this piece of code:
https://github.com/iMerica/dj-rest-auth/blob/23f097cebcc8ecef886b2ac7869cc1d51f66f90e/dj_rest_auth/registration/serializers.py#L100-L154

Thanks @DerekHill for the tip. I took the latest version of @duplxey, and only with these specific versions the thing worked, and now i'm able to login with google authorization. btw it works also with the latest django, not only 4.23 as mentioned in his requirements.txt .
The thing is, the whole thing is a bit fragile. so many libraries are involved, and it only works in very specific versions... and there's lots of black magic behind it.  I'm a bit worried to use this in production.

django-allauth==0.50.0

Thank you so much ❤

@ap-pjgr, it works if you pass both access_token and id_token. Tested with dj-rest-auth==5.0.2 and django-allauth==0.57.0.
See this piece of code:
https://github.com/iMerica/dj-rest-auth/blob/23f097cebcc8ecef886b2ac7869cc1d51f66f90e/dj_rest_auth/registration/serializers.py#L100-L154

Yes, you can use the Google OAuth 2.0 Playground to get your ID Token and Access Token. This post can help you: https://duizendstra.medium.com/how-to-easily-obtain-a-google-id-token-f1cde61541f0

Confirmed to work on the following version combination by passing both access_token and id_token in the POST to the backend Google views.
dj-rest-auth==5.0.2
Django==4.2.2
django-allauth==0.57.0

Was this a bug before or is it a bug now? They are sparse, but any writeup I've read on this topic passes id_token as access_token in the backend POST. That seemed strange to me when I read it initially. Perhaps the current behaviors not a bug but is rather the intended design. Can anyone confirm or clarify?
Honestly, the whole id/access token is a bit opaque. Perhaps I needs to read some more in-depth discussions on this authentication architecture.

django-allauth==0.50.0

Yea this worked for me. Specifically, the following:
from dj_rest_auth.registration.views import SocialLoginView
from allauth.socialaccount.providers.google.views import GoogleOAuth2Adapter
from allauth.socialaccount.providers.oauth2.client import OAuth2Client

class GoogleLogin(SocialLoginView):
    adapter_class = GoogleOAuth2Adapter
    callback_url = "http://<IP_ADDRESS>:3000/"
    client_class = OAuth2Client

    def post(self, request, *args, **kwargs):
        print(f"Request data: {request.data}")

        request.data["id_token"] = request.data.get("access_token")
        return super().post(request, *args, **kwargs)

Seems like a bug.

The root cause of this issue is that starting from 0.52.0, django-allauth is using the ID token for extracting user information. The ID token is handed over together with the access token as part of the Google OAuth handshake, so with just the django-allauth scope in mind there is no need to make additional calls to fetch user information. However, in a broader scope, this does break the dj-rest-auth use case, causing this issue.
In order to get this issue resolved, django-allauth has been changed to make a call to the userinfo endpoint in case no ID token is present. This change landed on version 0.61.0. However, dj-rest-auth is currently using this for its dependencies:
    extras_require={
        'with_social': ['django-allauth>=0.56.0,<0.58.0'],
    },

Given the amount of people impacted by this, I also backported that change to version 0.57.1 so that there is a version of dj-rest-auth that is compatible with a version of django-allauth containing the fix. This version has just been released. I do hope that current limitation of <0.58.0 gets resolved in a future release of dj-rest-auth, but at least on the short term we can now all move forward.
Hope this helps!

Thanks to @pennersr the maintainer of django-allauth using a significant time to investigate this long term issue on our backend and push this to a solution that will hopefully benefit all users of django-allauth and dj-rest-auth. Forever grateful!

I was getting an issue with this too. What was when the frontend sends the access_token to the GoogleLogin endpoin as "token"
earlier version of dj-rest-auth (2.2.4, 2.2.6) the response would be a "refresh_token", "access_token" and "user" object.
newer dj-rest-auth versions was causing the response to be just {"key":"xxxxxxxxxxxxxxxxxxx"}.
my frontend was expecting the older format "access_token" "refresh_token" and user object. not "key". I didnt even know what to do with the key value.
So I downgraded to allauth 0.50 and dj-rest-auth 2.2.6  and it is working fine again.

I've been chasing this issue for the last few hours with the latest versions of Allauth (0.61.1) and dj-rest-auth (5.0.2) and by debugging both libraries, the underlying issue was being caused by the exception described here - https://github.com/jpadilla/pyjwt/issues/814, where when the OAuth2 token was attempted to be used within ms of being granted, it would fail.
As suggested in that thread, re-syncing my Windows clock actually fixed it. So throwing this here in case it's helpful to anyone else in the future.
PS: Thanks again to pennersr for everything you do!

So update to the above. Even with re-syncing my Windows clock every few hours, this is still pretty flakey and is still failing about 50% of the time. It seems even a delta of a few MS will throw this off.
So this is what I came up with, and it seems to be much more reliable (even manually setting my local time back by a minute and increasing the allowed delta_time window to 90 to accommodate it, the request, while taking over a minute, doesn't fail).
class GoogleOAuth2IatValidationAdapter(GoogleOAuth2Adapter):
    def complete_login(self, request, app, token, response, **kwargs):
        try:
            delta_time = (
                jwt.decode(
                    response.get("id_token"),
                    options={"verify_signature": False},
                    algorithms=["RS256"],
                )["iat"]
                - time()
            )
        except jwt.PyJWTError as e:
            raise OAuth2Error("Invalid id_token during 'iat' validation") from e
        except KeyError as e:
            raise OAuth2Error("Failed to get 'iat' from id_token") from e

		# Or change 30 to whatever you feel is a maximum amount of time you are willing to wait
        if delta_time > 0 and delta_time <= 30:
            sleep(delta_time)

        return super().complete_login(request, app, token, response, **kwargs)

class GoogleLoginView(SocialLoginView):
    adapter_class = GoogleOAuth2IatValidationAdapter
    ...

The JWT is still fully validated as part of the super().complete_login so this shouldn't compromise the JWT AFAIK, but having a sleep call in a request isn't my favourite. If anyone has an alternative solution/suggestion lmk but I'll see how reliable this is over the next few days.

What exactly is the resolution for this?  I am also getting the ""Failed to exchange code for access token" error and I don't know why.  There at least has to be better debug output for this, and it should be fixed.

More information on the issue
As of Aug, 08, 2023, with django-allauth latest version 0.54.0 it seems to have a bug that results in function being unable to pass user identity to other funcitons, resulting in a frustrating code breake. If you face this error it can be worked around by a downgrade, pip install django-allauth==0.50.0 to resolve an issue with allauth library that results in error The above exception (not enough values to unpack (expected 2, got 1)). Issue in hand is with a response["id_token"] which in upgraded version the new function seems to have change unpack parameters, but older version 0.50.0 works fine.

It worked for me, thank you very much.

I'm using dj-rest-auth on the backend and NextAuth.js on the frontend. After successfully logging in via NextAuth.js I get the following account passed to my signIn callback:
{
  provider: "google",
  type: "oauth",
  providerAccountId: "177780422328299215542",
  access_token: "%access_token%",
  expires_at:<PHONE_NUMBER>,
  refresh_token: "%refresh_token%",
  scope: "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile openid",
  token_type: "Bearer",
  id_token: "%id_token%"
}

1. `access_token` is a random string of characters. Not decodable by jwt.io.

2. `id_token` is a JWT token (`header.payload.signature`). It is decodable by jwt.io.

I then forward the access_token and id_token to my dj-rest-auth Google endpoint defined like this:
from allauth.socialaccount.providers.google.views import GoogleOAuth2Adapter
from allauth.socialaccount.providers.oauth2.client import OAuth2Client, OAuth2Error
from dj_rest_auth.registration.views import SocialLoginView

class GoogleLogin(SocialLoginView):  # Authorization Code grant
    adapter_class = GoogleOAuth2Adapter
    callback_url = "http://localhost:3000/api/auth/callback/google"
    client_class = OAuth2Client

I use the following request code:
const options = {
  method: 'POST',
  url: 'http://<IP_ADDRESS>:8000/api/auth/google/',
  headers: {
    'Content-Type': 'application/json'
  },
  data: {
    access_token: '%access_token%',
    id_token: '%id_token%'
  }
};

axios.request(options).then(function (response) {
  console.log(response.data);
}).catch(function (error) {
  console.error(error);
});

This request fails with an error saying:
Not enough segments
Internal Server Error: /api/auth/google/
Traceback (most recent call last):
  File ".\venv\lib\site-packages\jwt\api_jws.py", line 251, in _load
    header_segment, payload_segment = signing_input.split(b".", 1)
ValueError: not enough values to unpack (expected 2, got 1)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File ".\authentication\views.py", line 33, in complete_login
    identity_data = jwt.decode(
  File ".\venv\lib\site-packages\jwt\api_jwt.py", line 168, in decode
    decoded = self.decode_complete(
  File ".\venv\lib\site-packages\jwt\api_jwt.py", line 120, in decode_complete
    decoded = api_jws.decode_complete(
  File ".\venv\lib\site-packages\jwt\api_jws.py", line 191, in decode_complete
    payload, signing_input, header, signature = self._load(jwt)
  File ".\venv\lib\site-packages\jwt\api_jws.py", line 253, in _load
    raise DecodeError("Not enough segments") from err
jwt.exceptions.DecodeError: Not enough segments

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File ".\venv\lib\site-packages\django\core\handlers\exception.py", line 55, in inner
    response = get_response(request)
  File ".\venv\lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File ".\venv\lib\site-packages\django\views\decorators\csrf.py", line 56, in wrapper_view
    return view_func(*args, **kwargs)
  File ".\venv\lib\site-packages\django\views\generic\base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
  File ".\venv\lib\site-packages\django\utils\decorators.py", line 46, in _wrapper
    return bound_method(*args, **kwargs)
  File ".\venv\lib\site-packages\django\views\decorators\debug.py", line 92, in sensitive_post_parameters_wrapper
    return view(request, *args, **kwargs)
  File ".\venv\lib\site-packages\dj_rest_auth\views.py", line 48, in dispatch
    return super().dispatch(*args, **kwargs)
  File ".\venv\lib\site-packages\rest_framework\views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File ".\venv\lib\site-packages\rest_framework\views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File ".\venv\lib\site-packages\rest_framework\views.py", line 480, in raise_uncaught_exception
    raise exc
  File ".\venv\lib\site-packages\rest_framework\views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File ".\venv\lib\site-packages\dj_rest_auth\views.py", line 125, in post
    self.serializer.is_valid(raise_exception=True)
  File ".\venv\lib\site-packages\rest_framework\serializers.py", line 227, in is_valid
    self._validated_data = self.run_validation(self.initial_data)
  File ".\venv\lib\site-packages\rest_framework\serializers.py", line 429, in run_validation
    value = self.validate(value)
  File ".\venv\lib\site-packages\dj_rest_auth\registration\serializers.py", line 151, in validate
    login = self.get_social_login(adapter, app, social_token, response={'id_token': token})
  File ".\venv\lib\site-packages\dj_rest_auth\registration\serializers.py", line 60, in get_social_login
    social_login = adapter.complete_login(request, app, token, response=response)
  File ".\authentication\views.py", line 46, in complete_login
    raise OAuth2Error("Invalid id_token") from e
allauth.socialaccount.providers.oauth2.client.OAuth2Error: Invalid id_token

After some testing I figured out that response["id_token"] in complete_login returns the request's access_token and not the id_token.
print(response["id_token"])
# prints out {'id_token': '%access_token%'}

Sending your id_token as the access_token without providing id_token seems to work:
const options = {
  method: 'POST',
  url: 'http://<IP_ADDRESS>:8000/api/auth/google/',
  headers: {
    'Content-Type': 'application/json'
  },
  data: {
    access_token: '%id_token%'
  }
};

axios.request(options).then(function (response) {
  console.log(response.data);
}).catch(function (error) {
  console.error(error);
});

Is this the expected behaviour? Am I missing something?

Hello, How to solve "Failed to exchange code for access token" When sending  {"code": "code from google"} on postman ?


Accept timeout loop

Description
Fixes # (issue)
Fixes issue with accept where blocking accepts were not blocking. This is due to the timeout set on all sockets that we have for cancellation purposes. This loop was added to receive but never added to accept.
Type of change

[x] Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?
RustPOSIX test suite
Lind test suite
LAMP tests
Checklist:

[ ] My code follows the style guidelines of this project
[x] I have commented my code, particularly in hard-to-understand areas
[x] My changes generate no new warnings
[ ] I have added tests that prove my fix is effective or that my feature works
[ ] Any dependent changes have been added to a pull request and/or merged in other modules (native-client, lind-glibc, lind-project)

The code seems readable to me.  I can understand the flow.  I'm not enough of a Rust expert to review it, however.
I don't know if it's related but for different OSes, if they have a non-blocking listening socket accept a socket, it may or may not become blocking automatically.  This impacted timeouts before on some OSes (notably Mac)...


add ability to add&update&remove cron jobs from rails model&controllers

in gemfile
add gem 'whenever' without require: false
then in controllers and models add jobs to the crontab by the following
task = %{
every 2.hours do
command 'echo "test"'
end
}
Whenever.add_or_update_cron(task, identifier)

# to remove cron
Whenever.remove_cron(identifier)

I think it would be better for this to not directly alter the crontab.

@bolahanna44  can you provide some update on this or @benlangfeld can we close this one out ? 😄

I'm going to close this as out of scope for Whenever. This gem is on life support and I don't think it's plausible to add significant new features.


HTTP header/parameter-based path mapping

Motivation:
Spring framework provides HTTP header/parameter-based path mapping like below:
@GetMapping(value = "/hello", params = {"name"})
public String method(@RequestParam("name") String name) { ... }

It would be useful for a user who wants to migrate his or her Spring based service to Armeria.
Modifications:

Add RoutingPredicate<T> class in order to check the request headers or parameters are matched
by the condition that a user specified.
Add headers and params methods to RouteBuilder.
Add @Headers and @Params annotation for annotated service.
Do not cache Route that has HTTP header/parameter-based path mapping.

Result:

Closes #1207

To-Dos:

More tests.
Changes related to Documentation service. (@minwoox Please help me when I start to do this :-))

@trustin I'm curious that this change is reasonable. Please let me know what you think. :-)

@minwoox Please help me when I start to do this :-))

@hyangtack Gentle ping :wink:

I haven't finished yet DocService and documentation, but it would be better to finish them after getting comments from you folks about this change. :-)

I haven't finished yet DocService and documentation, but it would be better to finish them after getting comments from you folks about this change. :-)

I think we can make it in the separate PR because DocService still works without the information of ConditionalParam and ConditionalHeader. And I think I can help you with that. 😄

I'm adding a new feature that supports >=, >, <= and < as a comparator.
If the configured value can be parsed as long value, the values will be compared by numeric order. Otherwise, they will be compared by lexicographical order.
Does it make sense?
I thought this feature because a user may want to handle a request separately with the client version header. But I'm worried whether this feature makes a user confused because the ordering is changed by the configured value.
What do you think?

I'm adding a new feature that supports >=, >, <= and < as a comparator.

These operators shouldn't be applied only for numbers?

If the configured value can be parsed as long value, the values will be compared by numeric order. Otherwise, they will be compared by lexicographical order. Does it make sense?

How about allowing a user to specify a custom Predicate<String>? A version number will not always be an integer but in a form of x.y.z:
Server.builder()
      .route().get("/foo")
              .matchesParam("foo=bar")
              .matchesParam("clientVersion", value -> ...)
              .build()
``

I'm adding a new feature that supports >=, >, <= and < as a comparator.

These operators shouldn't be applied only for numbers?

How about allowing a user to specify a custom Predicate? A version number will not always be an integer but in a form of x.y.z:

@minwoox @trustin Thanks for the comments. 👍
@trustin 's idea sounds good to me. So I removed the code related to >=, >, <=, and < operators. And will add a method for a custom value predicate.

Rebased and addressed @trustin 's comments. Please have a look. :-)

@ikhoon Would you have a look on this commit? :-)
https://github.com/line/armeria/pull/2102/commits/c8c0b62f7f56270f370deb567c66972a7477f50a
CachingRouter caches the Routes which can be collected by matching cacheable parameters (path type, path, methods, consumes, produces). The non-cacheable parameters like the predicates for headers and/or query parameters will be evaluated later.
/cc @trustin @minwoox

@ikhoon Would you have a look on this commit? :-)

Sure, Let me look at it!

While reviewing your code in the cafe☕, my laptop battery was gone. 😱 Let me check it soon.

I'm not sure that I understand ambiguous routes and CachingRoutingContext logic. 😭
But I found the following test case fail though it is not related to the cache.
@Test
void headerParamMatchWithRoutingDecorator() {
    AtomicBoolean decorated = new AtomicBoolean(false);
    Server server = Server
            .builder()
            // want to decocrate only when header contains "header-match"
            .decorator(Route.builder()
                            .pathPrefix("/")
                            .matchesHeaders("header-match").build(),
                       (delegate, ctx, req) -> {
                           decorated.set(true);
                           return delegate.serve(ctx, req);
                       })
            .annotatedService("/", new Object() {
                @MatchesHeader("header-match")
                @Get("/foo")
                public HttpResponse foo() {
                    return HttpResponse.of(HttpStatus.OK);
                }
            })
            .build();
    server.start().join();
    final WebClient client = WebClient.of("http://<IP_ADDRESS>:" + server.activeLocalPort());
    final AggregatedHttpResponse response = client.get("/foo").aggregate().join();
    assertThat(response.status()).isEqualByComparingTo(HttpStatus.NOT_FOUND);
    assertThat(decorated).isFalse(); // assert fail, decorated is true, should not be set true.
}

@ikhoon Thanks. Let me have a look.

@ikhoon I found Route for the decorator didn't have a method. It worked when I added .methods(HttpMethod.GET). Is it a bug? Seems that all methods should be accepted if no method was specified.

I found Route for the decorator didn't have a method. It worked when I added .methods(HttpMethod.GET). Is it a bug?

I guess it is not a bug. 😅 Currently, A decorator could be routed under a specific path and accept every methods. It is useful when authorizing some paths. If the empty method of route seems weird, I think we could add all methods when building a route without specifying methods.
https://line.github.io/armeria/server-decorator.html#decorating-multiple-services-by-path-mapping

I think the initial reason is it's easy and fast to use .isEmpty() to check is the route matches all methods. We could return all methods and add a method like matchesAllMethods()?

I think the initial reason is it's easy and fast to use .isEmpty() to check is the route matches all methods. We could return all methods and add a method like matchesAllMethods()?

Based on the @trustin 's review, we could find proper route with {header,param} matching by adding all known methods if method is empty.
diff --git a/core/src/main/java/com/linecorp/armeria/server/DefaultRoute.java b/core/src/main/java/com/linecorp/armeria/server/DefaultRoute.java
index 5bd5a9611..0eab6da4f 100644
--- a/core/src/main/java/com/linecorp/armeria/server/DefaultRoute.java
+++ b/core/src/main/java/com/linecorp/armeria/server/DefaultRoute.java
@@ -96,10 +96,6 @@ final class DefaultRoute implements Route {
             return RoutingResult.empty();
         }

-        if (methods.isEmpty()) {
-            return builder.build();
-        }
-
         if (!methods.contains(routingCtx.method())) {
             // '415 Unsupported Media Type' and '406 Not Acceptable' is more specific than
             // '405 Method Not Allowed'. So 405 would be set if there is no status code set before.
diff --git a/core/src/main/java/com/linecorp/armeria/server/RouteBuilder.java b/core/src/main/java/com/linecorp/armeria/server/RouteBuilder.java
index 28ce4955e..a9e5fccd5 100644
--- a/core/src/main/java/com/linecorp/armeria/server/RouteBuilder.java
+++ b/core/src/main/java/com/linecorp/armeria/server/RouteBuilder.java
@@ -467,6 +467,9 @@ public final class RouteBuilder {
             throw new IllegalStateException("Must set methods if consumes or produces is not empty." +
                                             " consumes: " + consumes + ", produces: " + produces);
         }
+        if (methods.isEmpty()) {
+            methods = HttpMethod.knownMethods();
+        }
         return new DefaultRoute(pathMapping, methods, consumes, produces, paramPredicates, headerPredicates);
     }

I think it is inefficient because maybe most of the routers defined by users don't have {header, param} predicates. Do we need special optimization here?
For example:
if (matchesAllMethods(methods) && !routingCtx.requiresMatchingParamsPredicates() &&
    !routingCtx.requiresMatchingHeadersPredicates()) {
    return builder.build();

@ikhoon @trustin Sorry, I mis-understood the problem. I thought the decorator didn't work when I didn't specify the method of its Route. So I asked you whether it was a bug.  😅

I think it is inefficient because maybe most of the routers defined by users don't have {header, param} predicates. Do we need special optimization here?

I guess consumes and produces also have the same problem. So it seems better to execute the rest of the code. Anyway, let me make a change today.
Thanks, guys! 👍

Still LGTM. Thanks @hyangtack :smile:

Nice job, @hyangtack! :laughing:

🚀

Awesome! 🌟


Accessibility of html elements labeled Group

There are certain elements on the page that when tabbed over simply say group as their name, ex the ends of the sliders and the table. Names for these objects will have to be assigned in order to make it more accessible.
WAI-ARIA documentation for using web accessibility: http://www.w3.org/WAI/intro/aria.php

ALL DONE (not really this is a test/learning exercise)

Not actually fixed

I'm going through the page using VoiceOver and in the Line Data area, each line's information is read, but it doesn't pick up the last line of text which is the "Total Data Summary". Not sure if this is just my computer or if it is happening to on others.

There wasn't anything read out other than the shape line on firefox, and "Enter new line 1 color, edit text" was read for Safari and Chrome. -- does not read the "Total Data Summary" for me either
For the play button, only Firefox reads out "Play Toggle" and both Chrome and Safari reads "button" and shows "image, button".
For the Load CSV button, Chrome sometimes skips over it and goes to the play button, but both Safari and Firefox goes to it before the play button. -- agreed with the tab index thing

Just ran the VoiceOver auto-read where it reads everything on the page and it read all the information in the summary box, but it was very inefficient try running the command: control + option + A
There is a lot of duplicated information.

Just added some tab index, now should read the title "Line Data" when tab to the box.

All the tabbing seems to be working except Total Data Summary at the bottom of Line Data is not readable yet.

There is a bit of an issue when you open the graph and the black pop up asks what type of graph. The reader does not pick up "Choose a type of graph:" as readable. I'm trying to find a way to have the screen reader read this so that people know the point of the pop up

The current way the tabbing is set up when the pop-up shows up you have to tab over "Load CSV" and "Create New Table" I think this might be a problem because they might not know that there is a pop up so they might click "Create New Table" thinking that it will create the table for their CSV. I'm not sure if people would actually be confused by this, but I think there is a possibility. I think the tab order could be changed or have a sound play when the pop up shows up

VoiceOver works for Chrome. I am testing FireFox and Safari, but I think accessibility is almost accomplished. It passes the accessibility tests with only a few warnings for things like contrast ratio

All three browsers are fully functional with VoiceOver. Should we test it with other screen readers or does just VoiceOver need to work?


feat: prototype Stars Chart for Repo pages

Description
Implements a basic bar chart in repo pages that shows the number of stars given to a repository every day based on the chosen range. This PR adds Recharts as an alternative charting library and creates a new function that adds empty days in between those given by the /histogram/stars API endpoint.
This only shows the "daily" chart; the "cumulative" chart will be done in a separate PR.

What type of PR is this? (check all applicable)

[x] 🍕 Feature
[ ] 🐛 Bug Fix
[ ] 📝 Documentation Update
[ ] 🎨 Style
[ ] 🧑💻 Code Refactor
[ ] 🔥 Performance Improvements
[ ] ✅ Test
[ ] 🤖 Build
[ ] 🔁 CI
[ ] 📦 Chore (Release)
[ ] ⏩ Revert

Related Tickets & Documents
Relates to #3025

Mobile & Desktop Screenshots/Recordings
https://github.com/open-sauced/app/assets/20603494/4197a1a8-7fcc-4527-870f-9635f1b422a9

Steps to QA

Go to a repo page
Change the range
Ensure that tooltips show on hover, even if there's a day with 0 stars.

Tier (staff will fill in)

[ ] Tier 1
[x] Tier 2
[ ] Tier 3
[ ] Tier 4

[optional] Are there any post-deployment tasks we need to perform?
[optional] What gif best describes this PR or how it makes you feel?

I love it. I think we can continue to iterate after this is merged.

I did notice the fetching is a little slow, when switching from 30 to 90. It would be nice to have a loading indicator. My instinct was there was 0 stars at first.


Timeout unit fix

Had accidentally committed timeout parameter as seconds instead of hours

Signed-off-by: Shubham Verma<EMAIL_ADDRESS>

I forgot to push these changes on the last day.


Document how to use docker image

Here is how to run the Maturity Models project from docker using DigitalOcean

In DigitalOcean UI click on 'Create Droplet'

click on 'One-click apps' and chose Docker

chose a size (since the Maturity Models app is quite light weight, even the 5 USD month will work, I usually chose between the 20 to 40 USD per month, depending on how long the image will last)

pick a location close to you (in my case I chose London)

create or select an SSH key (so that you can ssh into the box)

set a hostname and click on create

It should take about 30 secs for it to be ready

in the image page, copy it's IP address (in this case <IP_ADDRESS>)

in an bash shell, ssh into it using ssh<EMAIL_ADDRESS>

confirm that we have docker running

run docker run -it -p 80:3000 diniscruz/maturity-models to pull and start the Maturity Models app

after all images have been downloaded it should look like this

and that's it

open http://<IP_ADDRESS>/ in browser and you should see the latest version of the Maturity Models project

Finally when you are done with that image go to the digital Ocean ui and click on destroy

Note: if don't want to use the DigitalOcean UI, check out this cli I published a while back https://github.com/o2platform/digitalocean-cli

Added as wiki page to https://github.com/OWASP/Maturity-Models/wiki/Run-the-Maturity-Models-from-Docker