Conversation
Enable caching for CocoaPods Spice Fixed typo in test cases Fixed favicon for CocoaPods
@@ -0,0 +1,38 @@ | |||
package DDG::Spice::Cocoapods; | |||
# ABSTRACT: Write an abstract here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@soleo you can remove these comments, they're just for you to see/read when developing your IA.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
@moollaza , cleaned code and added more test cases. |
@soleo this is looking great! I see that the version number is getting cut off though, so I think we should put that in the Also, let's make sure we join the authors names with a JS normalize: function(item) {
return {
title: item.id,
altSubtitle: item.version,
subtitle: item.platforms.join(", ").toUpperCase(),
url: item.link,
description: item.summary,
authors: Object.keys(item.authors),
}
},
templates: {
group: 'list',
detail: false,
item_detail: false,
variants: {
tileTitle: '1line',
tileSnippet: 'small',
tileFooter: '1line'
},
options: {
footer: Spice.cocoapods.footer
}
} Footer <div class="one-line">
<span class="ddgsi ddgsi-user"></span> {{#concat authors sep=", " conj=", "}}{{this}}{{/concat}}
</div> The above code results in: One other approach I thought of would be to pass an array with the version and platforms to subtitle, which creates: |
@abeyang any thoughts on this? |
I like the second option better. After all, platform string should not be longer than "IOS,OSX,WATCHOS". There are plenty of space left for version number. |
@soleo home important is the contributor name? I spoke with our design team and we think the best solution is to remove the contributor and put the supporter platforms as the footer. Would you be okay with that? |
I'm fine with removing the authors line. I was thinking about giving the creator more credit for making dev libraries, but the users should be able to see the info after they click on those cards anyway. I'll make the change once I'm available. |
@soleo much better, lets keep the platform right-aligned for consistency. |
@soleo this LGTM 👍 Thanks a lot for contributing (we really appreciate it 😃). We invite you to stick around and comment/help on other PR's & Issues or even submit an Instant Answer! |
@moollaza , I will. DDG is my farvorate searching engine, love to help and keep building something cool. |
@soleo By the way, we think you did a great job with this! Are you interested in helping others who build similar Instant Answers in the future? If yes, we'll reach out and add you to a private list of mentors as well as send over some DDG merch as an additional thank you. Just email open@duckduckgo.com with the subject 'I want to help.' Please include your shipping address, phone-number (required for shipping outside USA) and t-shirt size. We'll reach out from there! Otherwise, thank you for this amazing contribution. We hope you'll keep exploring and playing around with DuckDuckHack. |
@soleo hey there! I'm very sorry that we haven't gotten your Instant Answer online! We've been trying to understand for quite a while why it has never worked in our production environment. Yesterday we finally figured it out! It turns out that the Cocoapods API returns a HTTP 403 to any requests made to their servers with a defined Are you familiar with the API Maintainers? Would you be interested in reaching out to them to explain this and have them fix their API? |
Haha, i see. I'll contact them about this On Friday, April 22, 2016, Zaahir Moolla notifications@github.com wrote:
Sent from Gmail Mobile |
Thanks! |
@moollaza just got a message from the search API developer @floere. You have to provide the for instance,
would work. But
would return Forbidden |
@soleo thanks for the update -- AFAIK there's no easy way for us to do that. It also seems like it wouldn't make sense for us to send it in our situations because we're not technically making a cross-origin request here (which is when the Origin header is useful) Would it be possible for them to make an exception for us? Perhaps a new URL parameter or api-key? |
@moollaza if Cocoapods add jsonp support, would it solve the current issue? |
Hi @moollaza! I thought I'd say hi 😊
Can you help me out a bit here and explain a bit more? (I am not aware of the infrastructure) Thanks! |
@floere great, you're here! We can work through this here instead of emailing each other. |
That would be great, but I don't think it will solve this problem...
Hi @floere thanks a lot for joining us on here and great to meet you! Let me explain the infrastructure/data-flow
It works this way so the client only ever speaks to DuckDuckGo and we speak to third-party APIs on their behalf. This way, the users IP and other info is only exposed to DuckDuckGo to protect their privacy. From what I can tell, in proxying the request, we're not technically creating a cross-origin request, at least not in the typical sense, because the client isn't aware that the data is coming from another domain, it just thinks it's speaking to DuckDuckGo. Does that make sense? |
Hi, @floere! Is it possible to make it work without the required headers? |
Hi @jagtalon – thanks for pinging me again. @moollaza's answer must have gotten lost on my end. Sorry about that. First of all, thanks @moollaza for the warm welcome and the great explanation! Ok, so I understand why the client should think it's only talking to DDG, and all APIs are proxied through the DDG servers. That makes sense, and is helpful to know. So I think we can reduce the focus of this discussion on the call from DDG server (NGINX) to the CP API. I agree that it is not a cross-origin request from the client. However, given that you pass a referrer from the DDG server, I'd say that it is a cross-origin request as well from the DDG server. To me, it makes sense to pass either none, or both referrer and origin. Wouldn't you agree? I assume that it would not be hard to implement either solution in NGINX and the CP API accepts either as @soleo demonstrated above – but I am open to be proven wrong, in any case. All the best to you all and a useful & great search engine! |
I agree. We just made some recent changes to ensure we do send the referer, so I'll see if I can easily add support for |
hey @soleo thank you for your contribution to DuckDuckHack, we really appreciate it! I'm reaching out to let you know that we recently launched a new forum with the initiative of improving programming-related searches, and I hope you'll join us! There are a lot of important tasks up for grabs that we'd like your help with, so feel free to and jump in. |
@moollaza This is great to hear 😊 All the best in moving forward with the CP spice! Let me know if you need something from the CP API end 🚀 |
@moollaza Great news indeed! |
@soleo would you be interested in finishing this up? We'd like to improve the Swift query space (https://forum.duckduckhack.com/t/swift-search-overview/98) and this should answer a significant chunk of it. Here's the forum task: https://forum.duckduckhack.com/t/cocoapods-instant-answer/241 If you're interested in joining us, please hit me up at jag@duckduckgo.com or on the forum! |
Made an issue for it: #2927 🐿 |
@jagtalon this IA can move forward until that DDG PR is merged. |
@moollaza oh I misunderstood! My bad. |
@soleo @floere 431 days after merge, this is finally live! https://duckduckgo.com/?q=cocoapods+expecta 😄 🚀 Sorry for the very long delay. It took us a little while to add in support for specifying the values of individual headers. |
Hell yes! |
What does your Instant Answer do?
Searching in CocoaPods
What problem does your Instant Answer solve (Why is it better than organic links)?
Shows more result related to the query
What is the data source for your Instant Answer? (Provide a link if possible)
CocoaPods API
http://search.cocoapods.org/api/v1/pods.flat.hash.json?query=test
Why did you choose this data source?
Very comprehensive and provide all data points we need.
Are there any other alternative (better) data sources?
More endpoints in this blog. http://blog.cocoapods.org/Search-API-Version-1/
What are some example queries that trigger this Instant Answer?
cocoapods afnetworking
cocoapods test
Which communities will this Instant Answer be especially useful for? (gamers, book lovers, etc)
Software Developers
Is this Instant Answer connected to a DuckDuckHack Instant Answer idea?
https://duck.co/ideas/idea/6307/cocoapods-library-lookup
Which existing Instant Answers will this one supersede/overlap with?
None
Are you having any problems? Do you need our help with anything?
Nope
What are the terms of use for the API? Will DuckDuckGo need specific authorization (e.g. an API key)? Are there any costs associated with API usage?
Free. No Authorization needed. No Cost.
Where did you hear about DuckDuckHack? (For first time contributors)
GitHub
What does the Instant Answer look like? (Provide a screenshot for new or updated Instant Answers)
Checklist
Please place an 'X' where appropriate.
IA Page: https://duck.co/ia/view/cocoapods