/* Monitor the following for new hosts:
   https://gitea.com/gitea/awesome-gitea#organizations
   https://wiki.softwareheritage.org/wiki/Suggestion_box:_source_code_to_add (specific repos can be requested here: https://archive.softwareheritage.org/save/#requests)
   https://framagit.org/dCF/deCloudflare/-/blob/master/subfiles/cloudflared/gitservices.md
*/

create table if not exists forgesTbl
  (url_clrnet            text,
   url_onion             text,
   software              text,
   lst_kind              text check(lst_kind   in ('black', 'gray', 'white')) not null default 'white',
   hrecaptcha            text check(hrecaptcha in ('unavoidable', 'non-essential tasks', 'never')) not null default 'never',
   dead                  boolean not null default 0,
   openpubreg            boolean not null default 1,
   cflogin               boolean not null default 0,
   cfns                  boolean not null default 0,
   antitor               boolean not null default 0,
   forced_nfsw           boolean          default 0,
   aws                   boolean not null default 0,
   nation_discrimination boolean not null default 0,
   notes                 text,
   primary key (url_clrnet,url_onion));

/* check(software in ('Bitbucket Server', 'Gitea', 'gitlab_ce', 'gitlab_ee', 'Gogs', 'Launchpad', 'Sourcehut', 'other')) not null default 'other'*/

insert into forgesTbl (url_clrnet, software, notes) values ('https://gitee.com','OSCHINA','based in China; registration over Tor with throwaway email works; no automatic mirror (unlike Gitea); some areas written in simplified chinese');

insert into forgesTbl (url_clrnet, software, forced_nfsw, aws, notes) values ('https://bitbucket.org','Bitbucket Server',1,1,'needs non-free javascript that [clusterfucks uMatrix](https://github.com/privacytools/privacytools.io/issues/843#issuecomment-483830547); has some relationship with Netlify; access to source code [restricted](https://en.wikipedia.org/wiki/Bitbucket#Bitbucket_Server)');

insert into forgesTbl (url_clrnet, url_onion, software, notes) values ('https://notabug.org','http://qs3zumwfci4tntnd.onion','Gogs','based on [liberated](https://notabug.org/hp/gogs) fork of Gogs; [supports Tor](https://notabug.org/tor) (the *onion* web UI is currently disabled in response to attack but the onion site accepts git connections); supports SSH keys and SSH over Tor to NAB''s onion service; no e-voting; NAB doesn''t associate PGP keys to users, so PGP signed commits may be unavailable or more manual work needed.');

insert into forgesTbl (url_clrnet, nation_discrimination, forced_nfsw, notes) values ('https://sourceforge.net',1,1,'Important site [functionality does not work without non-free JavaScript](https://www.gnu.org/software/repo-criteria-evaluation.html)');
insert into forgesTbl (url_clrnet, antitor, forced_nfsw, nation_discrimination, notes) values ('https://github.com',1,1,1,'[copious ethical issues](github.md)');

insert into forgesTbl (url_clrnet, software, notes) values ('https://launchpad.net','Launchpad','It''s [unknown](https://wiki.freephile.org/wiki/Comparison_of_git_hosting_options) whether it functions without JavaScript; no wiki');
insert into forgesTbl (url_clrnet, software, dead) values ('https://yerbamate.dev','Gitea',1);
insert into forgesTbl (url_clrnet, software, antitor, notes) values ('https://git.openprivacy.ca','Gitea 1.12.4',1,'Tor users get 404 - suspected botnet; [listed](https://git.disroot.org/deCF/deCloudflare/src/branch/master/cloudflare_users/cloudflare_supporter.md) as a Cloudflare supporter');
insert into forgesTbl (url_clrnet, software, notes) values ('https://sr.ht','Sourcehut', 'javascript-free; supports patches sent by email; offers an [IRC bouncer](https://sourcehut.org/blog/2021-11-29-announcing-the-chat.sr.ht-public-beta/); recognizes the harm of Cloudflare and takes an [ethical stance against it](https://srht.site/limitations)');
insert into forgesTbl (url_clrnet, software, openpubreg, notes) values ('https://code.netlandish.com','Sourcehut',0,'Access restricted to staff of the company working on the hosted projects');
insert into forgesTbl (url_onion, dead) values ('http://githidep2hynhdmutuv7n2tei4iie2c7lyqz5fes3r5zzoxe5dshtxyd.onion', 1);

