Giter Club home page Giter Club logo

api's Introduction

xBrowserSync

API service

Build Status Coverage Status Dependencies Known Vulnerabilities GitHub license Liberapay patrons

GitHub stars GitHub forks

xBrowserSync is a free tool for syncing browser data between different browsers and devices, built for privacy and anonymity. For full details, see www.xbrowsersync.org.

This repository contains the source code for the REST service API that client applications communicate with. If you'd like to run your own xBrowserSync service on your Node.js web server, follow the installation steps below.

Once configured, you can begin syncing your browser data to your xBrowserSync service, and if you're feeling generous, allow others to sync their data to your service also!

API documentation

The available API methods are documented on the home page of each xBrowserSync service, respective of the version that service is running. For example, you can view the API documentation for the official xBrowserSync service at api.xbrowsersync.org.

Running with Docker

The easiest way to get up and running is by using Docker to run the xBrowserSync API as a container. Docker is a popular container management and imaging platform that allows you to quickly work with containers on Linux and Windows.

Once you have installed Docker you can use the xBrowserSync API Docker image to get a production-ready xBrowserSync service up and running with minimal effort (view the README for more information).

Manual installation

Whilst running in a Docker container is the recommended way to run your xBrowserSync service, you can self-host xBrowserSync instead by performing a manual installation on your own server by installing the two dependencies listed as prerequisites and following the six easy steps below:

Prerequisites

1. Clone the xBrowserSync API source repo

$ git clone https://github.com/xbrowsersync/api.git

2. Install and build xBrowserSync API package

(Use the unsafe-perm flag if you get any permissions issues whilst trying to install):

$ npm install --unsafe-perm

3. Configure MongoDB databases

  1. Run the following commands in the mongo shell:

    (Replace [password] with a cleartext password of your choice)

    use admin
    db.createUser({ user: "xbrowsersyncdb", pwd: "[password]", roles: [ { role: "readWrite", db: "xbrowsersync" }, { role: "readWrite", db: "xbrowsersynctest" } ] })
    use xbrowsersync
    db.newsynclogs.createIndex( { "expiresAt": 1 }, { expireAfterSeconds: 0 } )
    db.newsynclogs.createIndex({ "ipAddress": 1 })
    
  2. Add the following environment variables to hold xBrowserSync DB account username and password:

    • XBROWSERSYNC_DB_USER
    • XBROWSERSYNC_DB_PWD

    On Windows, open a Command Prompt and type (replacing [password] with the password entered in the mongo shell):

    setx XBROWSERSYNC_DB_USER "xbrowsersyncdb"
    setx XBROWSERSYNC_DB_PWD "[password]"
    

    On Ubuntu/Debian Linux, open a terminal emulator and type:

    $ pico ~/.profile
    

    Add the lines (replacing [password] with the password entered in the mongo shell):

    export XBROWSERSYNC_DB_USER=xbrowsersyncdb
    export XBROWSERSYNC_DB_PWD=[password]
    

    Save and exit, then log out and back in again.

If exposing your service to the public it is recommended you also perform the following steps:

  1. Add a TTL index on bookmarks.lastAccessed to delete syncs that have not been accessed for 3 weeks:

    use xbrowsersync
    db.bookmarks.createIndex( { "lastAccessed": 1 }, { expireAfterSeconds: 21*86400 } )
    

4. Modify configuration settings

The file config/settings.default.json contains all of the default configuration settings. User configuration values should be stored in config/settings.json and will override the defaults. Should you wish to change any of the configuration settings, copy settings.default.json and rename the copy to settings.json before changing any values as required. Be sure to remove any settings that have not been changed so that any amendments to the default values in future versions are picked up. For example, a basic user configuration to modify the service status message could look like:

{
  "status": {
    "message": "Welcome to my xBrowserSync service!"
  }
}

Any changes to the user configuration will require the service to be restarted before being picked up. The available configuration settings are:

