Commit 2f525c0f authored by Yassine Doghri's avatar Yassine Doghri
Browse files

feat(fediverse): implement activitypub protocols + update user interface

- add "ActivityPub" library to handle server to server federation and basic
  client to server protocols using activitypub:
  - add webfinger endpoint to look for actor
  - add actor definition with inbox / outbox / followers
  - remote follow an actor
  - create notes with possible preview cards
  - interract with favourites, reblogs and replies
  - block incoming actors and/or domains
  - broadcast/schedule activities to fediverse followers using a cron task
- For castopod, the podcast is the actor:
  - overwrite the activitypub library for castopod's specific needs
  - perform basic interactions administrating a podcast to interact with fediverse users:
    - create notes with episode attachment
    - favourite and share a note + reply
    - add specific castopod_namespaces for podcasts and episodes definitions
- overwrite CodeIgniter's Route service to include alternate-content option for
  activitystream requests
- update episode publication logic:
  - remove publication inputs in create / edit episode form
  - publish / schedule or unpublish an episode after creation
  - the podcaster publishes a note when publishing an episode
- Javascript / Typescript modules:
  - fix Dropdown.ts to keep dropdown menu in foreground
  - add Modal.ts for funding links modal
  - add Toggler.ts to toggle various css states in ui
- User Interface:
  - update tailwindcss to v2
  - use castopod's pine and rose colors
  - update public layout to a 3 column layout
  - add pages in public for podcast activity, episode list and notes
  - update episode page to include linked notes
  - remove previous and next episodes from episode pages
  - show different public views depending on whether user is authenticated or not
  - use Kumbh Sans and Montserrat fonts
- update CodeIgniter's config files
- with CodeIgniter's new requirements, update docker environments are now based on
  php v7.3 image
- move Image entity to Libraries
- update composer and npm packages to latest versions