/* Gitea */
insert into forgesTbl (url_clrnet, software, notes) values ('https://codeberg.org','Gitea 1.14 customized', 'Based in Germany; [censored an anti-Cloudflare project](codeberg.md) in a reckless and destructive manner; functions without any JavaScript and the JavaScript that exists is all 1st-party ([ref](https://github.com/privacytools/privacytools.io/issues/843#issuecomment-483830547)); devs make [foolish decisions](https://codeberg.org/Codeberg/Community/issues/444) (improving performance by breaking some browsers, when the performance improvement only affects those they broke.)');
insert into forgesTbl (url_clrnet, software, openpubreg, notes) values ('https://git.nixnet.services','Gitea 1.15.6', 0, 'formerly git.nixnet.xyz');
insert into forgesTbl (url_clrnet, software, openpubreg, cfns) values ('https://git.teknik.io','Gitea 1.09.0',0,1);
insert into forgesTbl (url_clrnet, url_onion, software, notes) values ('https://git.fuwafuwa.moe','http://git.fuwafuwaqtlkkxwc.onion','Gitea 1.13.6','SSH port: 22; SSH over Tor [broken](http://git.fuwafuwaqtlkkxwc.onion/levena/fuwafuwa/issues/1); HTTPS over Tor works; onion site dead (maybe they have an onion v3 address now?)');
insert into forgesTbl (url_clrnet, software, notes) values ('https://git.slashdev.space','Gitea 1.15.4','SSH port: 22; SSH over Tor broken (try HTTPS over Tor)');
insert into forgesTbl (url_clrnet, software, notes) values ('https://git.disroot.org','Gitea 1.15.6','SSH over Tor works; based in NL');
insert into forgesTbl (url_clrnet, software, openpubreg, cflogin, notes) values ('https://libregit.org','Gitea',0,1,'reg by invite only');
insert into forgesTbl (url_clrnet, software, notes) values ('https://git.sdf.org','Gitea 1.14.1','git.sdf.org [censored](https://git.sdf.org/deCloudflare/deCloudflare) the deCloudflare project without warning, reason, or recourse. So git.sdf.org apparently unwelcoming of projects driven by privacy, netneutrality, or anti-tech-giant types of activism. Performance is sluggish and the website often times out (perhaps because SDF is also tar-pitting many Tor IPs in defense of attack & it’s unclear if this is a temporary measure); SSH over Tor broken but HTTPS over Tor works');
insert into forgesTbl (url_clrnet, software, notes) values ('https://forge.chApril.org','Gitea 1.16.6','Censorship: spontaneously deletes people’s repos without warning, reason, or recourse. Forge is unsuitable for activism. French UI.'); /* dCF censored */
insert into forgesTbl (url_clrnet, software, cfns) values ('https://gitea.it','Gitea 1.12.4',1);
insert into forgesTbl (url_clrnet, software, dead, notes) values ('https://de.edumat.io','Gitea 1.05.2',1,'no SSH');
insert into forgesTbl (url_clrnet, software, cfns) values ('https://git.kiwifarms.net','Gitea 1.13.1',1);
insert into forgesTbl (url_clrnet, software) values ('https://git.safemobile.org','Gitea 1.15.6');
insert into forgesTbl (url_clrnet, url_onion, software, notes) values ('https://git.nogafam.es','http://git.hsdtecd4h2b5z732pvkg2yw3746epap4qusgvjjze6nhmfcdpz2suiad.onion/','Gitea 1.15.6','[SSH disabled](https://git.nogafam.es/deCloudflare/deCloudflare/issues/18#issuecomment-75); large repos are [git-inaccessible over Tor](https://git.nogafam.es/deCloudflare/deCloudflare/issues/18#issuecomment-48); onion site is down');
insert into forgesTbl (url_clrnet, software) values ('https://dev.sum7.eu','Gitea 1.14.0');
insert into forgesTbl (url_clrnet, software, notes) values ('https://git.fsfe.org','Gitea','Access intended only for FSFE projects and very small projects; SSH port: 22');
insert into forgesTbl (url_clrnet, software, notes) values ('https://opendev.org','Gitea 1.15.6','SSH port: 22');
insert into forgesTbl (url_clrnet, software, dead, notes) values ('https://git.passageenseine.fr','Gitea 1.14.2',0,'Was previously down for a lengthy period thus considered unreliable.');
insert into forgesTbl (url_clrnet, software, dead) values ('https://gitea.shuishan.net.cn','Gitea',1);
insert into forgesTbl (url_clrnet, software, notes) values ('https://try.gitea.io','Gitea 1.16.0','Intended only for Gitea experimentation; no expectation of future availability');
insert into forgesTbl (url_clrnet, software, openpubreg, notes) values ('https://git.pofilo.fr','Gitea 1.16.1',0,'no registration link');
insert into forgesTbl (url_clrnet, software, openpubreg, notes) values ('https://forge.april.org','Gitea 1.15.6',0,'French is the primary language; no registration form; access is for [April](https://www.april.org) members -- but perhaps April membership is open to all?');
insert into forgesTbl (url_clrnet, software) values ('https://git.eta.st','Gitea 1.15.0');
insert into forgesTbl (url_clrnet, software) values ('https://git.kescher.at','Gitea 1.16.5');
insert into forgesTbl (url_clrnet, software, openpubreg) values ('https://git.redxen.eu','Gitea 1.16.5',0);
insert into forgesTbl (url_clrnet, software, notes) values ('https://gitnet.fr','Gitea','Forge is resource deprived. The admin (simonv) had to ask a project to leave his forge for [performance reasons](https://framagit.org/dCF/deCloudflare/-/issues/46)');