Config Setting Description Default Value
allowedOrigins Array of origins permitted to access the service. Each origin can be a String or a RegExp. For example [ 'http://example1.com', /\.example2\.com$/ ] will accept any request from http://example1.com or from a subdomain of example2.com. If the array is empty, all origins are permitted [] (All origins permitted)
dailyNewSyncsLimit The maximum number of new syncs that a user can create per day - helps to prevent abuse of the service. If this setting is enabled, IP addresses are added to newsynclogs collection to track usage which is cleared down each day. Set as 0 to disable (allows users to create as many syncs as they want). 3
db.authSource The database to use for authentication. admin
db.connTimeout The connection timeout period to use for MongoDB. Using a high value helps prevent dropped connections in a hosted environment. 30000 (30 secs)
db.host The MongoDB server address to connect to, either a hostname, IP address, or UNIX domain socket. 127.0.0.1
db.name Name of the MongoDB database to use. xbrowsersync
db.ssl Connect to MongoDB over SSL. false
db.useSRV Use MongoDB's DNS Seedlist Connection Format to connect to the database. If set to true, db.host should also be set to the relevant DNS hostname. false
db.username Username of the account used to access MongoDB. Set as empty string to use environment variable XBROWSERSYNC_DB_USER. (Empty string, defers to environment variable)
db.password Password of the account used to access MongoDB. Set as empty string to use environment variable XBROWSERSYNC_DB_PWD. (Empty string, defers to environment variable)
db.port The port to use to connect to MongoDB. 27017
location The geographic location of the service, determined by an ISO 3166-1-alpha-2 code. Helps users determine if the service is geographically suitable for them when exposing the service to the public. gb
log.file.enabled If set to true, Bunyan will be used to capture minimal logging (service start/stop, new sync created, errors) to file. Logged messages are output to log.file.path and the log file is rotated automatically each period set by log.file.rotationPeriod, resulting in files "log.file.path.0", "log.file.path.1", etc. true
log.file.level Bunyan log level to capture: trace, debug, info, warn, error, fatal. info
log.file.path File path to log messages to (ensure the account node is running as has permission to write to this location). /var/log/xBrowserSync/api.log
log.file.rotatedFilesToKeep Maximum number of rotated log files to retain. 5
log.file.rotationPeriod The period at which to rotate log files. This is a string of the format "$number$scope" where "$scope" is one of "ms" (milliseconds -- only useful for testing), "h" (hours), "d" (days), "w" (weeks), "m" (months), "y" (years). Or one of the following names can be used "hourly" (means 1h), "daily" (1d), "weekly" (1w), "monthly" (1m), "yearly" (1y). Rotation is done at the start of the scope: top of the hour (h), midnight (d), start of Sunday (w), start of the 1st of the month (m), start of Jan 1st (y). 1d
log.stdout.enabled If set to true, Bunyan will be used to capture minimal logging (service start/stop, new sync created, errors) to stdout. true
log.stdout.level Bunyan log level to capture: trace, debug, info, warn, error, fatal. info
maxSyncs The maximum number of unique syncs to be stored on the service, once this limit is reached no more new syncs are permitted. Users with an existing sync ID are able to get and update their sync data as normal. This value multiplied by the maxSyncSize will determine the maximum amount of disk space used by the xBrowserSync service. Set as 0 to disable. 5242
maxSyncSize The maximum sync size in bytes. Note this is not equivalent to the size/amount of bookmarks as data is compressed and encrypted client-side before being sent to the service. 512000 (500kb)
server.behindProxy Set to true if service is behind a proxy, client IP address will be set from X-Forwarded-For header. Important: Do not set to true unless a proxy is present otherwise client IP address can easily be spoofed by malicious users. false
server.host Host name or IP address to use for Node.js server for accepting incoming connections. 127.0.0.1
server.https.certPath Path to a valid SSL certificate. Required when HTTPS is enabled. (Empty string, no path set)
server.https.enabled If enabled, the service is started using HTTPS. false
server.https.keyPath Path to the SSL certificate's private key. Required when HTTPS is enabled. (Empty string, no path set)
server.port Port to use for Node.js server for accepting incoming connections. 8080
server.relativePath Relative path from the host where the service will be located. Should always begin (and end) with /. /
status.allowNewSyncs Determines whether users will be allowed to create new syncs. Note: if this setting is set to false, users who have already synced to this service and have a sync ID will still able to get and update their syncs. true
status.message This message will be displayed in the service status panel of the client app when using this xBrowserSync service. Ideally the message should be 130 characters or less. Supports markdown formatting. (Empty string, no message set)
status.online If set to false no clients will be able to connect to this service. true
tests.db Name of the MongoDB database to use for e2e tests. xbrowsersynctest
tests.port Port to use for running tests. 8081
throttle.maxRequests Max number of connections during throttle.timeWindow milliseconds before sending a 429 response. Set as 0 to disable. 1000
throttle.timeWindow Amount of time (in milliseconds) before throttle counter is reset. 300000 (5 mins)

5. Create log folder

Ensure that the path set in the log.path config value exists, and that the account node will be running as can write to that location.

6. Run xBrowserSync service

$ node dist/api.js

Building

If you've made code changes you can run a fresh build with the command:

$ npm run build

Testing

The project includes unit, integration and end to end tests.

To run end to end tests, you will need to create the test database first. Run the following commands in the mongo shell:

(Replace [dbname] with your xBrowserSync database name and [password] with the xBrowserSync database user account password)

use [dbname]test
db.createUser({ user: "xbrowsersyncdb", pwd: "[password]", roles: ["readWrite"] })

You can then run the end to end tests by running the following command:

$ npm run test

Upgrading from an earlier version

<= v1.1.5

From v1.1.6, database users are created in the admin database. When upgrading from an earlier version you'll either need to drop the existing users in the xbrowsersync database and recreate them in the admin database, or simply add the following to your config/settings.json file:

"db": {
  "authSource": "xbrowsersync"
}

Config settings for logging has also changed so ensure you update your config/settings.json file if you have customised logging settings.

<= v1.0.3

If you are curently running v1.0.3 (or earlier) of the xBrowserSync API, you will need to export existing syncs and delete the xBrowserSync database before upgrading.

To export existing syncs, run the following command:

mongoexport --db xBrowserSync -c bookmarks --out /path/to/export/file

Then to delete the database, run the following commands in the mongo shell:

use xBrowserSync
db.dropAllUsers()
db.dropDatabase()

Once you've upgraded and completed the installation steps below, you can import the syncs by running the following command:

mongoimport --db xbrowsersync -c bookmarks --file /path/to/export/file

Other Implementations

Google Cloud

Cloudflare Worker

VS Code

If you're using VS Code, you have the following launch configurations:

  1. Debug API: Will compile and debug the main API service.
  2. Debug docs: Will launch API home page in chrome and attach to debugger for debugging docs issues.
  3. Run unit/integration tests: Will debug tests in *.spec.ts files in src folder.
  4. Run e2e tests: Will debug tests in test/e2e folder.

