Foto de la portada

tonnerkiller

tonnerkiller@hub.debenny.de

News from the Quotes Machine

tonnerkiller
  
John Cusack va escriure:
Death is a billion-dollar business. They can't even pass a law where it takes seven days to get a gun. Why don't you have to go through the same kind of screening you do to get a driver's license? It's totally insane.

Credit: Retrieved from: Free Random Quotes API by Tadas Talaikis
News from the Quotes Machine

tonnerkiller
  
Benjamin Disraeli va escriure:
The greatest good you can do for another is not just share your riches, but reveal to them their own.

Credit: Retrieved from: Forismatic API by Alty
News from the Quotes Machine

tonnerkiller
  
Larry Ellison va escriure:
Bill Gates wants people to think he's Edison, when he's really Rockefeller. Referring to Gates as the smartest man in America isn't right... wealth isn't the same thing as intelligence.

Credit: Free Random Quotes API by Tadas Talaikis
evwr

tonnerkiller
  
eve
With HTML, not Javascript

tonnerkiller
  
This is a Test
wcw

tonnerkiller
  
wdcwc
tonnerkiller
  
I saw Deep Purple live once and I paid money for it and I thought, 'Geez, this is ridiculous.' You just see through all that sort of stuff. I never liked those Deep Purples or those sort of things. I always hated it. I always thought it was a poor man's Led Zeppelin. - Angus Young
giac hellvecio
  
I saw deep purple live years years...ago. I liked a lot!
tonnerkiller
  
I just play around with a quotes api. The above is a quote of Angus Young (AC/DC). I never saw either Deep Porple or Led Zeppelin.
test

tonnerkiller
  
foo
tonnerkiller
  últim editat: Thu, 18 Jan 2018 09:56:15 +0100  
@Hubzilla Support Forum+
This in the browser address line:

https://username:password@hub.debenny.de/api/z/1.0/item/update?&body=foo

working like expected.

Now me trying to get the same result with an ajax call:

$.ajax({
url: 'https://'+username+":"+password+"@"+hub+'/api/z/1.0/item/update',
type: 'POST',
crossDomain: true,
data: {
body:foo
}
});


what do I miss to make the ajax work?

Failing miserably. Bear with me, I'm only beginning with Javascript... Here's a link to the corresponding codepen:
https://codepen.io/tonnerkiller/pen/dJeJRX?editors=1111
tonnerkiller
  últim editat: Sat, 20 Jan 2018 00:39:43 +0100  
I got it working with html form alone, setting action to the api Link and method to post...

But the $.post() inside the click event listener on the button seems to not execute. At least I get so such report from the network analyser in my Firefox developer tools...
tonnerkiller
  
Adding event.preventDefault(); first in the event handler function got me so far, that the ".post was actually executed afterwards. But I got several errors, depending on what I do.

I get a blocking error due to the same-origin-policy.
I get a 401 unauthorized status, supposingly for not giving username and password.
I can get around the same origin thing withthe proxy cors-anywhere.herokuapp.com for the moment. This will be left for later to deal with.
I find it strange that neither of these errors seem to come up if I use plain html form.

Ah, and if I give login credentials either in the url or by adding username and password attributes to the settings object of the $.post() call, the call isn't even executed...
tonnerkiller
  
The combination of the proxy cors-anywhere.herokuapp.com and giving login credentials per beforeSend doesn't work. So there is still the cross-origin issue. As Hubzilla is a decentralised network and I want my code to work with every instance, inclusing those where the admin has no control over the server software to set proper cors headers, I will use window.open() instead of an ajax call. I'll be calling /rpost/ instead of item/update, so I get a neat form for possible corrections or additions.

I think this is the best thing to do.

I still wonder why it worked with a plain html form...
tonnerkiller
  
foo
tonnerkiller
  
foo
tonnerkiller
  
foo
tonnerkiller
  
foozid=tonnerkiller@hub.debenny.de
tonnerkiller
  
foo
Playing with the Zot API

tonnerkiller
  
@Hubzilla Support Forum+
Hi everyone,
trying to make a post to Hubzilla button an a webpage I read through the Help Docu on my hub.

Problem is, I have multiple channels (2 for the time being) and might not know whichone is logged in at the moment.
When I hit a "Post to Hubzilla" button on an external webpage, I need a wayto specify which channel is about to post the content.
I first thought xchan_remote was what I am looking for, but it turns out, being logged in with channel a and giving the xchan value of channel b is like b writing on the wall of a.
Looking into some old "post to redmatrix" stuff I found lead me to an attribute "channel", which does the trick, so
https://hub.debenny.de/api/z/1.0/item/update?body="test"&channel=tonnerkiller
does the trick, no matter which channel is logged in atm.
So far so good.
All I wanted to know is if the docu is just missing that (then I might just write two lines to it) or this is some deprecated attribute not meant to actualy work anymore and thus not documented.
tonnerkiller
  
Thank you.
h.ear.t | tobias
  
Hm. Just saw that this threat is in fact already a bit older. But anyway, it might be useful for someone.
I am running a little bash script via cron that posts my public home IP into a private channel. A bit less convenient a as dynamic dns service, but at the time I needed something very quick and this is what I came up with. Using it still.

  1.  Password=thisisasecret
  2.  MYIP=$(dig +short myip.opendns.com @resolver1.opendns.com)
  3.  curl -ssl -u email@example.com:$Password -d  status="this shiny super new IP is http://$MYIP and $MYIP" -d channel="mychannel"  https://example.com/api/statuses/update
The Tonnerkiller Coding Experience
 
no so ein Test
hzkick | tobias
  
Ja, auch. :)
The Tonnerkiller Coding Experience
 
"neuer tce Versuch"
tonnerkiller
  
"tonnerkiller schreibt"
tonnerkiller
  
"hi world"
tonnerkiller
  
"hi world"
Maria Karlsen
  
Hello:-)
tonnerkiller
  
:) I'm playing around with the API, but thanks for the reply ;)
F00F BUG
  
Yo