Move files from util to mods

- Move local.config.vagrant.php
- Move fpostit
- Move bookmarklet-share2friendica
- Updated Readme file
This commit is contained in:
Hypolite Petovan 2018-11-28 23:08:43 -05:00
commit c0b3b73c88
10 changed files with 37 additions and 32 deletions

36
mods/README.md Normal file
View file

@ -0,0 +1,36 @@
Friendica mods files
====================
## `bookmarklet-share2friendica`
Browser bookmarklet to share any page with your Friendica account.
Please see `bookmarklet-share2friendica/README.md` for detailed instruction.
## `fpostit`
Node-agnostic Friendica bookmarklet by Devlon Duthie.
Unmaintained and unsupported.
## `home.css` and `home.html`
Example files to customize the landing page of your Friendica node.
The `home.html file` contains the text of the page, the `home.css` file the style information.
The login box will be added according to the other system settings.
Both files have to be placed in the base directory of your Friendica installation to be used for the landing page.
## `local.config.vagrant.php`
Configuration file used by the Vagrant setup script.
## `sample-Lighttpd.config` and `sample-nginx.config`
Sample configuration files to use Friendica with Lighttpd or Nginx.
Please check software documentation to know how modify these examples to make them work on your server.
## `sample-systemd.timer` and `sample-systemd.service`
Sample systemd unit files to start worker.php periodically.
Please place them in the correct location for your system, typically this is `/etc/systemd/system/friendicaworker.timer` and `/etc/systemd/system/friendicaworker.service`.
Please report problems and improvements to `!helpers@forum.friendi.ca` and `@utzer@social.yl.ms` or open an issue in [the Github Friendica page](https://github.com/friendica/friendica/issues).
This is for usage of systemd instead of cron to start the worker periodically, the solution is a work-in-progress and can surely be improved.

View file

@ -0,0 +1,47 @@
# Bookmarklet-share2friendica
Javascript bookmarklet to share websites with your friendica account
## Getting Started
### Installing
Open the file bookmarklet-share2friendica.js and change 'YourFriendicaDoomain.tld" with your friendica domain
If you friendica is at https://myfriend.myfami.ly/ , the original ...
```javascript
javascript:(function(){f='https://YourFriendicaDomain.tld/bookmarklet/?url='+encodeURIC....
```
... has to be changed to ...
```javascript
javascript:(function(){f='https://myfriend.myfami.ly/bookmarklet/?url='+encodeURIC....
```
*Please copy the whole script, not only the part mentioned here!*
Then create a new bookmark, give it a name like "share2Friendica" and paste the script in the address field. Save it. Now you can click on that bookmarklet every time you want to share a website, you are currently reading. A new small window will open where title is prefilled and the website you want to share is put as attachement in the body of the new post.
## Additional notes if it doesn't work
* Make sure the site you want to share is allowed to run javascript. (enable it in your script blocker)
* Check the apostrophes that are used. Sometimes it is changed by the copy and paste process depending on the editor you are using, or if you copy it from a website. Correct it and it will work again.
## Authors
* **diaspora** - *Initial work* - [Share all teh internetz!](https://share.diasporafoundation.org/about.html)
* **hoergen** - *Adaptation to Friendica (2017)* - [hoergen.org](https://hoergen.org)
## License
This project is licensed under the same license like friendica
## Acknowledgments
* Hat tip to anyone who's code was used
* Hat tip to everyone who does everyday a little something ot make this world better
* Had tip but spent it

View file

@ -0,0 +1 @@
javascript:(function(){f='https://YourFriendicaDomain.tld/bookmarklet/?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title);a=function(){if(!window.open(f+'&jump=doclose','friendica','location=yes,links=no,scrollbars=no,toolbar=no,width=620,height=250'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()

8
mods/fpostit/README Normal file
View file

@ -0,0 +1,8 @@
fpostit
original author: Devlon Duthied
see his blog posting:
http://blog.duthied.com/2011/09/13/node-agnostic-friendika-bookmarklet/
original published at github https://github.com/duthied/Friendika-Bookmarklet

11
mods/fpostit/fpostit.js Normal file
View file

@ -0,0 +1,11 @@
javascript: (function() {
the_url = 'http://testbubble.com/fpostit.php?url=' + encodeURIComponent(window.location.href) + '&title=' + encodeURIComponent(document.title) + '&text=' + encodeURIComponent('' (window.getSelection ? window.getSelection() : document.getSelection ? document.getSelection() : document.selection.createRange().text));
a_funct = function() {
if (!window.open(the_url, 'fpostit', 'location=yes,links=no,scrollbars=no,toolbar=no,width=600,height=300')) location.href = the_url;
};
if (/Firefox/.test(navigator.userAgent)) {
setTimeout(a_funct, 0)
} else {
a_funct()
}
})()

129
mods/fpostit/fpostit.php Normal file
View file

@ -0,0 +1,129 @@
<?php
if (($_POST["friendica_acct_name"] != '') && ($_POST["friendica_password"] != '')) {
setcookie("username", $_POST["friendica_acct_name"], time()+60*60*24*300);
setcookie("password", $_POST["friendica_password"], time()+60*60*24*300);
}
?>
<html>
<head>
<style>
body {
font-family: arial, Helvetica,sans-serif;
margin: 0px;
}
.wrap1 {
padding: 2px 5px;
background-color: #729FCF;
margin-bottom: 10px;
}
.wrap2 {
margin-left: 10px;
font-size: 12px;
}
.logo {
margin-left: 3px;
margin-right: 5px;
float: left;
}
h2 {
color: #ffffff;
}
.error {
background-color: #FFFF66;
font-size: 12px;
margin-left: 10px;
}
</style>
</head>
<body>
<?php
if (isset($_GET['title'])) {
$title = $_GET['title'];
}
if (isset($_GET['text'])) {
$text = $_GET['text'];
}
if (isset($_GET['url'])) {
$url = $_GET['url'];
}
if ((isset($title)) && (isset($text)) && (isset($url))) {
$content = "$title\nsource:$url\n\n$text";
} else {
$content = $_POST['content'];
}
if (isset($_POST['submit'])) {
if (($_POST["friendica_acct_name"] != '') && ($_POST["friendica_password"] != '')) {
$acctname = $_POST["friendica_acct_name"];
$tmp_account_array = explode("@", $acctname);
if (isset($tmp_account_array[1])) {
$username = $tmp_account_array[0];
$hostname = $tmp_account_array[1];
}
$password = $_POST["friendica_password"];
$content = $_POST["content"];
$url = "http://" . $hostname . '/api/statuses/update';
$data = ['status' => $content];
// echo "posting to: $url<br/>";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $url);
curl_setopt($c, CURLOPT_USERPWD, "$username:$password");
curl_setopt($c, CURLOPT_POSTFIELDS, $data);
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
$c_result = curl_exec($c);
if(curl_errno($c)){
$error = curl_error($c);
showForm($error, $content);
}
curl_close($c);
if (!isset($error)) {
echo '<script language="javascript" type="text/javascript">window.close();</script>';
}
} else {
$error = "Missing account name and/or password...try again please";
showForm($error, $content);
}
} else {
showForm(null, $content);
}
function showForm($error, $content) {
$username_cookie = $_COOKIE['username'];
$password_cookie = $_COOKIE['password'];
echo <<<EOF
<div class='wrap1'>
<h2><img class='logo' src='friendica-32.png' align='middle';/>
Friendica Bookmarklet</h2>
</div>
<div class="wrap2">
<form method="post" action="{$_SERVER['PHP_SELF']}">
Enter the email address of the Friendica Account that you want to cross-post to:(example: user@friendica.org)<br /><br />
Account ID: <input type="text" name="friendica_acct_name" value="{$username_cookie}" size="50"/><br />
Password: <input type="password" name="friendica_password" value="{$password_cookie}" size="50"/><br />
<textarea name="content" id="content" rows="6" cols="70">{$content}</textarea><br />
<input type="submit" value="PostIt!" name="submit" />&nbsp;&nbsp;<span class='error'>$error</span>
</form>
<p></p>
</div>
EOF;
}
?>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -0,0 +1,41 @@
<?php
// Local configuration
/* If automatic system installation fails:
*
* Copy this file to local.config.php
*
* Why local.config.php? Because it contains sensitive information which could
* give somebody complete control of your database. Apache's default
* configuration will interpret any .php file as a script and won't show the values
*
* Then set the following for your MySQL installation
*/
return [
'database' => [
'hostname' => 'localhost',
'username' => 'friendica',
'password' => 'friendica',
'database' => 'friendica',
'charset' => 'utf8mb4',
],
// ****************************************************************
// The configuration below will be overruled by the admin panel.
// Changes made below will only have an effect if the database does
// not contain any configuration for the friendica system.
// ****************************************************************
'config' => [
'admin_email' => 'admin@friendica.local',
'sitename' => 'Friendica Social Network',
'register_policy' => REGISTER_OPEN,
'register_text' => '',
],
'system' => [
'default_timezone' => 'UTC',
'language' => 'en',
],
];

View file

@ -1,31 +0,0 @@
sample-Lighttpd.config
sample-nginx.config
Sample configuration files to use Friendica with Lighttpd
or Nginx. Pleas check software documentation to know how modify
these examples to make them work on your server.
sample-systemd.timer
sample-systemd.service
Sample systemd unit files to start worker.php periodically.
Please place them in the correct location for your system,
typically this is /etc/systemd/system/friendicaworker.timer
and /etc/systemd/system/friendicaworker.service.
Please report problems and improvements to
!helpers@forum.friendi.ca and @utzer@social.yl.ms or open an
issue in Github (https://github.com/friendica/friendica/issues).
This is for usage of systemd instead of cron to start the worker.php
periodically, the solution is work-in-progress and can surely be improved.
home.css
home.html
Example files to customize the landing page of your Friendica node.
The home.html file contains the text of the page, the home.css file
the style information. The login box will be added according to the
other system settings.
Both files have to be placed in the base directory of your Friendica
installation to be used for the landing page.