Note: we recommend VSCodium for running VSCode without Microsoft's proprietary binaries and telemetry/tracking.

Issues and feature requests

Please log Docker-related issues in the api-docker Issues list, if you have found an issue with the xBrowserSync API itself or wish to request a new feature, do so in the api Issues list.

api's People

Contributors

cakiwi avatar issmirnov avatar nero120 avatar tallship avatar txchen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

api's Issues

node server ignores server.host config key

I set up a self hosted api and it works really good and it is behind a nginx ssl proxy. Port 8080 is not exposed to the internet but I would like to let it only open the port on 127.0.0.1. As described in the documetnation I set up a settings.json in the folder api/config/ with the following content after seeing that the default (127.0.0.1) wasn't used:
[...] }, "server": { "host": "127.0.0.1" },[...]
But still no luck. Any idea why this is happening?
System is ubuntu 20.04 LTS, node v10.19.0, api version 1.5.2

Additional mandatory fields in settings.json for upgrade from 1.1.5

In API version 1.1.5 I didn't have the db.username or db.password in the settings.json file and it picked up the ENV versions and used those. When upgrading to 1.1.8 however I couldn't get the API to stay running as a service it ran correctly when running the node dist/api.js command which was strange.

Adding the 'username' and 'password' to the settings file however allowed it to work again, remove them and it fails. Looking at the commit history I think this relates to Fixed db auth issues with docker containers.

I think a simple update on the read.me so that it reads
Config settings for the following have changed. db authentication has changed so ensure you update your config/settings.json to include 'username' and 'password' logging has also changed so ensure you update your config/settings.json file if you have customised logging settings.

dailyNewSyncsLimit or status.allowNewSyncs ?

it's difficult to track similar options, the config description is also not too clear between these two settings,

dailyNewSyncsLimit --> setting this to 0 "disables all new syncs", or allows "unlimitted syncs" ?

status.allowNewSyncs --> I suppose would be the ultimate decider whether 1 new sync is permissible.

There should be added text to dailyNewSyncsLimit's description to clarify that new syncs become possible as long as status.allowNewSyncs is enabled..

All the other options look well explained.. and because I think there's lots of them, that I think it's a good idea imho to have vice-versa in both places to remind users to check both settings(as each of these two affects the other).

thanks

mongoose client attempting to connect to username

$ node dist/api.js
{"name":"xBrowserSync_api","hostname":"[redacted]","pid":8532,"level":50,"req":null,"err":{"message":"failed to connect to server [xbrowsersyncdb:27017] on first connect [MongoNetworkError: getaddrinfo ENOTFOUND xbrowsersyncdb xbrowsersyncdb:27017]","name":"MongoNetworkError","stack":"MongoNetworkError: failed to connect to server [xbrowsersyncdb:27017] on first connect [MongoNetworkError: getaddrinfo ENOTFOUND xbrowsersyncdb xbrowsersyncdb:27017]\n    at Pool.<anonymous> (/opt/xBrowserSync/api/node_modules/mongoose/node_modules/mongodb-core/lib/topologies/server.js:564:11)\n    at Pool.emit (events.js:182:13)\n    at Connection.<anonymous> (/opt/xBrowserSync/api/node_modules/mongoose/node_modules/mongodb-core/lib/connection/pool.js:317:12)\n    at Object.onceWrapper (events.js:273:13)\n    at Connection.emit (events.js:182:13)\n    at Socket.<anonymous> (/opt/xBrowserSync/api/node_modules/mongoose/node_modules/mongodb-core/lib/connection/connection.js:246:50)\n    at Object.onceWrapper (events.js:273:13)\n    at Socket.emit (events.js:182:13)\n    at emitErrorNT (internal/streams/destroy.js:82:8)\n    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)\n    at process._tickCallback (internal/process/next_tick.js:63:19)"},"msg":"Database error","time":"2018-12-28T17:10:39.969Z","v":0}
{"name":"xBrowserSync_api","hostname":"[redacted]","pid":8532,"level":50,"req":null,"err":{"message":"Unable to connect to database.","name":"Error","stack":"Error: Unable to connect to database.\n    at NativeConnection.dbConn.on (/opt/xBrowserSync/api/dist/core/db.js:66:28)\n    at NativeConnection.emit (events.js:182:13)\n    at process.nextTick (/opt/xBrowserSync/api/node_modules/mongoose/lib/connection.js:575:37)\n    at process._tickCallback (internal/process/next_tick.js:61:11)"},"msg":"Service failed to start","time":"2018-12-28T17:10:39.970Z","v":0}

I figured out that this was because my password included incompatible special characters for a URL: : # ? / \ %.

Added a note to the readme to help other users and pull request following momentarily.

How to trigger a sync client side for testing

Hello,

Thank you for your work on that project.
I am running a private API and using the latest released client (FF and chrome). To test the sync between my two browser I am searching for a way to trigger a sync (I mean by that fetching new changes) from browser B when I make a change in browser A.
Is there a way to trigger the fetching from the add-ons ? A refresh rate to configure somewhere ?

Thank you!

Safari and iOS support?

I was really excited about this extension which might help me finally dump Chrome, but alas, no Apple support. So close..

Are you really sure you won't support iOS and Safari because of a silly $99/yr licensing cost?