/*
Bug: the record for de.edumat.io sorts unfavorably.  We need a natural sort but that's not part of Sqlite.  A collation function is needed:
  proper way in C requires compilation => https://sqlite.org/forum/forumpost/cff93834d2
  proper way in Python => http://blog.ozanh.com/doku.php?id=python:database:sqlite:how_to_natural_sort
  (hack) cast the leading part of the version number as a real => https://stackoverflow.com/questions/11489055/sqlite-order-by-string-containing-number-starting-with-0
  (hack) without collation => https://sqlite-users.sqlite.narkive.com/aU5aV12Z/howto-adding-natural-sort-to-sqlite-database

  status quo: it's perhaps over-engineering to fix this elegantly.  The hack for now:
  In SQL source, 'Gitea 1.5.2' => 'Gitea 1.05.2'
  In the bash script that prints the table: replace(software,'1.05','1.5')
  This gives the correct order
*/

/* Gitlab */
insert into forgesTbl (url_clrnet, software, notes) values ('https://framagit.org','Gitlab (CE 13.10.2)','[may become more restricted](https://framablog.org/2019/09/26/lets-de-frama-tify-the-internet) in mid-2021');
insert into forgesTbl (url_clrnet, software, hrecaptcha, notes) values ('https://git.feneas.org','gitlab_ce','unavoidable','reCAPTCHA impedes registration and imposes non-free s/w');
insert into forgesTbl (url_clrnet, software, cfns, notes) values ('https://git.hardenedbsd.org','gitlab_ee',1,'possibly restricted to BSD efforts');
insert into forgesTbl (url_clrnet, software, notes) values ('https://git.jami.net','gitlab_ce','possibly restricted to Jami efforts; acces to help page blocked to non-members so CE/EE unknown');
insert into forgesTbl (url_clrnet, software, cflogin, hrecaptcha, notes) values ('https://gitlab.com','gitlab_ee',1,'unavoidable','flagship instance running the *Enterprise Edition*; uses both hCAPTCHA & reCAPTCHA; heavily restricted with discriminatory policies; [copious ethical issues](gitlab-dot-com.md)');
insert into forgesTbl (url_clrnet, software, hrecaptcha, notes) values ('https://salsa.debian.org','gitlab_ce','unavoidable','possibly restricted to Debian efforts; serves as an alternative to Debian''s email-only bug tracker');
insert into forgesTbl (url_clrnet, software, hrecaptcha, notes) values ('https://gitlab.freedesktop.org','gitlab_ce','unavoidable','possibly restricted to Freedesktop efforts; reg. blocked by reCAPTCHA');
insert into forgesTbl (url_clrnet, software, notes) values ('https://gitlab.tails.boum.org','gitlab_ce','possibly restricted to Tails efforts but no AUP says otherwise');
insert into forgesTbl (url_clrnet, software, notes) values ('https://gitlab.gnome.org','gitlab_ce','possibly restricted to Gnome efforts');
insert into forgesTbl (url_clrnet, software, notes, dead) values ('https://mypdns.org','gitlab_ee','Sudden death without warning to repo admins. Was home of the deCloudflare and /Right to be Offline/ projects; It was open reg but considered a “private system” whereby the option to create a new repo was not immediately available.',1);
insert into forgesTbl (url_clrnet, software, hrecaptcha, notes) values ('https://gitlab.torproject.org','gitlab_ce','non-essential tasks','open registration; repo creation possibly restricted; Google reCAPTCHA is [allegedly](https://lists.gnu.org/archive/html/repo-criteria-discuss/2021-03/msg00000.html) used, but [not at registration time](https://gitlab.onionize.space)');
insert into forgesTbl (url_clrnet, software, notes) values ('https://source.puri.sm','gitlab_ee','open registration but activity is [restricted](https://social.librem.one/@kyle/106030358887310621) to puri.sm efforts; accounts are subject to spontaneous unjustified bans (apparent censorship): ![](images/purism_ban.png); no CAPTCHA (confirmed March 2021); is the JavaScript non-free with the enterprize edition?');
insert into forgesTbl (url_clrnet, software, openpubreg) values ('https://source.small-tech.org','gitlab_ce',0);
insert into forgesTbl (url_clrnet, software, openpubreg, cfns, notes) values ('https://git.shivering-isles.com','gitlab_ce',0,1,'Registration is open but broken-- requires 2FA using a device that can QR-scan, and the email verification link is DoA: ![](images/shivering-isles_broken_reg.png) That stale link error triggers even when accessed immediately.');
insert into forgesTbl (url_clrnet, software) values ('https://git.stuxhost.com','gitlab_ce');

