software-o-o icon indicating copy to clipboard operation
software-o-o copied to clipboard

Use lib/obs instead of ApiConnect

Open agraul opened this issue 6 years ago • 4 comments

lib/obs and ApiConnect serves the same purpose, querying OBS via http. Only one library should be used to reduce duplication of logic. Places ApiConnect is currently used:

app/controllers/obs_controller.rb:

  • line 24: response = ApiConnect.get("public/distributions")

app/controllers/download_controller.rb:

  • line 14: api_result_images = ApiConnect::get("/published/#{@project}/images")
  • line 15: api_result_iso = ApiConnect::get("/published/#{@project}/images/iso")
  • line 56: api_result = ApiConnect::get("/search/published/binary/id?match=project='#{escaped_prj}'+and+name='#{escaped_pkg}'")
  • line 98: pi_result = ApiConnect::get("/search/published/pattern/id?match=project='#{@project}'")
  • line 133: path = "/published/#{params[:project]}/#{params[:repository]}/#{params[:arch]}/#{params[:binary]}?view=ymp" [..] ApiConnect::get(path)
  • line 141: path = "/published/#{params[:project]}/#{params[:repository]}/#{params[:package]}?view=ymp" [...] ApiConnect::get(path)

Most of these API calls don't have a method in lib/obs yet. For them a new method should be implemented. For the others, an appropriate method call should be used.

agraul avatar Feb 23 '19 11:02 agraul

I will probably try to take that -- seems really like a good first issue!

letsfindaway avatar Nov 03 '20 05:11 letsfindaway

Ask for help:

I started implementing this issue and public/distributions and search/published/binary/id should be ok. Now I'm struggling with /search/published/pattern/id, which is used when invoking https://s.o.o/download/pattern?project=<project>&pattern=<pattern>. Just for testing I want to see what is returned by the OBS API and whether I process the results correctly. But I could not find any suitable values for the parameters so that a pattern would be returned. I would expect that

https://software.opensuse.org/download/pattern?project=openSUSE:Leap:15.2&pattern=kde

would give me some usable result. But whatever I try: I get "No result".

Does somebody have any example for me how to correctly invoke this function? Perhaps @agraul ?

letsfindaway avatar Nov 18 '20 10:11 letsfindaway

A similar question to the people who know better about the software and its history: What are the appliances used for? They access https://api.opensuse.org/published/${project}/images and https://api.opensuse.org/published/${project}/images/iso on the API, but both calls return some JavaScript but no usable information. I have tried it with project openSUSE:Leap:15.2 and smilar, and each time I get

try { Object.defineProperty(screen, "availTop", { value: 0 }); } catch (e) {} try { Object.defineProperty(screen, "availLeft", { value: 0 }); } catch (e) {} try { Object.defineProperty(screen, "availWidth", { value: 1920 }); } catch (e) {} try { Object.defineProperty(screen, "availHeight", { value: 1080 }); } catch (e) {} try { Object.defineProperty(screen, "colorDepth", { value: 24 }); } catch (e) {} try { Object.defineProperty(screen, "pixelDepth", { value: 24 }); } catch (e) {} try { Object.defineProperty(navigator, "hardwareConcurrency", { value: 8 }); } catch (e) {} try { Object.defineProperty(navigator, "appVersion", { value: "5.0 (X11)" }); } catch (e) {} try { Object.defineProperty(navigator, "doNotTrack", { value: "unspecified" }); } catch (e) {} try { window.screenY = 0 } catch (e) { } try { window.screenTop = 0 } catch (e) { } try { window.top.window.outerHeight = 1015 } catch (e) { } try { window.screenX = 0 } catch (e) { } try { window.screenLeft = 0 } catch (e) { } try { window.top.window.outerWidth = window.screen.width } catch (e) { } 

Any enlightment for me?

letsfindaway avatar Nov 29 '20 11:11 letsfindaway

from a google this looks like selenium glue code you're seeing.

coolo avatar Nov 29 '20 12:11 coolo