Us Apple users are clearly not going to migrate to an inferior platform (android) in order to get this extension but I'm sure there are many who would happily donate to the project to have their device supported. Even if you just supported Safari on OS X it would provide a means of syncing bookmarks to our iOS devices too (via iCloud).

Would you reconsider if there was enough demand?

Deleted Bookmarks on Brave Browser are not synced to Chrome

I am running 1.1.12 on QNAP NAS via Docker-api XbroweserSync. I hvae Chrome and Brave browser xmark sync connected and working (I sync'd my Brave browser toolbar first then connected chrome and overwrote by Chrome bookmarks).

I then did some cleanup of my Brave bookmark bar deleting bookmarks. I saw as I deleted them the XBrowersync extension sending the bookmark changes to my server.

Checking the Brave extension status shows the bookmarks are in sync.

I have not seen these updates in my Chrome bookmark toolbar.

xbrowsersync beta 1.4.1beta2 fails to connect

I began trying xbrowsersync beta 1.4.1beta2 since I could not manage to get the previous release to connect successfully to a private api server..

I can run tcpdump on the server side and attempts are made to a custom port 5600. so I know by using http://mycustom.com:5600/ , the app is trying to connect but it just appears to do syn/ack back and forth without going much beyond "Hello Client"..

I ran the integrationtest on the server end and all passes...

I have the server running,
{"name":"xBrowserSync_api","hostname":"machinexyz","pid":21673,"level":30,"msg":"Service started on 9.9.9.9:5600","time":"2019-01-08T05:10:09.064Z","v":0}
^ I can do ctl-c at any time to shutdown the service so I know the server is running..

Browser: chromium 71 (in developer mode, and loaded the extracted extension)
OS: Linux Debian (stretch -- latest release)

I am using a 32-bit Linux system, and I found out that nodejs only goes up to version 8, as the nodejs team has dropped support for 32-bit starting from version 10.

What version are you using for mongodb and nodejs?, then I can try duplicate the setup a little more and see then what works and what doesnt....

(fwiw I noticed a benign typo @ "If set to true no clients will be able to connect to this service." -- https://github.com/xbrowsersync/api)

thanks

docker swarm - Can't find DB

I am having issues with my stack being deployed to but the api can not find the mongodb server (both within the scope of the mongo stack and outside).
The following is the error being thrown by the xbs_api containter:

{
  "name": "xBrowserSync_api",
  "hostname": "7d8549e34a6b",
  "pid": 1,
  "level": 50,
  "req": null,
  "err": {
    "message": "Authentication failed.",
    "name": "MongoError",
    "stack": "MongoError: Authentication failed.
		at MessageStream.messageHandler (/usr/src/api/node_modules/mongodb/lib/cmap/connection.js:268:20)
		at MessageStream.emit (events.js:315:20)
		at processIncomingData (/usr/src/api/node_modules/mongodb/lib/cmap/message_stream.js:144:12)
		at MessageStream._write (/usr/src/api/node_modules/mongodb/lib/cmap/message_stream.js:42:5)
		at writeOrBuffer (internal/streams/writable.js:358:12)
		at MessageStream.Writable.write (internal/streams/writable.js:303:10)
		at Socket.ondata (internal/streams/readable.js:719:22)
		at Socket.emit (events.js:315:20)
		at addChunk (internal/streams/readable.js:309:12)
		at readableAddChunk (internal/streams/readable.js:284:9)
		at Socket.Readable.push (internal/streams/readable.js:223:10)
		at TCP.onStreamRead (internal/stream_base_commons.js:188:23)",
    "code": 18
  },
  "msg": "Unable to connect to database",
  "time": "2021-05-16T04:28:08.200Z",
  "v": 0
}

The xbs-stack.yml

version: "3.8"
services:
  api:
    image: "xbrowsersync/api:1.1.13"
    volumes:
      - xbs_data:/usr/src/api/
    ports:
      - 8082:8080
    deploy:
      labels:
        - "traefik.enable=true"
        - "traefik.http.routers.xbs.entrypoints=http"
        - "traefik.http.middlewares.xbs-https-redirect.redirectscheme.scheme=https"
        - "traefik.http.routers.xbs.middlewares=xbs-https-redirect"
        - "traefik.http.routers.xbs-secure.entrypoints=https"
        - "traefik.http.routers.xbs-secure.tls=true"
        - "traefik.http.routers.xbs-secure.service=xbs"
        - "traefik.docker.network=proxy"
        - "traefik.http.routers.xbs.rule=Host(`xbs.in.derpaholic.com`)"
        - "traefik.http.routers.xbs-secure.rule=Host(`xbs.in.derpaholic.com`)"
        - "traefik.http.services.xbs.loadbalancer.server.port=8080"
      placement:
         constraints:
           - node.labels.xbs.settings==true
    networks:
      - proxy
    healthcheck:
      test: [ "CMD", "node", "/usr/src/api/healthcheck.js" ]
      interval: "1m"
      timeout: "10s"
      retries: 5
      start_period: "30s"
volumes:
  xbs_data:
networks:
  proxy:
    external: true

Lastly the setting.json

{
    "db": {
        "host": "mongodb_mongodb",
        "name": "xbrowsersync",
        "username": "xbs",
        "password": "<password>"
    },
    "maxSyncs": 1,
    "maxSyncSize": 10240000,
    "status": {
        "allowNewSyncs": true,
        "message": "xBrowserSync."
    }
}

worth noting that "mongodb_mongodb" does work as the host because that is the hostname of the mongo server within the swarm. I have tested that within a ubuntu container attached to the same network.

Thank you for any help!

Support for MongoDB 3.6+ DNS Seedlist Connection Format (SRV)

reference: https://docs.mongodb.com/manual/reference/connection-string/

It would be nice to have an option for using either the standard or new MongoDB DNS Seedlist Connection Format. Per the documentation, the key benefit is:

Using DNS to construct the available servers list allows more flexibility of deployment and the ability to change the servers in rotation without reconfiguring clients.

The simple workaround is to update the connection string in src/core/db.ts, but it would be nice to have a Boolean option in settings.json.

UnsupportedVersionException

I'm trying to test the API with curl; every call returns some variation on:

{"code":"UnsupportedVersionException","message":"The requested API version is not supported"}

If the server requires headers, can these be documentated?

Add config folder to .gitignore

As title, could you please put config folder into .gitignore?
In 1.0, the config file is in .gitignore.
Besides, I suggest not to put the version number in the config file, I think it should be in somewhere else since everyone's config files are different.

Display status.message on the main API service info page

When you visit the main page of the server URL you see a large logo and the text API service info
image

I would like to suggest that the logo is shrunk and that also the status.message is displayed just under the Status: Online Version: 1.1.8 part

image

No response from API using node.js 7.7.2

Hi, just following up from the previous issue I logged, for whenever you have a chance.

I created an instance of the API server in a Docker container, using the Dockerfile attached: Dockerfile.txt

This installs mongodb, node.js 7.7.2 and the API server, configures mongodb, and creates a small launch script. When I run the API server using it, nothing gets output to the /var/log/xBrowserSync_api.log log file, and any attempts to connect to https://localhost:8080/ just time out.

Unfortunately I'm not able at the moment to investigate further, but let me know if there's any other information that would be useful in resolving the issue.

EDIT: Ah - I didn't realize that by default, the API runs over plain HTTP, rather than TLS. I can report that I now have the server running. It'd be great if the README could include any info on configuring it to use TLS - do you want me to open a separate issue for that?

Self-Host on SFTP/WebDav

Hi,

I found this good stuff on PrivacyTools.io but I would love to eventually able to sync my bookmarks and tabs over my own FTP hosted on my own hardware at home.

Do you foresee this to be available in the future? Thank you.

Docker install please

Hi

It would be nice if you offer Docker install, I think if you want large numbers of adaptations the installation should be a bit easier.

thanks

Interferes with Firefox keyword search

I recently discovered that you can Add a Keyword for this Search when right-clicking a search box. After defining the keyword, you can type it in the omnibar then your query, press enter, and you're redirected to that site with that search query. It's similar to DuckDuckGo's !bangs but faster and more direct. After setting xBrowserSync up on my server and using it for a couple of hours, I noticed that my keywords no longer work even though the bookmarks are there. I'm doing research for a paper right now and I have a lot of academic databases "aliased" to a couple of characters for quick use and not having those is an inconvenience. I'm not sure if a workaround on my part is needed or if a website search feature needs to be added or what but I would really like to see this functionality along with using xBrowserSync.

image
image

Sync with DynamoDB

Any interest in adding support for DynamoDB for the persistence tier?

Allow connections over Unix Sockets

I’m trying to self-host xbrowsersync, and except the following nitpick it worked without problems.
I wanted to connect xbrowsersync using Unix Sockets to mongodb and to the reverse-proxy (nginx).

Since this approach isn’t documented, and I didn’t look at the code, I don’t know how to do it.

I tried setting the config option db.host to /var/run/mongodb/mongodb-PID.socket but that didn’t work.
I didn’t try setting server.host to some path.

This isn’t very important to me, but it would be a nice addition if it were possible to connect xbrowsersync to unix sockets and if the necessary configuration were documented.

By the way, thanks for your work.

Edit: Just to make clear: I now have xbrowsersync talking over one port with nginx and talking over some other port with mongodb.

Service request limit hit error when syncing

Describe the issue you are experiencing
I've been using xBrowserSync for several months with Chrome, Firefox, and Edge, and it's been working smoothly, until now. When I make a bookmark change in one browser, I get the following notification: "Service request limit hit. Sync has been disabled, re-enable Sync to resume syncing." If I then click the toolbar icon for XBrowserSync, I see the same message. But when I check the Data Usage graph, it tells me that I'm using only 21KB out of 1MB, or only 4% of the limit. Is this a server-side glitch or something I need to correct on my end? If the latter, can someone tell me how to resolve this bug? Thanks.

How can the issue be reproduced?
Open any browser. Make a change to a bookmark--add or delete. See if error about Service request limit hit appears.

Screenshots
If applicable, add screenshots to help explain your problem:

Desktop browser
Firefox, Chrome, or Edge

  • OS: Windows 10 Pro
  • Browser Chrome, Firefox, or Edge
  • Version Latest versions of browsers.

xsync error message 2
xsync error message 1

Password Sync

I know there are several password back up programs. And Mozilla probably would not like another as they always push their sync. But has there been any thought (if it is even possible) to sync Firefox passwords. So when the bookmarks are updated, so are the passwords?

REQ: Enable handling proxy paths

It would be helpful if index.js would not assume that the application is anchored at the root path, and would instead use window.location.href to figure out how to build a correct path in case xBrowserSync is proxied behind a different path.

Need some hand-holding getting started with my docker-compose.yml

Hi there,

I have edited and adapted your docker-compose.yml file but before I start posting and explaining it here maybe you can give me a hint how to debug it.

the compose file starts mongo and xbs. mongo runs fine, xbs stops quite fast after starting and "docker logs -f xbs" does not show any log output.

How can I get some decent log output to debug my problems?

I noticed the default setting for the log file points to /var/log/xBrowserSync/api.log - shall I mount this file via a docker volume so I can access it after the container stops or is there some other way to get log output?

Security: remove password from environment variables

Hello,

First of all, a big thank you for providing this solution which helps all the orphans of xmarks :)

Would it be possible to make a version of the API with the DB creds put in some file rather than in the environment variables so we can set the access to the relevant process only ?

Cheers to you guys,

private instance

Hi, is possible to use it allowing only a certain of users?
thanks in advance,

Add OTP or U2F (fido) for better security

I would like it to be possible to add the possibility to activate U2F or OTP, in order to request a verification when connecting.
This method would allow us to protect our bookmarks in a more efficient way without endangering the anonymity of the user.

Sync with Git repository

Instead of synchronizing with a database such as MongoDB, it would be wonderful to have a way to do it with a Git repo. It would make it possible for one to create a local or a remote repository and get rid of external database-based sync servers.

An idea is to create a JSON file for every bookmark. For instance, https://github.com/xBrowserSync could be stored as https_github.com_xBrowserSync.json, that is, :// and / (and other characters, like ? and %) could be replaced by _. Each JSON file could have the same structure of the current MongoDB documents.

Bunyan not found when starting service

I am on an archlinux system with all packages up to date. Nodejs and MongoDB are installed.

Mongo is configured per your readme and npm install --unsafe-perm has been executed.

When starting the service I get the following:

 $ node dist/api.js
node:internal/modules/cjs/loader:930
  throw err;
  ^

Error: Cannot find module 'bunyan'
Require stack:
- /home/harleypig/projects/xbrowsersync-api/dist/server.js
- /home/harleypig/projects/xbrowsersync-api/dist/api.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:927:15)
    at Function.Module._load (node:internal/modules/cjs/loader:772:27)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:93:18)
    at Object.<anonymous> (/home/harleypig/projects/xbrowsersync-api/dist/server.js:26:34)
    at Module._compile (node:internal/modules/cjs/loader:1095:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1124:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:816:12)
    at Module.require (node:internal/modules/cjs/loader:999:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/harleypig/projects/xbrowsersync-api/dist/server.js',
    '/home/harleypig/projects/xbrowsersync-api/dist/api.js'
  ]
}

