create table if not exists forgesTbl (url_clrnet  text,
                                      url_onion   text,
                                      software    text check(software   in ('Gitea', 'gitlab_ce', 'gitlab_ee', 'Gogs', 'Sourcehut', 'other')) not null default 'other',
                                      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,
                                      antitor     boolean not null default 0,
                                      forced_nfsw boolean not null default 0,
                                      aws         boolean not null default 0,
                                      notes       text,
                                      primary key (url_clrnet,url_onion));

insert into forgesTbl (url_clrnet, dead) values ('https://yerbamate.dev',1);
insert into forgesTbl (url_clrnet, antitor, notes) values ('https://git.openprivacy.ca',1,'Tor users get 404 - suspected botnet; [listed](https://codeberg.org/crimeflare/cloudflare-tor/src/branch/master/cloudflare_users/cloudflare_supporter.txt) as a Cloudflare supporter');
insert into forgesTbl (url_clrnet, software, notes) values ('https://sr.ht','Sourcehut', 'javascript-free');
insert into forgesTbl (url_onion, dead) values ('http://githidep2hynhdmutuv7n2tei4iie2c7lyqz5fes3r5zzoxe5dshtxyd.onion', 1);

/* Gitea */
insert into forgesTbl (url_clrnet, software, openpubreg, notes) values ('https://git.nixnet.services','Gitea', 0, 'used to be git.nixnet.xyz');
insert into forgesTbl (url_clrnet, software, openpubreg) values ('https://git.teknik.io','Gitea',0);
insert into forgesTbl (url_clrnet, url_onion, software, notes) values ('https://git.fuwafuwa.moe','http://git.fuwafuwaqtlkkxwc.onion','Gitea','SSH over Tor broken; HTTPS over Tor works');
insert into forgesTbl (url_clrnet, software, notes) values ('https://git.slashdev.space','Gitea','SSH over Tor broken (try HTTPS over Tor)');
insert into forgesTbl (url_clrnet, software, openpubreg, notes) values ('https://libregit.org','Gitea',0,'reg by invite only');
insert into forgesTbl (url_clrnet, software, notes) values ('https://git.sdf.org','Gitea','SSH over Tor broken (try HTTPS over Tor)');

/* Gitlab */
insert into forgesTbl (url_clrnet, software) values ('https://framagit.org','gitlab_ce');
insert into forgesTbl (url_clrnet, software, hrecaptcha, notes) values ('https://git.feneas.org','gitlab_ce','unavoidable','reCAPTCHA impedes registration');
insert into forgesTbl (url_clrnet, software, notes) values ('https://git.hardenedbsd.org','gitlab_ce','possibly restricted to BSD efforts');
insert into forgesTbl (url_clrnet, software, notes) values ('https://git.jami.net','gitlab_ce','possibly restricted to Jami efforts');
insert into forgesTbl (url_clrnet, software, cflogin, hrecaptcha, notes) values ('https://gitlab.com','gitlab_ee',1,'unavoidable','flagship instance running the *Enterprise Edition*; uses hCAPTCHA; heavily restricted with discriminatory policies');
insert into forgesTbl (url_clrnet, software, notes) values ('https://gitlab.freedesktop.org','gitlab_ce','possibly restricted to Freedesktop efforts');
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, hrecaptcha, notes) values ('https://gitlab.torproject.org','gitlab_ce','non-essential tasks','open registration; repo creation possibly restricted; Google reCAPTCHA is [allegedley](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_ce','open registration; *not* restricted to puri.sm efforts; no CAPTCHA (confirmed March 2021)');
insert into forgesTbl (url_clrnet, software, openpubreg) values ('https://source.small-tech.org','gitlab_ce',0);

update forgesTbl set forced_nfsw = 1 where hrecaptcha = 'unavoidable';
update forgesTbl set lst_kind = 'gray' where lst_kind = 'white' and (aws or (notes is not null and (notes like '%google_cloud_hosted%')));
update forgesTbl set lst_kind = 'black' where cflogin or antitor or forced_nfsw;
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%';
