Yum does not display the custom message sent from Sonatype Nexus Repository Manager - nexus

We are trying to implement Yum support for one of our plugins developed for Sonatype Nexus Repository Manager (NRM). The users set up Yum Proxy in NRM to download and install the packages
Eg: yum install <package>.
Our goal is to send back and display a custom message in user's Yum client when the user initiates installation. This custom message will be generated based on a specific criteria checked at the backend logic of the plugin.
However, the Yum client is displaying only the errorCode but not the custom message.
Screenshot here..
We tried different errorCodes as well as the debuglevel option to see if it displays additional logs. But it was not successful. Is there an approach or a workaround to overcome this issue? Appreciate your thoughts and support on this. Thank you.
Below is how we are constructing the Response object from Nexus plugin:
#Singleton
public class MyConditionalRequestHandler extends ConditionalRequestHandler {
#Override
public Response handle(#Nonnull Context context) throws Exception {
Builder builder = new Response.Builder();
Response response = builder.status(new Status(true, "400", "Custom Message")).build();
return response;
}
}
Types:
org.sonatype.nexus.repository.view.handlers.ConditionalRequestHandler
org.sonatype.nexus.repository.view.Response
org.sonatype.nexus.repository.view.Status.Status(boolean successful, int code, #Nullable String message)

Related

Update WordPress Theme / Plugin from Private GitHub Repo

Background
I am working on a custom theme for my WordPress site which I would like to manage from a private GitHub repo. (This theme will never be pushed into the WordPress market place) The general idea would be that I use the repo to manage the code and then once I tag a new version, the tag would trigger an update for the WordPress theme.
I have this pattern working using the following as a template:
https://github.com/krafit/wp-gitlab-updater
(Yes, I know the repo is for Gitlab and not GitHub)
Since my repo is private, I will need to generate a user token to allow the theme to be updated. And because the user token is capable of accessing all my private repos, the idea of sharing the user token with another plugin is discomforting from a security standpoint. (Meaning, I'm uncomfortable using a plugin like: https://github.com/afragen/git-updater)
Question
The problem is that GitHub has deprecated the use of access_token as a query string parameter, so all tokens must be sent over as an Authorization header.
How do I add an authorization header to the request WordPress sends to download the artifact?
What I've Tried
When I check for new tags I use the code:
protected function fetch_tags_from_repo( $git_url, $repo, $access_token ) {
$request_url = "$git_url/repos/$repo/tags?access_token=$access_token";
$args = [
"headers" => [
"Accept" => "application/vnd.github.v3+json",
"Authorization" => "token " . $access_token
]
];
$request = wp_safe_remote_get( $request_url, $args );
return $request;
}
This works without any issues. However...
During the pre_set_site_transient_update_themes hook I return an object that looks like:
$transient->response[ $theme['name'] ]['theme'] = $theme['name'];
$transient->response[ $theme['name'] ]['new_version'] = $latest_version;
$transient->response[ $theme['name'] ]['package'] = $theme_package;
The problem is, I have no way of adding an Authorization header to the transient response object. Therefore, when WP later tries to download the artifact, it fails.
Note: The $theme_package string is a URL which looks like:
$theme_package = "$git_url/repos/$repo/zipball/refs/tags/$latest_version";
Any support appreciated, thank you!
Honestly, this problem has been exhausting and enough is enough...
Answer
Eject from GitHub and use Gitlab because they still support access_token as a header. They have unlimited free private repos <5gb storage.
If you are planning to distribute the private repo with a license I recommend you not to expose your access credentials in the script.
Instead you should use the GitHub PHP API together with a SSH Key that you setup in your repo settings or a GitHub App with access permission granted on your repo.
Here is a solid SDK to start from:
https://github.com/KnpLabs/php-github-api
Alternatively as you suggested it in your answer, a third party service could be used to manage the credentials on your behalf.
Gitlab is a nice generic and low cost option but if you are looking for something dedicated to Wordpress development I recommend WP Package Editor (WP2E)
Among other things the service uses a registered GitHub App to pull the latest version from public / private GitHub repositories:
https://github.com/marketplace/wp-package-editor
This is quoted from the documentation regarding how it is implemented with GitHub:
For a script to be successfully imported to the library of repositories and later be synchronized as an installer dependency there are 4 conditions :
The GitHub App must be connected to a WP2E account
The “read-only” access to the repository must be granted to the WP2E GitHub App
The script must be a valid WP theme or plugin
The repository must have at least one “release” on GitHub
Note: In order to synchronize with the GitHub account/repo the GitHub App should be integrated via the saas panel ( not directly via the GitHub Marketplace )

Is there any alternate way to add and edit an outlook ToDo task without using GraphServiceClient in Xamarin forms application

We are trying to update an outlook Task by using GraphServiceClient of Microsoft.Graph aPI (beta version) as -
await AuthenticationHelper.GraphClient.Me.Todo.Lists[taskToDO.Id].Tasks[task.Id]
.Request()
.UpdateAsync(todoTask);
but when we update it we get this error -
Status Code: BadRequest
Microsoft.Graph.ServiceException: Code: UnsupportedApiVersion
Message: The HTTP resource that matches the request URI 'https://outlook.office.com:444/todob2/graph/v1/users('...')/todoApp/lists('... ')/tasks' does not support the API version '1.0'.
Inner error:
Message: No route providing a controller name with API version '1.0' was found to match request URI 'https://outlook.office.com:444/todob2/graph/v1/users('...')/todoApp/lists('... ')/tasks'.
How to sole this issue ? Is there any alternate way to add and edit an outlook ToDo task without using GraphServiceClient ?
Can you try to update the same task from Graph explorer https://developer.microsoft.com/en-us/graph/graph-explorer. The API can be used for same is https://graph.microsoft.com/v1.0/me/todo/lists/{list-id}/tasks/{task-id}
In your request url, it seems that task-id is not present which is causing this issue.
Also, can you please also share the request-id being returned as part of failure response? We can debug this issue.

“Validation failed” error on searching in private repository with installation of GitHub App

I’ve created a GitHub app and installed it in my account, giving it access to a private repository in my account. The GitHub app has read permission to metadata.
I then generated a JWT and used it to create an installation access token, following the steps here.
I tried using this token to search for keywords in the above private repository using the GitHub search API as follows:
https://api.github.com/search/code?q=abc+in:file+repo:username/private-repo
However, this returns the following response.
{
"message": "Validation Failed",
"errors": [
{
"message": "The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.",
"resource": "Search",
"field": "q",
"code": "invalid"
}
],
"documentation_url": "https://docs.github.com/v3/search/"
}
I tried using this access token to fetch the repositories for this GitHub app installation and that returned the private repo successfully in the response. I assume this means that the installation has access to the private repo and the token works as expected.
API used: https://api.github.com/installation/repositories.
Why does the search fail then?
Raised a ticket with GitHub support. Their response:
The query failed because the GitHub App does not have permission to
read the content of the private repository. The Metadata read
permission will allow you to search for repositories but does not have
sufficient scope to read the content of the repository(private).
The docs list the search API under Metadata, but it should be under Content permissions. Granting Content read permissions to the GitHub app solved the issue.
In my case the problem was the value of the "q" field. When I dropped the +repo argument I was able to search code just fine. I'm still not sure why the +repo did not work (it worked fine on the command line) but it turns out I didn't need it anyways since the repos were constrained to where the app was installed and I could also filter the results if needed.

Unity App Crashes When Sign-In via Play Games is Attempted

I have a problem that has been chasing me for the last few days.
I did all the necessary configuration to set up the Google Play Games sign-in method to my Unity game for Android.
However, every time I click the sign-in button the Play Games icon briefly appears at the top and the app suddenly crashes.
Analyzing the logcat, it seems there is an error on the highlighted line (last line of the 'InitializePlayGamesPlatform()' method) of the following script:
using GooglePlayGames;
using GooglePlayGames.BasicApi;
using UnityEngine;
public class UserManager : MonoBehaviour
{
private Firebase.Auth.FirebaseAuth firebaseAuth;
private Firebase.Auth.FirebaseUser firebaseUser;
void Start()
{
InitializePlayGamesPlatform();
}
private void InitializePlayGamesPlatform()
{
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
.RequestServerAuthCode(false)
.Build();
PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.Activate();
************firebaseAuth = Firebase.Auth.FirebaseAuth.DefaultInstance;************
}
public void TrySignIn()
{
UnityEngine.Social.localUser.Authenticate((bool success) =>
{
if (!success)
{
Debug.LogError("UserManager: Failed to sign in into Play Games!");
return;
}
string authCode = PlayGamesPlatform.Instance.GetServerAuthCode();
if (string.IsNullOrEmpty(authCode))
{
Debug.LogError("UserManager: Failed to get auth code!");
return;
}
Debug.LogFormat("UserManager: auth code is: {0}", authCode);
Firebase.Auth.Credential credential = Firebase.Auth.PlayGamesAuthProvider.GetCredential(authCode);
firebaseAuth.SignInWithCredentialAsync(credential).ContinueWith(task =>
{
if (task.IsCanceled)
{
Debug.LogError("UserManager: sign-in was canceled!");
return;
}
if (task.IsFaulted)
{
Debug.LogError("UserManager: error signing in!");
return;
}
firebaseUser = task.Result;
Debug.LogFormat("UserManager: user signed in successfully: {0} ({1})", firebaseUser.DisplayName, firebaseUser.UserId);
});
});
}
public void TrySignOut()
{
firebaseAuth.SignOut();
}
}
Also, there are some other messages/errors in the logcat, such as:
Failed to read Firebase options from the app's resources. Either make sure google-services.json is included in your build or specify options explicitly.
InitializationException: Firebase app creation failed.
at Firebase.FirebaseApp.CreateAndTrack (Firebase.FirebaseApp+CreateDelegate createDelegate, Firebase.FirebaseApp existingProxy) [0x000da] in Z:\tmp\tmp.txs8ldQ514\firebase\app\client\unity\proxy
at Firebase.FirebaseApp.Create () [0x00000] in Z:\tmp\tmp.txs8ldQ514\firebase\app\client\unity\proxy\FirebaseApp.cs:119
at Firebase.FirebaseApp.get_DefaultInstance () [0x0000b] in Z:\tmp\tmp.txs8ldQ514\firebase\app\client\unity\proxy\FirebaseApp.cs:94
at Firebase.Auth.FirebaseAuth.get_DefaultInstance () [0x00000] in Z:\tmp\tmp.poUq23PLco\firebase\auth\client\unity\proxy\FirebaseAuth.cs:294
I repeated every procedure from the beginning a thousand times, searched everywhere and got no results.
I have tried running an older version of GPG plugin as well, but no success at all.
I kindly ask you to help me on this - I promise to put your names on the credits in case I publish!! :)
Thanks in advance!!
A Firebase support member (#Jesus) has just helped me to figure the issue out. The workaround is directly adding the sourceset to the mainTemplate.gradle.
I had to do the following:
Go to Project Settings > Publishing Settings > Build > checkmark Custom Main Gradle Template.
It will give you the location to the mainTemplate.gradle file.
Here is an example.
Go to the given directory and open mainTemplate.gradle with a text editor.
Add the following code to the referred file, right after lintOptions:
sourceSets { main { res.srcDirs += '<full path from your root directory to google-services.xml>' } }
Also, add this array to noCompress under aaptOptions:
noCompress = ['.unity3d', '.ress', '.resource', '.obb', 'google-services.json']
In the end, the mainTemplate.gradle should look like this:
lintOptions {
abortOnError false
}
sourceSets { main { res.srcDirs += 'C:\\Users\\USERNAME\\Documents\\Unity Projects\\GAMENAME\\Assets\\Plugins\\Android\\Firebase\\res\\values\\google-services.xml' } }
aaptOptions {
noCompress = ['.unity3d', '.ress', '.resource', '.obb', 'google-services.json']
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
}
in my case i have setted prograurd mode in release setting under publish settings>minify>release . Setting this to none have fixed my issue.
That particular issue is related to the google-services.json file that should be automatically included in your build if the file exists in your Assets/ directory. Note that the process is different enough from the Android process that you probably need to ignore the Firebase Android instructions and only follow the Unity ones unless you really know what you're doing.
I'll tackle the easiest problem first. Make sure you have your google-services.json file in your Assets/ directory. I usually keep mine in Assets/Data/ (which is where I also keep things like ScriptableObjects). If you don't have it, follow the instructions on the Download Firebase config file or object help page:
Get config file for your Android app Go to your the Settings icon
Project settings in the Firebase console. In the Your apps card,
select the package name of the app for which you need a config file.
Click google-services.json. Move your config file into the module
(app-level) directory of your app. Make sure that you only have this
most recent downloaded config file in your app.
Once you have that file, you'll need to make sure that Assets/Plugins/Android/Firebase/res/values/google-services.xml gets properly generated:
The reason why this exists is that the Unity SDK does not use the Google Services Gradle Plugin - doing so would break compatibility with older versions of Unity or teams that otherwise opt out of gradle integration. This is why I strongly advise against following any of the Android specific documentation unless you're willing to do a lot of work by hand.
If you do not have google-services.xml or you want to try to regenerate it, you should navigate to Assets>External Dependency Manager>Android Resolver>Force Resolve:
If this does fix your issue, then you should make sure that you enable auto-resolution to avoid this issue in the future:
There are also a few more subtle issues that crop up. One is that "External Dependency Manager for Unity" is a rename of the "Play Services Resolver" (developers kept thinking that it was tied to Play Services - which it isn't). So check that you don't have a Assets/Play Services Resolver directory. Also, if you're using the External Dependency Manager in the Unity Package Manager, make sure that Assets/External Dependency Manager doesn't exist as well. Since you're using two plugins that ship with EDM4U, you may have some duplication (although EDM4U should be smart enough to resolve that).
If you're still running into issues, it may help to share your directory layout WRT where the External Dependency Manager, google-services.json, google-services.xml, and the Firebase and the Play Games Sign-In plugin live. Also it could be worth noting if google-services.xml makes it into an exported project (or your APK). If any of this isn't something you want to share on Stack Overflow, feel free to reach out to Firebase Support and link this SO question.
--Patrick

Leadtools - The program failed to run with the following error: An exception occurred in the fate of the invocation

Step 8: Configure the Storage Server Manager to use MyQueryIOD.xml
Run CSStorageServerManagerDemo.exe
Login with the Username and Password credentials that you defined during database configuration
Open the Query Settings, and set the IOD XML Path to be your MyQueryIOD.xml file.
See Specifying C-FIND-Rsp DICOM Elements for instructions on creating MyQueryIOD.xml
this is error occurrs when I run this CSStorageServerManagerDemo.exe
https://www.leadtools.com/help/leadtools/v19/dh/to/leadtools.topics.dicom~di.topics.tutorialsampledatabasefortheleadstorageserver.html
This tutorial on our website needs an update. Our support team has already reported it to the documentation department and it will be modified soon. The main correction is this:
Open the project My.Medical.Storage.DataAccessLayer
Open this file:
D:\LEADTOOLS 19\Examples\DotNet\PACSFramework\CS\Tutorials\My.Medical.Storage.DataAccessLayer\DataAccessLogic\DataAccessAgent\MyStorageDbDataAccessAgent.cs
Add the following StoreDicom() override, and recompile:
...
public override void StoreDicom(DicomDataSet dataSet,
string referencedFileName,
string token,
string externalStoreGuid,
string retrieveAe,
string storeAe,
ReferencedImages[] images,
bool updateExistentPatient,
bool updateExistentStudy,
bool updateExistentSeries,
bool updateExistentInstances)
{
StoreDicom(dataSet, referencedFileName, retrieveAe, images, updateExistentPatient, updateExistentStudy,
updateExistentSeries, updateExistentInstances);
}
If you still face problems after making this change, please send full details about what you tried and whatever errors you're getting to support#leadtools.com.

Resources