I get the same message after running npm install bunyan.

Stuck sync on v1.1.0 API, Chrome extension v1.3.1

The sequence I tried (may be helpful):

  • Added a bookmark within a Chrome bookmark tool bar folder. I found that I'd bookmarked a subpage of the web site I wanted.
  • Copied a "separator" link I had in another bookmark tool bar folder (about:blank with ------------- in the name text field) and pasted it below the above link.
  • Added a second bookmark next to the first for the main page of the site I wanted.
  • Right-click deleted the first link I made.

To solve the hang I tried to disable sync. This resulted in the local Chrome extension reloading my local bookmarks about a dozen times. It eventually stopped and gave a popup saying something like my sync had been restored. The first (incorrect) and separator bookmarks are there and the second bookmark is not. Note that I have two Chrome windows open.

I then try to create a new sync and got a daily new sync limit reached. For "new" syncs, I only tried once.

image

image

image

status.online = true ignored

I have status.online = true in config/settings.json but when I when I go to the status page it reads offline. Is there a setting elsewhere I'm missing?

If not: I think I found a bug.

I did a fresh git clone from this repo on 2020.01.12 at 8pm PST

It built, it passed all its tests, and it serves up the home page fine. But I cannot figure out HOW to get the service in an ONLINE status. Any clues would be appreciated.