closes #69 #65 #85, fixes #51 #91 #92 #88
parent dd3ac9b4
FROM php:7.2-fpm
FROM php:7.3-fpm
COPY --from=composer /usr/bin/composer /usr/bin/composer
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
RUN apt-get update && \
apt-get install -y nodejs
......
......@@ -138,7 +138,6 @@ node_modules
# public folder
public/*
!public/media
!public/media/~person
!public/.htaccess
!public/favicon.ico
!public/index.php
......@@ -147,10 +146,14 @@ public/*
# public media folder
public/media/*
!public/media/index.html
!public/media/podcasts
!public/media/persons
# public person folder
public/media/~person/*
!public/media/~person/index.html
public/media/podcasts/*
!public/media/podcasts/index.html
public/media/persons/*
!public/media/persons/index.html
# Generated files
app/Language/en/PersonsTaxonomy.php
......
......@@ -4,7 +4,7 @@
{
"files": "*.php",
"options": {
"phpVersion": "7.2",
"phpVersion": "7.3",
"singleQuote": true
}
},
......
......@@ -7,7 +7,7 @@
+ writable/***
+ .env.example
+ DEPENDENCIES.md
+ LICENSE
+ LICENSE.md
+ README.md
+ INSTALL.md
- **
......@@ -9,7 +9,8 @@
"apply",
"responsive",
"variants",
"screen"
"screen",
"layer"
]
}
],
......
module.exports = {
plugins: [
"removeXMLNS",
"removeDimensions",
"sortAttrs",
{
name: "addAttributesToSVGElement",
params: {
attributes: [
{ fill: "currentColor" },
{ width: "1em" },
{ height: "1em" },
],
},
},
],
};
plugins:
- removeXMLNS: true
- removeDimensions: true
- addAttributesToSVGElement:
attributes:
- fill: currentColor
- width: "1em"
- height: "1em"
- sortAttrs: true
module.exports = {
plugins: [
{
name: "removeViewBox",
active: false,
},
"removeXMLNS",
"removeDimensions",
"sortAttrs",
"prefixIds",
],
};
plugins:
- removeXMLNS: true
- removeDimensions: true
- sortAttrs: true
- prefixIds: true
......@@ -4,7 +4,7 @@ Castopod uses the following components:
PHP Dependencies:
- [Code Igniter 4](https://codeigniter.com)
- [CodeIgniter 4](https://codeigniter.com)
([MIT License](https://codeigniter.com/user_guide/license.html))
- [WhichBrowser/Parser-PHP](https://github.com/WhichBrowser/Parser-PHP)
([MIT License](https://github.com/WhichBrowser/Parser-PHP/blob/master/LICENSE))
......@@ -24,6 +24,14 @@ PHP Dependencies:
([MIT License](https://github.com/podlibre/user-agents-php/blob/main/LICENSE))
- [podlibre/ipcat](https://github.com/podlibre/ipcat)
([GNU General Public License v3.0](https://github.com/podlibre/ipcat/blob/master/LICENSE))
- [podlibre/podcast-namespace](https://code.podlibre.org/podlibre/podcastnamespace)
([MIT License](https://code.podlibre.org/podlibre/podcastnamespace/-/blob/master/LICENSE))
- [phpseclib](https://phpseclib.com/)
([MIT License](https://github.com/phpseclib/phpseclib/blob/master/LICENSE))
- [codeigniter4-uuid](https://github.com/michalsn/codeigniter4-uuid)
([MIT License](https://github.com/michalsn/codeigniter4-uuid/blob/develop/LICENSE))
- [essence](https://github.com/essence/essence)
([The FreeBSD License](https://github.com/essence/essence/blob/master/LICENSE.txt))
Javascript dependencies:
......@@ -39,9 +47,15 @@ Javascript dependencies:
([MIT License](https://github.com/jshjohnson/Choices/blob/master/LICENSE))
- [flatpickr](https://flatpickr.js.org/)
([MIT License](https://github.com/flatpickr/flatpickr/blob/master/LICENSE.md))
- [popperjs](https://popper.js.org/)
([MIT License](https://github.com/popperjs/popper-core/blob/master/LICENSE.md))
Other:
- [Kumbh Sans](https://fonts.google.com/specimen/Kumbh+Sans)
([Open Font License](https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL))
- [Montserrat](https://fonts.google.com/specimen/Montserrat)
([Open Font License](https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL))
- [RemixIcon](https://remixicon.com/)
([Apache License 2.0](https://github.com/Remix-Design/RemixIcon/blob/master/License))
- [OPAWG/User agent list](https://github.com/opawg/user-agents)
......
FROM php:7.2-fpm
FROM php:7.3-fpm
COPY . /castopod
WORKDIR /castopod
......@@ -25,3 +25,9 @@ RUN echo "file_uploads = On\n" \
"post_max_size = 120M\n" \
"max_execution_time = 300\n" \
> /usr/local/etc/php/conf.d/uploads.ini
# install cron
RUN apt-get update && \
apt-get install -y cron
RUN crontab /castopod/crontab
# How to install Castopod
# How to install Castopod <!-- omit in toc -->
Castopod was thought to be easy to install. Whether using dedicated or shared
hosting, you can install it on most PHP-MySQL compatible web servers.
## Table of contents <!-- omit in toc -->
- [Install instructions](#install-instructions)
- [(optional) Manual configuration](#optional-manual-configuration)
- [Web Server Requirements](#web-server-requirements)
- [PHP v7.2 or higher](#php-v72-or-higher)
- [PHP v7.3 or higher](#php-v73-or-higher)
- [MySQL compatible database](#mysql-compatible-database)
- [Privileges](#privileges)
- [(Optional) Other recommendations](#optional-other-recommendations)
- [Security concerns](#security-concerns)
......@@ -19,9 +22,16 @@ hosting, you can install it on most PHP-MySQL compatible web servers.
1. Download and unzip the Castopod package onto the web server if you haven’t
already.
- ⚠️ Set the web server document root to the `public/` sub-folder.
2. Run the Castopod install script by going to the install wizard page
2. ⚠️ For broadcasting social activities to the fediverse, add a cron task on
your web server to run every minute (replace the paths accordingly):
```php
* * * * * /path/to/php /path/to/castopod/public/index.php scheduled-activities
```
3. Run the Castopod install script by going to the install wizard page
(`https://your_domain_name.com/cp-install`) in your favorite web browser.
3. Follow the instructions on your screen.
4. Follow the instructions on your screen.
All done, start podcasting!
......@@ -36,13 +46,12 @@ Before uploading Castopod files to your web server:
## Web Server Requirements
### PHP v7.2 or higher
### PHP v7.3 or higher
PHP version 7.2 or higher is required, with the following extensions installed:
PHP version 7.3 or higher is required, with the following extensions installed:
- [intl](http://php.net/manual/en/intl.requirements.php)
- [libcurl](http://php.net/manual/en/curl.requirements.php) if you plan to use
the HTTP\CURLRequest library
- [libcurl](http://php.net/manual/en/curl.requirements.php)
- [mbstring](http://php.net/manual/en/mbstring.installation.php)
Additionally, make sure that the following extensions are enabled in your PHP:
......
This diff is collapsed.
This diff is collapsed.
......@@ -3,12 +3,12 @@
Castopod is an open-source podcast hosting solution for everyone.\
Whether you are a beginner, an amateur or a professional, you will get everything
you need:\
Create, upload, publish, and get comprehensive audience measurement that respects your
listeners privacy.
Create, upload, publish, and get comprehensive audience measurement that
respects your listeners privacy.
Castopod is a free and open-source solution (AGPL v3).\
Whether you choose to install it on your own server or have it hosted by a
professional, all your data and analytics belong to you and you only.
Whether you choose to install it on your own server or have it hosted by a professional,
all your data and analytics belong to you and you only.
![Castopod Logo](https://podlibre.org/static/images/Castopod-Mascot-Server.svg)
......@@ -18,7 +18,9 @@ Castopod can be hosted on any PHP/MySQL server:\
Unzip it and you are ready to broadcast.
To install Castopod on your server:
- Download [Castopod latest Package (zip or tar.gz)](https://code.podlibre.org/podlibre/castopod/-/releases),
- Download
[Castopod latest Package (zip or tar.gz)](https://code.podlibre.org/podlibre/castopod/-/releases),
- Follow the procedure “[How to install Castopod](./INSTALL.md)”.
## Documentation
......
<?php namespace Config;
use ActivityPub\Config\ActivityPub as ActivityPubBase;
class ActivityPub extends ActivityPubBase
{
/**
* --------------------------------------------------------------------
* ActivityPub Objects
* --------------------------------------------------------------------
*/
public $actorObject = 'App\Libraries\PodcastActor';
public $noteObject = 'App\Libraries\NoteObject';
}
This diff is collapsed.
......@@ -2,90 +2,66 @@
namespace Config;
require_once SYSTEMPATH . 'Config/AutoloadConfig.php';
use CodeIgniter\Config\AutoloadConfig;
/**
* -------------------------------------------------------------------
* AUTO-LOADER
* -------------------------------------------------------------------
*
* This file defines the namespaces and class maps so the Autoloader
* can find the files as needed.
*
* NOTE: If you use an identical key in $psr4 or $classmap, then
* the values in this file will overwrite the framework's values.
*/
class Autoload extends \CodeIgniter\Config\AutoloadConfig
class Autoload extends AutoloadConfig
{
/**
* -------------------------------------------------------------------
* Namespaces
* -------------------------------------------------------------------
* This maps the locations of any namespaces in your application to
* their location on the file system. These are used by the autoloader
* to locate files the first time they have been instantiated.
*
* The '/app' and '/system' directories are already mapped for you.
* you may change the name of the 'App' namespace if you wish,
* but this should be done prior to creating any namespaced classes,
* else you will need to modify all of those classes for this to work.
*
* Prototype:
*
* $psr4 = [
* 'CodeIgniter' => SYSTEMPATH,
* 'App' => APPPATH
* ];
*
* @var array<string, string>
*/
public $psr4 = [
'App' => APPPATH,
APP_NAMESPACE => APPPATH, // For custom app namespace
'Config' => APPPATH . 'Config',
'ActivityPub' => APPPATH . 'Libraries/ActivityPub',
];
public $classmap = [];
//--------------------------------------------------------------------
/**
* Collects the application-specific autoload settings and merges
* them with the framework's required settings.
* -------------------------------------------------------------------
* Class Map
* -------------------------------------------------------------------
* The class map provides a map of class names and their exact
* location on the drive. Classes loaded in this manner will have
* slightly faster performance because they will not have to be
* searched for within one or more directories as they would if they
* were being autoloaded through a namespace.
*
* NOTE: If you use an identical key in $psr4 or $classmap, then
* the values in this file will overwrite the framework's values.
* Prototype:
*
* $classmap = [
* 'MyClass' => '/path/to/class/file.php'
* ];
*
* @var array<string, string>
*/
public function __construct()
{
parent::__construct();
/**
* -------------------------------------------------------------------
* Namespaces
* -------------------------------------------------------------------
* This maps the locations of any namespaces in your application
* to their location on the file system. These are used by the
* Autoloader to locate files the first time they have been instantiated.
*
* The '/app' and '/system' directories are already mapped for
* you. You may change the name of the 'App' namespace if you wish,
* but this should be done prior to creating any namespaced classes,
* else you will need to modify all of those classes for this to work.
*
* DO NOT change the name of the CodeIgniter namespace or your application
* WILL break. *
* Prototype:
*
* $Config['psr4'] = [
* 'CodeIgniter' => SYSPATH
* `];
*/
$psr4 = [
'App' => APPPATH, // To ensure filters, etc still found,
APP_NAMESPACE => APPPATH, // For custom namespace
'Config' => APPPATH . 'Config',
];
/**
* -------------------------------------------------------------------
* Class Map
* -------------------------------------------------------------------
* The class map provides a map of class names and their exact
* location on the drive. Classes loaded in this manner will have
* slightly faster performance because they will not have to be
* searched for within one or more directories as they would if they
* were being autoloaded through a namespace.
*
* Prototype:
*
* $Config['classmap'] = [
* 'MyClass' => '/path/to/class/file.php'
* ];
*/
$classmap = [];
//--------------------------------------------------------------------
// Do Not Edit Below This Line
//--------------------------------------------------------------------
$this->psr4 = array_merge($this->psr4, $psr4);
$this->classmap = array_merge($this->classmap, $classmap);
unset($psr4, $classmap);
}
//--------------------------------------------------------------------
public $classmap = [];
}
<?php
/*
|--------------------------------------------------------------------------
| ERROR DISPLAY
|--------------------------------------------------------------------------
| In development, we want to show as many errors as possible to help
| make sure they don't make it to production. And save us hours of
| painful debugging.
/**
* --------------------------------------------------------------------------
* ERROR DISPLAY
* --------------------------------------------------------------------------
* In development, we want to show as many errors as possible to help
* make sure they don't make it to production. And save us hours of
* painful debugging.
*/
error_reporting(-1);
ini_set('display_errors', '1');
/*
|--------------------------------------------------------------------------
| DEBUG BACKTRACES
|--------------------------------------------------------------------------
| If true, this constant will tell the error screens to display debug
| backtraces along with the other error information. If you would
| prefer to not see this, set this value to false.
/**
* --------------------------------------------------------------------------
* DEBUG BACKTRACES
* --------------------------------------------------------------------------
* If true, this constant will tell the error screens to display debug
* backtraces along with the other error information. If you would
* prefer to not see this, set this value to false.
*/
defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);
/*
|--------------------------------------------------------------------------
| DEBUG MODE
|--------------------------------------------------------------------------
| Debug mode is an experimental flag that can allow changes throughout
| the system. This will control whether Kint is loaded, and a few other
| items. It can always be used within your own application too.
/**
* --------------------------------------------------------------------------
* DEBUG MODE
* --------------------------------------------------------------------------
* Debug mode is an experimental flag that can allow changes throughout
* the system. This will control whether Kint is loaded, and a few other
* items. It can always be used within your own application too.
*/
defined('CI_DEBUG') || define('CI_DEBUG', 1);
defined('CI_DEBUG') || define('CI_DEBUG', true);
<?php
/*
|--------------------------------------------------------------------------
| ERROR DISPLAY
|--------------------------------------------------------------------------
| Don't show ANY in production environments. Instead, let the system catch
| it and display a generic error message.
/**
* --------------------------------------------------------------------------
* ERROR DISPLAY
* --------------------------------------------------------------------------
* Don't show ANY in production environments. Instead, let the system catch
* it and display a generic error message.
*/
ini_set('display_errors', '0');
error_reporting(
......@@ -14,16 +14,15 @@ error_reporting(
~E_DEPRECATED &
~E_STRICT &
~E_USER_NOTICE &
~E_USER_DEPRECATED
~E_USER_DEPRECATED,
);
/*
|--------------------------------------------------------------------------
| DEBUG MODE
|--------------------------------------------------------------------------
| Debug mode is an experimental flag that can allow changes throughout
| the system. It's not widely used currently, and may not survive
| release of the framework.
/**
* --------------------------------------------------------------------------
* DEBUG MODE
* --------------------------------------------------------------------------
* Debug mode is an experimental flag that can allow changes throughout
* the system. It's not widely used currently, and may not survive
* release of the framework.
*/
defined('CI_DEBUG') || define('CI_DEBUG', 0);
defined('CI_DEBUG') || define('CI_DEBUG', false);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment