GithubHelp home page GithubHelp logo

how to run? about caldav-adapter HOT 30 CLOSED

lixaotec avatar lixaotec commented on May 23, 2024
how to run?

from caldav-adapter.

Comments (30)

sedenardi avatar sedenardi commented on May 23, 2024 1

localhost:5232/user/exampleCal1

(ive changed in json user@co to just user.)

You have to use the full username in the URL you're connecting to. So once the server is running, use this as the server:

/caldav/p/user@co

The caldav portion is defined by the caldavRoot option, so you can segment requests on your server. The /p/ means you're connecting to all the calendars for the principal. This is how iOS and MacOS need to connect to CalDAV servers.

I've updated the README with that information.

from caldav-adapter.

lixaotec avatar lixaotec commented on May 23, 2024

seems the problem is happening with koa.ts

const rootRegexp = pathToRegexp(path.join(rootRoute, '/:params'));
const calendarRegex: CalRegex = { keys: [] };
calendarRegex.regexp = pathToRegexp(path.join(calendarRoute, '/:principalId/:calendarId/:eventId'), calendarRegex.keys);
const principalRegex: CalRegex = { keys: [] };
principalRegex.regexp = pathToRegexp(path.join(principalRoute, '/:principalId'), principalRegex.keys);

pathToRegexp dont like * ? at routes

from caldav-adapter.

sedenardi avatar sedenardi commented on May 23, 2024

Can you give an example of the URL you're sending? You have to make sure all your URLs are encoded before being sent to this middleware.

from caldav-adapter.

lixaotec avatar lixaotec commented on May 23, 2024

I´m trying to use it with iOS 12.4.6 (iphone 5s).

localhost:5232/user/exampleCal1

(ive changed in json user@co to just user.)

When i run the project, at execution time, node seems not to like the * at pathToRegex parameters. i´m stuck at that point.

Thanks for your reply.

from caldav-adapter.

lixaotec avatar lixaotec commented on May 23, 2024

Also Ive noticed an behavior at the first comuniction iOS -> caldav adapter it seems to fail when the first response ask for Auth.
It appears, iOS is not expecting the WWW-Authenticate... as it simply fails

from caldav-adapter.

lixaotec avatar lixaotec commented on May 23, 2024

TCP server accepting connection on port: 5555
** START **
<< From client to proxy PROPFIND /user/exampleCal1/ HTTP/1.1
Host: 192.168.100.11:5555
Content-Type: text/xml
Depth: 0
Brief: t
Accept: /
Connection: keep-alive
Prefer: return=minimal
User-Agent: iOS/12.4.6 (16G183) accountsd/1.0
Content-Length: 181
Accept-Language:
Accept-Encoding: gzip, deflate

<A:propfind xmlns:A="DAV:">
<A:prop>
<A:current-user-principal/>
<A:principal-URL/>
<A:resourcetype/>
</A:prop>
</A:propfind>

From proxy to remote PROPFIND /user/exampleCal1/ HTTP/1.1
Host: 192.168.100.11:5555
Content-Type: text/xml
Depth: 0
Brief: t
Connection: keep-alive
Prefer: return=minimal
User-Agent: iOS/12.4.6 (16G183) accountsd/1.0
Content-Length: 181
Accept-Language:
Accept-Encoding: gzip, deflate

<A:propfind xmlns:A="DAV:">
<A:prop>
<A:current-user-principal/>
<A:principal-URL/>
<A:resourcetype/>
</A:prop>
</A:propfind>

<< From remote to proxy HTTP/1.1 401 Unauthorized
Vary: Accept-Encoding
WWW-Authenticate: Basic realm="localhost/caldav"
Content-Type: text/plain; charset=utf-8
Content-Length: 12
Date: Fri, 05 Jun 2020 06:59:52 GMT
Connection: keep-alive

Unauthorized

From proxy to client HTTP/1.1 401 Unauthorized
Vary: Accept-Encoding
WWW-Authenticate: Basic realm="localhost/caldav"
Content-Type: text/plain; charset=utf-8
Content-Length: 12
Date: Fri, 05 Jun 2020 06:59:52 GMT
Connection: keep-alive

Unauthorized

from caldav-adapter.

lixaotec avatar lixaotec commented on May 23, 2024

Did a resfresh to your code... after npm i
I get this

npm run watch

[email protected] watch C:\node-caldav-adapter-master
nodemon -e js --ignore node_modules/ --inspect example/server.js