Thanks

'The super constructor to "inherits" must not be null or undefined' exception

Hi - attempting to run with node version 8.9.4 and mongodb version 2.6.10 on Ubuntu 16.04, an exception got thrown when I attempted to start the API server:

> sudo node api.js
util.js:969
    throw new TypeError('The super constructor to "inherits" must not ' +
    ^

TypeError: The super constructor to "inherits" must not be null or undefined
    at Object.inherits (util.js:969:11)
    at Object.<anonymous> (.../node_modules/spdy/lib/spdy/connection.js:86:6)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (.../node_modules/spdy/lib/spdy.js:20:19)

I found that changing the version of restify in the dependencies in package.json from "4.0.x" to "4.3.x" (as suggested in this issue report), and re-building, got the service at least starting up:

diff --git a/package.json b/package.json
index 00b671e..fae0c16 100644
--- a/package.json
+++ b/package.json
@@ -20,7 +20,7 @@
     "mongojs": "2.4.x",
     "node-uuid": "1.4.x",
     "q": "1.4.x",
-    "restify": "4.0.x",
+    "restify": "4.3.x",
     "request": "2.73.x"
   },
   "devDependencies": {

I still don't seem to be getting any response when I use wget to try accessing the API, nor are any log messages getting written, but I will investigate that further.

Integrating folder structures

I love the current tags-feature, but are there plans for implementing folder structures?

As a user I might want to sync folder structure between different browsers/computers and access bookmarks via folders

e.g. parent/something/ contains all bookmarks that I sorted into something as I don't always want to search for a bookmark that I know, but rather a topic I previously sorted (would be even more manual than tags)


If there is something like this on the roadmap and users want the feature, I might be able to help with development.

buffer.js throw new ERR_INVALID_ARG_TYPE

i followed the instructions on https://github.com/xbrowsersync/api with v1.1.11 but when calling
$ node dist/api.js
i got
` api $ node dist/api.js
buffer.js:327
throw new ERR_INVALID_ARG_TYPE(
^

TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received function hidden
at Function.from (buffer.js:327:9)
at fnv1a32 (/home/ronald/xBrowserSync/api/node_modules/mongoose-uuid2/node_modules/bson/lib/bson/fnv1a.js:21:25)
at fnv1a24 (/home/ronald/xBrowserSync/api/node_modules/mongoose-uuid2/node_modules/bson/lib/bson/fnv1a.js:39:18)
at Object. (/home/ronald/xBrowserSync/api/node_modules/mongoose-uuid2/node_modules/bson/lib/bson/objectid.js:14:20)
`
What might be the problem ?
$ node --version
v13.9.0

$ mongo --version
MongoDB shell version v4.2.3

git version: 6874650b362138df74be53d366bbefc321ea32d4
OpenSSL version: OpenSSL 1.1.1d 10 Sep 2019
allocator: tcmalloc
modules: none
build environment:
distmod: ubuntu1804
distarch: x86_64
target_arch: x86_64

$ systemctl status mongodb.service
● mongodb.service - High-performance, schema-free document-oriented database
Loaded: loaded (/usr/lib/systemd/system/mongodb.service; disabled; vendor preset: disabled)
Active: active (running) since Sun 2020-02-23 13:01:26 CET; 2h 3min ago
Main PID: 19482 (mongod)
Tasks: 32 (limit: 9394)
Memory: 108.0M
CGroup: /system.slice/mongodb.service
└─19482 /usr/bin/mongod --quiet --config /etc/mongodb.conf

Feb 23 13:01:26 ivy3770 systemd[1]: Started High-performance, schema-free document-oriented database.

MongoDB SSL Connection

It seems that xBrowserSync does not support an SSL/TLS encrypted MongoDB connection. With my MongoDB being remote, this is an absolute requirement.

Using PM2 css not loaded

I try to install on my server. the service using pm2, using 127.0.0.1:8080 and create virtualhost so i can access using my subdomain.

but all the css and js not loaded, and return
{"code":"ResourceNotFound","message":"/css/bootstrap.min.css"}
when i try to access directly.

and when i try to change service on the chrome extension the domain became red.

how can i tell the service is working?
the pm2 log show only this
xBrowserSync-API started on 127.0.0.1:8080 ...

Need help, I'm trying to port API code to .NET Core

Hi @nero120,

Currently I'm challenging myself to create similar API server using .NET Core, I already able to handle create, update, info sync request successfully but I unable to handle invalid bookmark ID correctly.

For now when xBrowserSync request for non-existing ID i would give HTTP 404 response with empty body and xBrowserSync assume that connection to server is lost as follow

2018-06-30 21_30_18

Also I got confused about the response when sync size limit is exceeded or not accepting new sync? Based on your bookmarksService.ts it will throw an exception but I couldn't understand what happen next? How the exception is handled and translated into JSON response? Could you tell me the expected JSON response for xBrowserSync?

Lastly I would ask that would you allow http://localhost as API server address for xBrowserSync? It seems have validation that reject http://localhost

Thank You

API Service admin portal

Would like be able to see list of all individual sync ID, storage use and qty of sync'd browsers per sync ID on my API Docker server

1.1.11 failed to start

I tried to upgrade from 1.1.9 to 1.1.11 but results in following error after update:

{"name":"xBrowserSync_api","hostname":"syncme.mydomain.tld","pid":721,"level":50,"req":null,"err":{"message":"Cannot read property 'length' of undefined","name":"TypeError","stack":"TypeError: Cannot read property 'length' of undefined\n at pathtoRegexp (/usr/home/xbrowsersync/API/node_modules/path-to-regexp/index.js:63:49)\n at new Layer (/usr/home/xbrowsersync/API/node_modules/express/lib/router/layer.js:45:17)\n at Function.use (/usr/home/xbrowsersync/API/node_modules/express/lib/router/index.js:464:17)\n at Function. (/usr/home/xbrowsersync/API/node_modules/express/lib/application.js:220:21)\n at Array.forEach ()\n at Function.use (/usr/home/xbrowsersync/API/node_modules/express/lib/application.js:217:7)\n at Server.prepareRoutes (/usr/home/xbrowsersync/API/dist/core/server.js:312:18)\n at Server. (/usr/home/xbrowsersync/API/dist/core/server.js:76:22)\n at Generator.next ()\n at /usr/home/xbrowsersync/API/dist/core/server.js:14:71\n at new Promise ()\n at __awaiter (/usr/home/xbrowsersync/API/dist/core/server.js:10:12)\n at Server.init (/usr/home/xbrowsersync/API/dist/core/server.js:72:16)\n at Object. (/usr/home/xbrowsersync/API/dist/api.js:6:8)\n at Module._compile (module.js:653:30)\n at Object.Module._extensions..js (module.js:664:10)"},"msg":"Service failed to start","time":"2020-02-24T09:29:40.290Z","v":0}

xBrowsersync server space calculation and combination?

I am interested to sync two (or three) Firefox installations over an xbrowsersync service.

As I read on Home Page all sync servers have a size limit ranging from 1MB up to 12MB.

Since I have a huge bookmark dir tree of approx 7000 bookmarks and (sub)folders this could be critical.
I have no idea how to calculate the necessary size in MB for me.

Are the bookmarks compressed before syncing?
That would use the tiny sync server place much more efficiently.

Could someone tell me how to calc the server space from my given 7000 Bookmarks?

Is there no way to increase the sync server space?

Do I get a warning from the AddOn when my free space approaches limit?

Can I spread my bookmarks over two (!) sync servers?
...or two accounts on the same sync server?

Peter

1.1.10 do a backup before using it

Hi.
updated to 1.1.10 and lost kinda 50% of my bookmarks Firefox 1.5.0. Was able to save booksmarks from one device, now investigating with creating a new sync, but firefox addon says can't connect, but its green when changing the service.

Will report if more details are knows.

rest api docs?

just discovered this project, and seems like exactly what I've been looking for. however, the one thing I can't seem to find is docs for the rest api itself, not just how to setup the server, but what the api looks like so i can write clients for it. is this somewhere other than the code? :)

