Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
meddelare-server
Advanced tools
Install social share counters on your website with your own hosted solution which only makes 1 API request and loads minimal or zero assets to display the counters.
Install social share counters on your website with your own hosted solution which only makes 1 API request and loads minimal or zero assets to display the counters.
This is an open source and self-hosted alternative to services such as AddThis and ShareThis.
Because you run the middle man server your self, you are also defending your users privacy against the social networks. (Users only opt into the tracking once they decide to share and not just because they visited your page)
npm install
node social-buttons-server.js
http://localhost:5000/?networks=facebook,twitter,googleplus&url=http://meddelare.com
Options are passed through query parameters in the url
Currently only Twitter, Facebook and Google Plus are supported
You use the networks
query parameter to specify which ones you want to use as a comma-separated list e.g.
networks=facebook,twitter,googleplus
or networks=facebook
You use the url
parameter to specify the address which you want to count the total number of shares for e.g. url=http://1984day.com
If you don't specify a url
then the server will try to get the referring urls total share count. So if you make the API call on your homepage without the url
parameter, the API server will return the numbe rof shares for your homepage url.
You don't want to be hitting the social networks API's constantly so it would be wise to throw up a cache in front such as CloudFront.
In CloudFront just make sure you to inherit cache control directives from the server and enable query string forwarding.
Eithr use your CloudFront url to access the API server or cname it with a custom domain of your choice.
The server as it is has CORS enabled which means any website can call the API SERVER. You can easily white list if this becomes a problem.
We would love to start collecting widgets that people design and want to share, please submit them in a pull request to meddelare-examples and we will create a new section to list them
You can do anything you want to display your share totals when using the API. There are the examples linked at the top of the README and some short code below. Notice that we are using a CloudFront distribution in the examples.
<html>
<head>
</head>
<body>
<h3>Twitter</h3>
<span id="twitter"></span>
<h3>Facebook</h3>
<span id="facebook"></span>
<h3>Google Plus</h3>
<span id="googleplus"></span>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script type="text/javascript">
$.ajax('https://d12cncu17l9pr5.cloudfront.net/?networks=facebook,twitter,googleplus&url=http://meddelare.com', {
success: function (res, err) {
$.each(res, function(network, value){
$('#'+network).text(value);
})
}
})
</script>
</body>
</html>
Many thanks goes out to Taskforce for their social-buttons-server (released into the Public Domain) -- especially the creator @thomasdavis and contributor @beaugunderson. This software, meddelare-node-server, is based on their work.
Copyright (c) 2015 Team Meddelare http://meddelare.com/ All rights reserved.
When using meddelare-node-server, comply to the MIT license.
FAQs
Install custom social share counters on your website with your own hosted solution, which only makes a single API request and loads minimal or zero assets to display the counters.
The npm package meddelare-server receives a total of 3 weekly downloads. As such, meddelare-server popularity was classified as not popular.
We found that meddelare-server demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.