[nodemon] 2.0.4
[nodemon] to restart at any time, enter rs
[nodemon] watching path(s): .
[nodemon] watching extensions: js
[nodemon] starting node --inspect example/server.js
Debugger listening on ws://127.0.0.1:9229/1db2aeb7-773c-4d3e-9e72-612c52027804
For help, see: https://nodejs.org/en/docs/inspector
C:\node-caldav-adapter-master\node_modules\path-to-regexp\dist\index.js:47
throw new TypeError("Missing parameter name at " + i);
^

TypeError: Missing parameter name at 1
at lexer (C:\node-caldav-adapter-master\node_modules\path-to-regexp\dist\index.js:47:23)
at parse (C:\node-caldav-adapter-master\node_modules\path-to-regexp\dist\index.js:97:18)
at stringToRegexp (C:\node-caldav-adapter-master\node_modules\path-to-regexp\dist\index.js:329:27)
at Object.pathToRegexp (C:\node-caldav-adapter-master\node_modules\path-to-regexp\dist\index.js:403:12)
at Object.default_1 [as koa] (C:\node-caldav-adapter-master\lib\koa.js:25:41)
at Object. (C:\node-caldav-adapter-master\example\server.js:14:17)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
[nodemon] app crashed - waiting for file changes before starting...

from caldav-adapter.

sedenardi avatar sedenardi commented on May 23, 2024

Have you changed anything in the example/server.js file?

from caldav-adapter.

lixaotec avatar lixaotec commented on May 23, 2024

nope

from caldav-adapter.

lixaotec avatar lixaotec commented on May 23, 2024

just build from source again.
my node is v12.16.3
I read this regardin path.join()
"Join all arguments together and normalize the resulting path. Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown."
Could be that?

from caldav-adapter.

lixaotec avatar lixaotec commented on May 23, 2024

Think i got
as I am running in windows
rootRoute gets with path.resolve
C:\caldav

from caldav-adapter.

sedenardi avatar sedenardi commented on May 23, 2024

Ahh, koa.ts should be using path.join rather than path.resolve, since Windows machines use backslashes.

To confirm this is the issue, can you change line 47 of koa.ts, run npm i, and confirm that works?

from caldav-adapter.

lixaotec avatar lixaotec commented on May 23, 2024

sure, i´m working on it

from caldav-adapter.

lixaotec avatar lixaotec commented on May 23, 2024

another issue now:
backslash still got \ , instead of /

\caldav
C:\node-caldav-adapter-master\node_modules\path-to-regexp\dist\index.js:113
throw new TypeError("Unexpected " + nextType + " at " + index + ", expected " + type);
^

TypeError: Unexpected MODIFIER at 15, expected END
at mustConsume (C:\node-caldav-adapter-master\node_modules\path-to-regexp\dist\index.js:113:15)
at parse (C:\node-caldav-adapter-master\node_modules\path-to-regexp\dist\index.js:172:9)
at stringToRegexp (C:\node-caldav-adapter-master\node_modules\path-to-regexp\dist\index.js:329:27)
at Object.pathToRegexp (C:\node-caldav-adapter-master\node_modules\path-to-regexp\dist\index.js:403:12)
at Object.default_1 [as koa] (C:\node-caldav-adapter-master\lib\koa.js:26:41)
at Object. (C:\node-caldav-adapter-master\example\server.js:14:17)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
[nodemon] app crashed - waiting for file changes before starting...

from caldav-adapter.

lixaotec avatar lixaotec commented on May 23, 2024

perhaps all path.join is working unexpectly with windows env...

from caldav-adapter.

lixaotec avatar lixaotec commented on May 23, 2024

im trying use path.posix.join

from caldav-adapter.

lixaotec avatar lixaotec commented on May 23, 2024

It did solve path issues!!

And now we´re on the other trouble with auth..

** START **
<< From client to proxy PROPFIND /caldav/p/user/ HTTP/1.1
Host: 192.168.100.11:5555
Content-Type: text/xml
Depth: 0
Brief: t
Accept: /
Connection: keep-alive
Prefer: return=minimal
User-Agent: iOS/12.4.6 (16G183) accountsd/1.0
Content-Length: 181
Accept-Language: pt-br
Accept-Encoding: gzip, deflate

** START **
<< From client to proxy
<A:propfind xmlns:A="DAV:">
<A:prop>
<A:current-user-principal/>
<A:principal-URL/>
<A:resourcetype/>
</A:prop>
</A:propfind>