More details for API service setup

This is a combination support request and documentation issue. After I get all of this sorted out, I'd be happy to add to the readme.md.

I'm running Centos 7. The setup instructions in the README.md could use a few more details. Some of these may be noob questions…

  • Where is it recommended to install the source files to? To a subdir in my user home dir? Step 1
    could include the git clone command. I created ~me/xBrowserSync and from this dir I did the git clone,
    which created the API directory with the files.
  • The /var/log dir generally isn't writeable by general users. I set the log file to /home/me/xBrowserSync/xBrowserSync_api.log
  • If I run api.js manually from the command line as user me and point a browser on the local machine to 127.0.0.1:8080/info I get {"status":1,"message":"","version":"1.0.3","maxSyncSize":204800}. This config is just for testing and bring-up of the API server.
  • Using the Chrome xBrowserSync applet (v1.3.1), I cannot set the Change Service box to http://127.0.0.1:8080/. The server text remains red and the Update button remains grayed out. If I add a .com in the entry ( http://127.0.0.1.com:8080/) the text turns black and the Update tries but fails since that's not the correct address. Seems this may be a bug/enhancement needed for the app to allow an IP address. My current plan is to run the API on my server and not use DDNS since my WAN IP address seldom changes, but I cannot set the app server field to an IP address.
  • I need to set up a systemd service file to start the API on system boot. Is there a command line way to kill a currently running api.js?
  • I need to get this talking on an ssl / https connection, and perhaps with a virtual web host.
  • I suspect that I need to open up the remote port on server firewall, and set up the router port forward.

