[tw5] Re: Enable CORS on local node server?

2020-10-25 Thread amreus
In my previous post, I meant "expectations" not "exceptions."  As in "The 
fact that the API didn't do what I expected does not mean it's a bug."


-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/b4655349-74c6-4b01-9f78-162ee05a20fdn%40googlegroups.com.


[tw5] Re: Enable CORS on local node server?

2020-10-25 Thread amreus
Apologies Jed - it just didn't meet my exceptions.  Hope I didn't waste too 
much of your time. 

But after some thought, it turns out for my purpose (bookmarking directly 
to a wiki via a bookmarklet) there is no need to enable CORS. TiddlyWiki's 
default node server works just fine. I'll document in another topic. 

On Sunday, October 18, 2020 at 4:29:12 AM UTC-4 inmy...@gmail.com wrote:

> This isn't a bug in Bob, it works as intended.
>
> If the behaviour isn't what you want or expect you can put a feature 
> request on GitHub that clearly states your request. The guidelines for bugs 
> and feature requests are here https://ooktech-public.gitlab.io/guidelines/
>
> On Saturday, October 17, 2020 at 2:26:34 AM UTC+2 amreus wrote:
>
>> I've been testing this using Jed's BobWin.exe on Windows. It works the 
>> same without the need to modify the server so I think I'm going to target 
>> Bob as the server. instead of the TiddlyWiki node server. 
>>
>> (There's currently a bug in bob 
>>  that the created and 
>> modified fields are incorrect.)
>>
>> Here's a basic bookmarklet for a bob server:
>>
>> javascript: (
>>   function () {
>> var data = { tiddlers: {'0': {'fields': {'title': window.location.
>> href,'caption': document.title ;
>> var tid = JSON.stringify(data);
>> var xhr = new XMLHttpRequest();
>> const wikiname = 'bookmarks';
>> xhr.timeout = 1;
>> xhr.onreadystatechange = function () {
>>   console.log('xhr.readyState: ' + xhr.readyState);
>>   console.log('xhr.status: ' + xhr.status);
>>   console.log('xhr.responseText: ' + xhr.responseText);
>>   console.log('xhr.statusText: ' + xhr.statusText);
>> };
>> xhr.open('POST', `http://127.0.0.1:8080/api/push/${wikiname}`);
>> xhr.send(tid);
>>   })();
>>
>>
>>
>> On Monday, October 12, 2020 at 5:40:45 AM UTC-4 amreus wrote:
>>
>>> Thank you. I could use a lot of help with everything. I'm not a 
>>> programmer - I  just play around with things sometimes. The javascript is 
>>> all very hacky and it would be nice to offer the cors as an option instead 
>>> of having it hard-coded.  I can share what I have on github if you or 
>>> anyone else is interested. 
>>>
>>> I have not tried anything other than Firefox on Windows 10.
>>>
>>> Here's an image of the fields I am grabbing.  I decided to hide the 
>>> tiddlers as system tiddlers and use the caption field for display. Also 
>>> changed to using the URL as the unique identifier instead of the html title 
>>> tag. 
>>>
>>> There is a major downside - since you can't catch CORS errors in 
>>> javascript, I'm not sure how to notify the user if the bookmarking fails 
>>> for that reason.  Specifically there is a problem with bookmarking Github 
>>> pages - they are blocking the javascript and I get an error: " Content 
>>> Security Policy: The page’s settings blocked the loading of a resource at 
>>> inline (“script-src”)." I'm not sure if that can be overcome yet.
>>>
>>> But over-all I'm happy with how well it works.  Just browse and click to 
>>> bookmark.  Then use all of the tools available in TiddlyWiki to organize 
>>> your bookmarks. It's slightly less convenient than the built-in bookmarks 
>>> library but vastly more powerful. 
>>>
>>> On Sunday, October 11, 2020 at 9:01:23 PM UTC-4 joshua@gmail.com 
>>> wrote:
>>>
 Excellent work! I've been following you progress. I will definitely use 
 something like this in my Bookmarks plugin.

 Has this been tested in multiple browsers? I also really like how this 
 opens up the possibility to write tiddlers to a wiki-tab while your 
 browser 
 has another tab or content in view. Mahalo (thanks)!

 Best,
 Joshua Fontany
 On Sunday, October 11, 2020 at 2:10:21 AM UTC-7 amreus wrote:

> Thanks Joshua,
>
> I did figure enough of it it out to get a working bookmarklet. I had 
> to add the right headers to the server.js file and put handler file. 
>
> I'm not an expert but I think it is safe enough.  The code is a 
> bookmarklet which calls the WebServer API .  The result is I can press my 
> bookmarklet button on any page and have a tiddler created from the web 
> page 
> info. Kind of cool but I'm not sure how useful it really is.  I think I'm 
> motivated by curiosity and the challenge more than the utility. 
>
> Here's the bookmarklet as of now:
>
>   function () {
> var e = encodeURIComponent;
> var t = document.title;
> var u = window.location.href;
> var data = JSON.stringify({ "tags": "Link", "url": u });
> var xhr = new XMLHttpRequest();
> xhr.open('PUT', 'http://127.0.0.1:8080/recipes/default/tiddlers/'
>  + t);
> xhr.setRequestHeader('x-requested-with', 'TiddlyWiki');
> xhr.onreadystatechange = function () {
>   if (xhr.readyState === 4) {
> console.

[tw5] Re: Enable CORS on local node server?

2020-10-18 Thread Jed Carty
This isn't a bug in Bob, it works as intended.

If the behaviour isn't what you want or expect you can put a feature 
request on GitHub that clearly states your request. The guidelines for bugs 
and feature requests are here https://ooktech-public.gitlab.io/guidelines/

On Saturday, October 17, 2020 at 2:26:34 AM UTC+2 amreus wrote:

> I've been testing this using Jed's BobWin.exe on Windows. It works the 
> same without the need to modify the server so I think I'm going to target 
> Bob as the server. instead of the TiddlyWiki node server. 
>
> (There's currently a bug in bob 
>  that the created and 
> modified fields are incorrect.)
>
> Here's a basic bookmarklet for a bob server:
>
> javascript: (
>   function () {
> var data = { tiddlers: {'0': {'fields': {'title': window.location.href
> ,'caption': document.title ;
> var tid = JSON.stringify(data);
> var xhr = new XMLHttpRequest();
> const wikiname = 'bookmarks';
> xhr.timeout = 1;
> xhr.onreadystatechange = function () {
>   console.log('xhr.readyState: ' + xhr.readyState);
>   console.log('xhr.status: ' + xhr.status);
>   console.log('xhr.responseText: ' + xhr.responseText);
>   console.log('xhr.statusText: ' + xhr.statusText);
> };
> xhr.open('POST', `http://127.0.0.1:8080/api/push/${wikiname}`);
> xhr.send(tid);
>   })();
>
>
>
> On Monday, October 12, 2020 at 5:40:45 AM UTC-4 amreus wrote:
>
>> Thank you. I could use a lot of help with everything. I'm not a 
>> programmer - I  just play around with things sometimes. The javascript is 
>> all very hacky and it would be nice to offer the cors as an option instead 
>> of having it hard-coded.  I can share what I have on github if you or 
>> anyone else is interested. 
>>
>> I have not tried anything other than Firefox on Windows 10.
>>
>> Here's an image of the fields I am grabbing.  I decided to hide the 
>> tiddlers as system tiddlers and use the caption field for display. Also 
>> changed to using the URL as the unique identifier instead of the html title 
>> tag. 
>>
>> There is a major downside - since you can't catch CORS errors in 
>> javascript, I'm not sure how to notify the user if the bookmarking fails 
>> for that reason.  Specifically there is a problem with bookmarking Github 
>> pages - they are blocking the javascript and I get an error: " Content 
>> Security Policy: The page’s settings blocked the loading of a resource at 
>> inline (“script-src”)." I'm not sure if that can be overcome yet.
>>
>> But over-all I'm happy with how well it works.  Just browse and click to 
>> bookmark.  Then use all of the tools available in TiddlyWiki to organize 
>> your bookmarks. It's slightly less convenient than the built-in bookmarks 
>> library but vastly more powerful. 
>>
>> On Sunday, October 11, 2020 at 9:01:23 PM UTC-4 joshua@gmail.com 
>> wrote:
>>
>>> Excellent work! I've been following you progress. I will definitely use 
>>> something like this in my Bookmarks plugin.
>>>
>>> Has this been tested in multiple browsers? I also really like how this 
>>> opens up the possibility to write tiddlers to a wiki-tab while your browser 
>>> has another tab or content in view. Mahalo (thanks)!
>>>
>>> Best,
>>> Joshua Fontany
>>> On Sunday, October 11, 2020 at 2:10:21 AM UTC-7 amreus wrote:
>>>
 Thanks Joshua,

 I did figure enough of it it out to get a working bookmarklet. I had to 
 add the right headers to the server.js file and put handler file. 

 I'm not an expert but I think it is safe enough.  The code is a 
 bookmarklet which calls the WebServer API .  The result is I can press my 
 bookmarklet button on any page and have a tiddler created from the web 
 page 
 info. Kind of cool but I'm not sure how useful it really is.  I think I'm 
 motivated by curiosity and the challenge more than the utility. 

 Here's the bookmarklet as of now:

   function () {
 var e = encodeURIComponent;
 var t = document.title;
 var u = window.location.href;
 var data = JSON.stringify({ "tags": "Link", "url": u });
 var xhr = new XMLHttpRequest();
 xhr.open('PUT', 'http://127.0.0.1:8080/recipes/default/tiddlers/'
  + t);
 xhr.setRequestHeader('x-requested-with', 'TiddlyWiki');
 xhr.onreadystatechange = function () {
   if (xhr.readyState === 4) {
 console.log('xhr.status: ' + xhr.status);
 console.log('xhr.responseText: ' + xhr.responseText);
   }
 };
 xhr.send(data);
   })();

 On Saturday, October 10, 2020 at 11:18:36 PM UTC-4 joshua@gmail.com 
 wrote:

>
> CORS errors are a problem when the javascript you are running is being 
> run from within the Browser, but is trying to access a resource that is 
> not 
> on the "same domain" as the document you are viewing.
>
> 

[tw5] Re: Enable CORS on local node server?

2020-10-16 Thread amreus
I've been testing this using Jed's BobWin.exe on Windows. It works the same 
without the need to modify the server so I think I'm going to target Bob as 
the server. instead of the TiddlyWiki node server. 

(There's currently a bug in bob 
 that the created and 
modified fields are incorrect.)

Here's a basic bookmarklet for a bob server:

javascript: (
  function () {
var data = { tiddlers: {'0': {'fields': {'title': window.location.href,
'caption': document.title ;
var tid = JSON.stringify(data);
var xhr = new XMLHttpRequest();
const wikiname = 'bookmarks';
xhr.timeout = 1;
xhr.onreadystatechange = function () {
  console.log('xhr.readyState: ' + xhr.readyState);
  console.log('xhr.status: ' + xhr.status);
  console.log('xhr.responseText: ' + xhr.responseText);
  console.log('xhr.statusText: ' + xhr.statusText);
};
xhr.open('POST', `http://127.0.0.1:8080/api/push/${wikiname}`);
xhr.send(tid);
  })();



On Monday, October 12, 2020 at 5:40:45 AM UTC-4 amreus wrote:

> Thank you. I could use a lot of help with everything. I'm not a programmer 
> - I  just play around with things sometimes. The javascript is all very 
> hacky and it would be nice to offer the cors as an option instead of having 
> it hard-coded.  I can share what I have on github if you or anyone else is 
> interested. 
>
> I have not tried anything other than Firefox on Windows 10.
>
> Here's an image of the fields I am grabbing.  I decided to hide the 
> tiddlers as system tiddlers and use the caption field for display. Also 
> changed to using the URL as the unique identifier instead of the html title 
> tag. 
>
> There is a major downside - since you can't catch CORS errors in 
> javascript, I'm not sure how to notify the user if the bookmarking fails 
> for that reason.  Specifically there is a problem with bookmarking Github 
> pages - they are blocking the javascript and I get an error: " Content 
> Security Policy: The page’s settings blocked the loading of a resource at 
> inline (“script-src”)." I'm not sure if that can be overcome yet.
>
> But over-all I'm happy with how well it works.  Just browse and click to 
> bookmark.  Then use all of the tools available in TiddlyWiki to organize 
> your bookmarks. It's slightly less convenient than the built-in bookmarks 
> library but vastly more powerful. 
>
> On Sunday, October 11, 2020 at 9:01:23 PM UTC-4 joshua@gmail.com 
> wrote:
>
>> Excellent work! I've been following you progress. I will definitely use 
>> something like this in my Bookmarks plugin.
>>
>> Has this been tested in multiple browsers? I also really like how this 
>> opens up the possibility to write tiddlers to a wiki-tab while your browser 
>> has another tab or content in view. Mahalo (thanks)!
>>
>> Best,
>> Joshua Fontany
>> On Sunday, October 11, 2020 at 2:10:21 AM UTC-7 amreus wrote:
>>
>>> Thanks Joshua,
>>>
>>> I did figure enough of it it out to get a working bookmarklet. I had to 
>>> add the right headers to the server.js file and put handler file. 
>>>
>>> I'm not an expert but I think it is safe enough.  The code is a 
>>> bookmarklet which calls the WebServer API .  The result is I can press my 
>>> bookmarklet button on any page and have a tiddler created from the web page 
>>> info. Kind of cool but I'm not sure how useful it really is.  I think I'm 
>>> motivated by curiosity and the challenge more than the utility. 
>>>
>>> Here's the bookmarklet as of now:
>>>
>>>   function () {
>>> var e = encodeURIComponent;
>>> var t = document.title;
>>> var u = window.location.href;
>>> var data = JSON.stringify({ "tags": "Link", "url": u });
>>> var xhr = new XMLHttpRequest();
>>> xhr.open('PUT', 'http://127.0.0.1:8080/recipes/default/tiddlers/' + 
>>> t);
>>> xhr.setRequestHeader('x-requested-with', 'TiddlyWiki');
>>> xhr.onreadystatechange = function () {
>>>   if (xhr.readyState === 4) {
>>> console.log('xhr.status: ' + xhr.status);
>>> console.log('xhr.responseText: ' + xhr.responseText);
>>>   }
>>> };
>>> xhr.send(data);
>>>   })();
>>>
>>> On Saturday, October 10, 2020 at 11:18:36 PM UTC-4 joshua@gmail.com 
>>> wrote:
>>>

 CORS errors are a problem when the javascript you are running is being 
 run from within the Browser, but is trying to access a resource that is 
 not 
 on the "same domain" as the document you are viewing.

 As long as you 100% make sure that your code is running on the _Server_ 
 (node.js), it can then make any modifications to the Wiki files you need. 
 This will then be picked up the next time the browser syncs with the 
 server.

 Best,
 Joshua Fontany
 On Saturday, October 10, 2020 at 1:41:57 PM UTC-7 amreus wrote:

> Is it possible to allow Cross Origin Resource Sharing when running a 
> node wiki locally?
>
> I'm starting th

[tw5] Re: Enable CORS on local node server?

2020-10-12 Thread amreus
Thank you. I could use a lot of help with everything. I'm not a programmer 
- I  just play around with things sometimes. The javascript is all very 
hacky and it would be nice to offer the cors as an option instead of having 
it hard-coded.  I can share what I have on github if you or anyone else is 
interested. 

I have not tried anything other than Firefox on Windows 10.

Here's an image of the fields I am grabbing.  I decided to hide the 
tiddlers as system tiddlers and use the caption field for display. Also 
changed to using the URL as the unique identifier instead of the html title 
tag. 

There is a major downside - since you can't catch CORS errors in 
javascript, I'm not sure how to notify the user if the bookmarking fails 
for that reason.  Specifically there is a problem with bookmarking Github 
pages - they are blocking the javascript and I get an error: " Content 
Security Policy: The page’s settings blocked the loading of a resource at 
inline (“script-src”)." I'm not sure if that can be overcome yet.

But over-all I'm happy with how well it works.  Just browse and click to 
bookmark.  Then use all of the tools available in TiddlyWiki to organize 
your bookmarks. It's slightly less convenient than the built-in bookmarks 
library but vastly more powerful. 

On Sunday, October 11, 2020 at 9:01:23 PM UTC-4 joshua@gmail.com wrote:

> Excellent work! I've been following you progress. I will definitely use 
> something like this in my Bookmarks plugin.
>
> Has this been tested in multiple browsers? I also really like how this 
> opens up the possibility to write tiddlers to a wiki-tab while your browser 
> has another tab or content in view. Mahalo (thanks)!
>
> Best,
> Joshua Fontany
> On Sunday, October 11, 2020 at 2:10:21 AM UTC-7 amreus wrote:
>
>> Thanks Joshua,
>>
>> I did figure enough of it it out to get a working bookmarklet. I had to 
>> add the right headers to the server.js file and put handler file. 
>>
>> I'm not an expert but I think it is safe enough.  The code is a 
>> bookmarklet which calls the WebServer API .  The result is I can press my 
>> bookmarklet button on any page and have a tiddler created from the web page 
>> info. Kind of cool but I'm not sure how useful it really is.  I think I'm 
>> motivated by curiosity and the challenge more than the utility. 
>>
>> Here's the bookmarklet as of now:
>>
>>   function () {
>> var e = encodeURIComponent;
>> var t = document.title;
>> var u = window.location.href;
>> var data = JSON.stringify({ "tags": "Link", "url": u });
>> var xhr = new XMLHttpRequest();
>> xhr.open('PUT', 'http://127.0.0.1:8080/recipes/default/tiddlers/' + t
>> );
>> xhr.setRequestHeader('x-requested-with', 'TiddlyWiki');
>> xhr.onreadystatechange = function () {
>>   if (xhr.readyState === 4) {
>> console.log('xhr.status: ' + xhr.status);
>> console.log('xhr.responseText: ' + xhr.responseText);
>>   }
>> };
>> xhr.send(data);
>>   })();
>>
>> On Saturday, October 10, 2020 at 11:18:36 PM UTC-4 joshua@gmail.com 
>> wrote:
>>
>>>
>>> CORS errors are a problem when the javascript you are running is being 
>>> run from within the Browser, but is trying to access a resource that is not 
>>> on the "same domain" as the document you are viewing.
>>>
>>> As long as you 100% make sure that your code is running on the _Server_ 
>>> (node.js), it can then make any modifications to the Wiki files you need. 
>>> This will then be picked up the next time the browser syncs with the server.
>>>
>>> Best,
>>> Joshua Fontany
>>> On Saturday, October 10, 2020 at 1:41:57 PM UTC-7 amreus wrote:
>>>
 Is it possible to allow Cross Origin Resource Sharing when running a 
 node wiki locally?

 I'm starting the server using the command: tiddlywiki.js  --listen




-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/a3c91c66-8265-4943-8939-0dcec991cdcdn%40googlegroups.com.


[tw5] Re: Enable CORS on local node server?

2020-10-11 Thread Joshua Fontany
Excellent work! I've been following you progress. I will definitely use 
something like this in my Bookmarks plugin.

Has this been tested in multiple browsers? I also really like how this 
opens up the possibility to write tiddlers to a wiki-tab while your browser 
has another tab or content in view. Mahalo (thanks)!

Best,
Joshua Fontany
On Sunday, October 11, 2020 at 2:10:21 AM UTC-7 amreus wrote:

> Thanks Joshua,
>
> I did figure enough of it it out to get a working bookmarklet. I had to 
> add the right headers to the server.js file and put handler file. 
>
> I'm not an expert but I think it is safe enough.  The code is a 
> bookmarklet which calls the WebServer API .  The result is I can press my 
> bookmarklet button on any page and have a tiddler created from the web page 
> info. Kind of cool but I'm not sure how useful it really is.  I think I'm 
> motivated by curiosity and the challenge more than the utility. 
>
> Here's the bookmarklet as of now:
>
>   function () {
> var e = encodeURIComponent;
> var t = document.title;
> var u = window.location.href;
> var data = JSON.stringify({ "tags": "Link", "url": u });
> var xhr = new XMLHttpRequest();
> xhr.open('PUT', 'http://127.0.0.1:8080/recipes/default/tiddlers/' + t
> );
> xhr.setRequestHeader('x-requested-with', 'TiddlyWiki');
> xhr.onreadystatechange = function () {
>   if (xhr.readyState === 4) {
> console.log('xhr.status: ' + xhr.status);
> console.log('xhr.responseText: ' + xhr.responseText);
>   }
> };
> xhr.send(data);
>   })();
>
> On Saturday, October 10, 2020 at 11:18:36 PM UTC-4 joshua@gmail.com 
> wrote:
>
>>
>> CORS errors are a problem when the javascript you are running is being 
>> run from within the Browser, but is trying to access a resource that is not 
>> on the "same domain" as the document you are viewing.
>>
>> As long as you 100% make sure that your code is running on the _Server_ 
>> (node.js), it can then make any modifications to the Wiki files you need. 
>> This will then be picked up the next time the browser syncs with the server.
>>
>> Best,
>> Joshua Fontany
>> On Saturday, October 10, 2020 at 1:41:57 PM UTC-7 amreus wrote:
>>
>>> Is it possible to allow Cross Origin Resource Sharing when running a 
>>> node wiki locally?
>>>
>>> I'm starting the server using the command: tiddlywiki.js  --listen
>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/ad08577f-cbec-4dec-90e3-4e6a5808daa4n%40googlegroups.com.


[tw5] Re: Enable CORS on local node server?

2020-10-11 Thread amreus
Thanks Joshua,

I did figure enough of it it out to get a working bookmarklet. I had to add 
the right headers to the server.js file and put handler file. 

I'm not an expert but I think it is safe enough.  The code is a bookmarklet 
which calls the WebServer API .  The result is I can press my bookmarklet 
button on any page and have a tiddler created from the web page info. Kind 
of cool but I'm not sure how useful it really is.  I think I'm motivated by 
curiosity and the challenge more than the utility. 

Here's the bookmarklet as of now:

  function () {
var e = encodeURIComponent;
var t = document.title;
var u = window.location.href;
var data = JSON.stringify({ "tags": "Link", "url": u });
var xhr = new XMLHttpRequest();
xhr.open('PUT', 'http://127.0.0.1:8080/recipes/default/tiddlers/' + t);
xhr.setRequestHeader('x-requested-with', 'TiddlyWiki');
xhr.onreadystatechange = function () {
  if (xhr.readyState === 4) {
console.log('xhr.status: ' + xhr.status);
console.log('xhr.responseText: ' + xhr.responseText);
  }
};
xhr.send(data);
  })();

On Saturday, October 10, 2020 at 11:18:36 PM UTC-4 joshua@gmail.com 
wrote:

>
> CORS errors are a problem when the javascript you are running is being run 
> from within the Browser, but is trying to access a resource that is not on 
> the "same domain" as the document you are viewing.
>
> As long as you 100% make sure that your code is running on the _Server_ 
> (node.js), it can then make any modifications to the Wiki files you need. 
> This will then be picked up the next time the browser syncs with the server.
>
> Best,
> Joshua Fontany
> On Saturday, October 10, 2020 at 1:41:57 PM UTC-7 amreus wrote:
>
>> Is it possible to allow Cross Origin Resource Sharing when running a node 
>> wiki locally?
>>
>> I'm starting the server using the command: tiddlywiki.js  --listen
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/a408b474-2e66-4af1-b57e-3b95200666bcn%40googlegroups.com.


[tw5] Re: Enable CORS on local node server?

2020-10-11 Thread amreus
Thanks Joshua,

I did figure this out. I had to add some headers to the server.js and put 
handler  files.

I'm definitely not an expert in the area, but i believe it is safe. The 
Javascript code is running from a bookmarklet in my browser.  The 
bookmarklet just sends the current web page title and url to the node 
server using the WebServer API, which creates a tiddler from the data. I 
think I wanted to do it more out of curiosity than any useful purpose. 

javascript: (
  function () {
var data = JSON.stringify({ "tags": "Link", "url": window.location.href 
});
var xhr = new XMLHttpRequest();
xhr.open('PUT', 'http://127.0.0.1:8080/recipes/default/tiddlers/' + 
document.title);
xhr.onreadystatechange = function () {
  if (xhr.readyState === 4) {
console.log('xhr.status: ' + xhr.status);
console.log('xhr.responseText: ' + xhr.responseText);
  }
};
xhr.send(data);
  })();

On Saturday, October 10, 2020 at 11:18:36 PM UTC-4 joshua@gmail.com 
wrote:

>
> CORS errors are a problem when the javascript you are running is being run 
> from within the Browser, but is trying to access a resource that is not on 
> the "same domain" as the document you are viewing.
>
> As long as you 100% make sure that your code is running on the _Server_ 
> (node.js), it can then make any modifications to the Wiki files you need. 
> This will then be picked up the next time the browser syncs with the server.
>
> Best,
> Joshua Fontany
> On Saturday, October 10, 2020 at 1:41:57 PM UTC-7 amreus wrote:
>
>> Is it possible to allow Cross Origin Resource Sharing when running a node 
>> wiki locally?
>>
>> I'm starting the server using the command: tiddlywiki.js  --listen
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/a54f58f2-36e5-4dde-8d74-96acf179122fn%40googlegroups.com.


[tw5] Re: Enable CORS on local node server?

2020-10-10 Thread Joshua Fontany

CORS errors are a problem when the javascript you are running is being run 
from within the Browser, but is trying to access a resource that is not on 
the "same domain" as the document you are viewing.

As long as you 100% make sure that your code is running on the _Server_ 
(node.js), it can then make any modifications to the Wiki files you need. 
This will then be picked up the next time the browser syncs with the server.

Best,
Joshua Fontany
On Saturday, October 10, 2020 at 1:41:57 PM UTC-7 amreus wrote:

> Is it possible to allow Cross Origin Resource Sharing when running a node 
> wiki locally?
>
> I'm starting the server using the command: tiddlywiki.js  --listen
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/2beea222-54e7-4c3d-84d1-3d8d034b0099n%40googlegroups.com.