From proxy to remote PROPFIND /caldav/p/user/ HTTP/1.1
Host: 192.168.100.11:5555
Content-Type: text/xml
Depth: 0
Brief: t
Accept: /
Connection: keep-alive
Prefer: return=minimal
User-Agent: iOS/12.4.6 (16G183) accountsd/1.0
Content-Length: 181
Accept-Language: pt-br
Accept-Encoding: gzip, deflate

From proxy to remote
<A:propfind xmlns:A="DAV:">
<A:prop>
<A:current-user-principal/>
<A:principal-URL/>
<A:resourcetype/>
</A:prop>
</A:propfind>

<< From remote to proxy HTTP/1.1 401 Unauthorized
Vary: Accept-Encoding
WWW-Authenticate: Basic realm="localhost/caldav"
Content-Type: text/plain; charset=utf-8
Content-Length: 12
Date: Fri, 05 Jun 2020 19:12:56 GMT
Connection: keep-alive

Unauthorized

From proxy to client HTTP/1.1 401 Unauthorized
Vary: Accept-Encoding
WWW-Authenticate: Basic realm="localhost/caldav"
Content-Type: text/plain; charset=utf-8
Content-Length: 12
Date: Fri, 05 Jun 2020 19:12:56 GMT
Connection: keep-alive

Unauthorized
<< From remote to proxy HTTP/1.1 400 Bad Request
Connection: close

From proxy to client HTTP/1.1 400 Bad Request
Connection: close

from caldav-adapter.

lixaotec avatar lixaotec commented on May 23, 2024

just removed @ex.co from json , so to avoid any possible encoding issue

from caldav-adapter.

sedenardi avatar sedenardi commented on May 23, 2024

im trying use path.posix.join

Great. I don't have a windows machine to test on so thanks for bringing this to my attention. I've changed the code to use path.posix instead of just path. I'll push that change shortly.

As for the auth issues, what are the server settings you're using? Server, User Name, Password?

@ex.co being in the username isn't an issue, as it gets URL encoded automatically by clients and decoded automatically by the server.

from caldav-adapter.

lixaotec avatar lixaotec commented on May 23, 2024

Glad to contribute. And thank for the work you´ve done with this project.

i´m using the default settings. Also had tried @ex.co.. in fact no differences, But auth wont accomplish.

localhost:3001, [email protected], pass

I think this step at auth wont working because ios wont send it at the first step
const creds = basicAuth(ctx);

trying to figure out

from caldav-adapter.

sedenardi avatar sedenardi commented on May 23, 2024

Are you using the full url http://localhost:3001/caldav/p/[email protected] in the iOS or MacOS settings?

from caldav-adapter.

lixaotec avatar lixaotec commented on May 23, 2024

iOS .. and yes for the path.
Just tried a bunch of variations.

from caldav-adapter.

sedenardi avatar sedenardi commented on May 23, 2024

And I assume you've confirmed that your phone can access your computer's localhost? I've run into this issue before and had to use ngrok or a similar service.

from caldav-adapter.

lixaotec avatar lixaotec commented on May 23, 2024

sure. I ve tried directly .. and with a proxy to capture the packages.
I´m pretty sure its something to do with the fact of ios isnt sending credentials at first, as ssl is disabled. and the workflow is expecting another message.

I am looking into this reference: https://wiki.wocommunity.org/display/~probert/CalDAV+and+CardDAV+handshake

from caldav-adapter.

lixaotec avatar lixaotec commented on May 23, 2024

or perhaps im missing something with realm (dont know how it works)

from caldav-adapter.

sedenardi avatar sedenardi commented on May 23, 2024

Ahh yeah you may have to use an HTTPS connection. I'm not sure if that's an iOS restriction or not.

from caldav-adapter.

lixaotec avatar lixaotec commented on May 23, 2024

hum.. how to set koa to respond that?

from caldav-adapter.

sedenardi avatar sedenardi commented on May 23, 2024

That's sort of outside the scope of this module, but there are many ways to do it. You can use ngrok to create an https tunnel to your localhost for development purposes, or create a self-signed HTTPS cert for your machine.

from caldav-adapter.

lixaotec avatar lixaotec commented on May 23, 2024

Just manage to make koa listen at https with a simply self signed cert.

And its all working now!

Thank you very much for the attention!
If you wish i may pr this https piece.

Hope to work with you to improve the tool, and share knowledge with you.

from caldav-adapter.

sedenardi avatar sedenardi commented on May 23, 2024

No problem.

from caldav-adapter.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.