Bookmark URL truncation updates fail

Noticed that when I attempt to update the URL of a previously saved bookmark, it consistently fails to update if it is a subset of the existing URL (eg: https://github.com/tlindsay42 -> https://github.com/tlindsay4).

Error message: URL has already been bookmarked

image

Workaround: Insert a character into the base string so that it is no longer matches the parent and then update it again to the desired URL (eg: https://github.com/tlindsay42 -> https://g*r*ithub.com/tlindsay4 -> https://github.com/tlindsay4).

Unable to launch API v1.1.0

Hey there,

I'm following the guide and am unable to run the latest release. Getting the following error:

(node:13168) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'error' of undefined
    at Server.log (/Users/vania/Data/Projects/xbrowsersync/dist/server.js:92:33)
    at Server.<anonymous> (/Users/vania/Data/Projects/xbrowsersync/dist/server.js:82:22)
    at Generator.next (<anonymous>)
    at /Users/vania/Data/Projects/xbrowsersync/dist/server.js:13:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/vania/Data/Projects/xbrowsersync/dist/server.js:9:12)
    at Server.init (/Users/vania/Data/Projects/xbrowsersync/dist/server.js:72:16)
    at Object.<anonymous> (/Users/vania/Data/Projects/xbrowsersync/dist/api.js:5:8)
    at Module._compile (module.js:649:30)
    at Object.Module._extensions..js (module.js:660:10)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:501:12)
    at Function.Module._load (module.js:493:3)
    at Function.Module.runMain (module.js:690:10)
    at startup (bootstrap_node.js:194:16)
    at bootstrap_node.js:666:3
(node:13168) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:13168) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

My system information:

$ node --version
v8.0.0

$ mongo --version
MongoDB shell version v3.6.3
git version: 9586e557d54ef70f9ca4b43c26892cd55257e1a5
OpenSSL version: OpenSSL 1.0.2n  7 Dec 2017
allocator: system
modules: none
build environment:
    distarch: x86_64
    target_arch: x86_64

$ uname
Darwin # also tried on Ubuntu 16.04

Error seems to be coming from here. Log file permissions are set to 777.

Any ideas? Been looking into this in my spare time but no good suggestion yet.

Questions about own xBrowserSync server

As I read users need not use the publicly available xBrowserSync servers but can setup and use their own xBrowserSync servers in local LAN.

Some questions about that:

Users are directed to the following page for the corresponding server:

https://github.com/xbrowsersync/api/releases

I found only source files. Is there no pre-compiled server binary package (for Windows)?

The label of this project is "API" which mean only the interface definition.
Where is the actual body of the server?

Is this a real stand-alone server or just a service in the sense of a Windows service?

In which kind of container does this server store the bookmarks: E.g. in a file or SQlite DB or full MySQL DB?

Peter

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.