raycast / extensions

Everything you need to extend Raycast.
https://developers.raycast.com
MIT License
5.02k stars 2.75k forks source link

[Jira Time Tracking] Please add support for On-Prem Jira installation #12550

Open marcgemis opened 1 month ago

marcgemis commented 1 month ago

Extension

https://www.raycast.com/niallpaterson/jira-time-tracking

Description

The plug-in does not work for an on-prem installation of Jira. I tried to compare the Jira and Jira On-Prem plug-ins. I think the Authorization headers are slightly different. Would it possible make the plug-in compatible with an on-prem Jira? Or release a separate version?

Who will benefit from this feature?

Everyone with an on-prem installation of Jira

Anything else?

No response

raycastbot commented 1 month ago

Thank you for opening this issue!

🔔 @niallpaterson @0w0miki you might want to have a look.

💡 Author and Contributors commands The author and contributors of `niallpaterson/jira-time-tracking` can trigger bot actions by commenting: - `@raycastbot close this issue` Closes the issue. - `@raycastbot rename this issue to "Awesome new title"` Renames the issue. - `@raycastbot reopen this issue` Reopens the issue. - `@raycastbot assign me` Assigns yourself to the issue. - `@raycastbot good first issue` Adds the "Good first issue" label to the issue.
haydencbarnes commented 4 weeks ago

Hi @marcgemis would you like to test https://github.com/raycast/extensions/pull/11918 ?

marcgemis commented 3 weeks ago

HI @haydencbarnes, I tried it, but is seems that our server is responding with HTML instead of JSON when the list of projects is retrieved. I briefly see a message complaining that '<' is not a recognized token in the Raycast window

In the terminal window I only see ` ready - built extension successfully

06:47:28.296 Fetching projects from: /rest/api/2/project?maxResults=500&startAt=0 06:48:47.693 Fetching projects from: /rest/api/2/project?maxResults=500&startAt=0 06:49:30.970 Fetching projects from: /rest/api/2/project?maxResults=500&startAt=0 06:50:37.461 Fetching projects from: /rest/api/2/project?maxResults=500&startAt=0 06:51:15.934 Fetching projects from: /rest/api/2/project?maxResults=500&startAt=0 06:51:38.589 Fetching projects from: /rest/api/2/project?maxResults=500&startAt=0 06:54:35.124 Fetching projects from: /rest/api/2/project?maxResults=500&startAt=0 07:04:35.378 Fetching projects from: /rest/api/2/project?maxResults=500&startAt=0 07:06:56.909 Fetching projects from: /rest/api/2/project?maxResults=500&startAt=0 07:07:01.819 Fetching projects from: /rest/api/2/project?maxResults=500&startAt=0 `

marcgemis commented 3 weeks ago

I added some log instructions, e.g. in requests.ts, just above the const responseBody = await res.json()

The "res" is

` 07:20:36.988 The response: Response {

size: 0,

body: PassThrough {
  _readableState: [ReadableState],
  _events: [Object: null prototype],
  _eventsCount: 6,
  _maxListeners: undefined,
  _writableState: [WritableState],
  allowHalfOpen: true,
  [Symbol(kCapture)]: false,
  [Symbol(kCallback)]: null
},
stream: PassThrough {
  _readableState: [ReadableState],
  _events: [Object: null prototype],
  _eventsCount: 6,
  _maxListeners: undefined,
  _writableState: [WritableState],
  allowHalfOpen: true,
  [Symbol(kCapture)]: false,
  [Symbol(kCallback)]: null
},
boundary: null,
disturbed: false,
error: null

},

type: 'default',
url: 'https://********/rest/api/2/project?maxResults=500&startAt=0',
status: 403,
statusText: '',
headers: {
  connection: 'close',
  'content-security-policy': "frame-ancestors 'self'",
  'content-type<…>

`

of course the ** is the name of our jira host. When I click on that URL in the browser I do get the projects in json format.

marcgemis commented 3 weeks ago

When I replace `

/* Authorization: Basic ${Buffer.from(${prefs.username}:${prefs.token}).toString("base64")}, / Authorization: Bearer ${prefs.token}, ` in requests.ts, it works The above authorization line is based on the code found in the jira-search-self-hosted extension.

haydencbarnes commented 3 weeks ago

@marcgemis, that's interesting. As this is not a file I changed, let me look through it here quickly and confirm that it also works for the cloud. It's interesting that it also gives you a 403, and for me, it does not.

haydencbarnes commented 3 weeks ago

Bearer does not work as nicely for the cloud, unfortunately. OAuth2 Bearers have been added to Jira Server but not to Jira Cloud yet for some reason. But according to https://developer.atlassian.com/server/jira/platform/basic-authentication/ this current request should work fine, and works for me on multiple instances. @marcgemis Can you please shoot me a message over on https://raycastcommunity.slack.com/team/U06UKMRBUU9 with a screenshot of your config for the extension.

haydencbarnes commented 3 weeks ago

CleanShot 2024-06-10 at 01 45 27@2x The username/email field is what I am interested in, not your token, because we know that works. (Except for the question I have below this.)

haydencbarnes commented 3 weeks ago

Also, I would like to confirm that you are using your personal API key and not your organization's API key?

haydencbarnes commented 3 weeks ago

https://********/rest/api/2/project?maxResults=500&startAt=0'

The URL works because you are already authenticated in your browser, the 403 error you are receiving here is a credentials issue.

marcgemis commented 3 weeks ago

Also, I would like to confirm that you are using your personal API key and not your organization's API key?

Yes, I generated a key in Jira via Profile > Personal Access Tokens

We do have Jira v9.12.7#9120007

I don't understand it anymore. Now it works with both methods of authentication, and with email and user name in the settings. Maybe something is cached now?

haydencbarnes commented 3 weeks ago

Hmmm, you could try uninstalling and reinstalling the extension.

marcgemis commented 3 weeks ago

After stopping Raycast, removing the plugin folder, restarting Raycart and retrieving the plugin again, it stopped working. I tried again with email and user name. Nothing worked. As soon as I use the authentication with the Bearer token, it works.

haydencbarnes commented 3 weeks ago

@marcgemis Copy that. Since I have already written the code for switching between APIs for Server/Cloud, will submit a commit here in a minute that switches between bearer for Server and basic for Cloud.

haydencbarnes commented 3 weeks ago

@marcgemis Can you please pull the latest and retry? The update I just submitted to requests.ts should fix your issue.

marcgemis commented 3 weeks ago

seems to work for the project I tried yesterday. (ca 3000 issues) I seem to have problems with a project with + 23000 issues (+10 year old project) but that is unrelated to this.

haydencbarnes commented 3 weeks ago

seems to work for the project I tried yesterday. (ca 3000 issues)

I seem to have problems with a project with + 23000 issues (+10 year old project) but that is unrelated to this.

How many of the 23,000 does it load?

haydencbarnes commented 3 weeks ago

Nevermind, I see https://github.com/raycast/extensions/issues/12886

haydencbarnes commented 2 weeks ago

@pernielsentikaer This can be closed courtesy of https://github.com/raycast/extensions/pull/11918