update forgesTbl set forced_nfsw = null where software = 'gitlab_ee';
update forgesTbl set forced_nfsw = 1 where hrecaptcha = 'unavoidable';
update forgesTbl set lst_kind = 'gray' where lst_kind = 'white' and (aws or cfns or dead or nation_discrimination or (notes is not null and (notes like '%google_cloud_hosted%' or notes like '%censor%' or notes like '%spontaneous%' or notes like '%previously_down%' or notes like '%resource_deprived%')));
update forgesTbl set lst_kind = 'black' where cflogin or antitor or forced_nfsw;
update forgesTbl set notes = '**Cloudflare NS server** (they can route all traffic via CF at the flip of a switch)'||case when notes is null then '' else '; '||notes end where cfns;
update forgesTbl set notes = '**Amazon AWS-hosted**'||case when notes is null then '' else '; '||notes end where aws;
update forgesTbl set notes = '**dead site**'||case when notes is null then '' else '; '||notes end where dead;
update forgesTbl set notes = '**forced h/reCAPTCHA**'||case when notes is null then '' else '; '||notes end where hrecaptcha = 'unavoidable' and notes not like '%captcha%';
update forgesTbl set notes = '**access granted or denied based on national origin**'||case when notes is null then '' else '; '||notes end where nation_discrimination;
update forgesTbl set software = 'Gitlab (CE)' where software = 'gitlab_ce';
update forgesTbl set software = software||'[⚠][gitea-bug]' where software like 'gitea_1.14%' or software like 'gitea_1.15%' or software like 'gitea_1.16%';
