perlsky is a Perl 5 implementation of an AT Protocol Personal Data Server.
13
fork

Configure Feed

Select the types of activity you want to include in your feed.

Trim unused bootstrap script code

alice 33ca1319 800c6baf

+10 -44
-33
lib/ATProto/PDS/Bootstrap.pm
··· 1 - package ATProto::PDS::Bootstrap; 2 - 3 - use v5.34; 4 - use warnings; 5 - 6 - use Exporter 'import'; 7 - use Config (); 8 - use FindBin (); 9 - use File::Spec; 10 - use lib (); 11 - 12 - our @EXPORT_OK = qw(apply_local_lib project_root); 13 - 14 - sub project_root { 15 - state $root = do { 16 - my $bin = $FindBin::RealBin || '.'; 17 - File::Spec->rel2abs(File::Spec->catdir($bin, '..')); 18 - }; 19 - } 20 - 21 - sub apply_local_lib { 22 - my $root = project_root(); 23 - my @paths = ( 24 - File::Spec->catdir($root, 'lib'), 25 - File::Spec->catdir($root, 'local', 'lib', 'perl5'), 26 - File::Spec->catdir($root, 'local', 'lib', 'perl5', $Config::Config{archname}), 27 - ); 28 - 29 - lib->import(@paths); 30 - return \@paths; 31 - } 32 - 33 - 1;
+10 -11
script/perlsky-admin
··· 52 52 'created-by=s' => \$created_by, 53 53 ) or die usage(); 54 54 55 - my $store = ATProto::PDS::Store::SQLite->new( 56 - path => $config->{db_path} || File::Spec->catfile($root, 'data', 'runtime', 'perlsky.sqlite'), 57 - )->bootstrap; 58 - 55 + my $store = _store($config, $root); 59 56 my $code = _new_invite_code(); 60 57 $store->create_invite_code( 61 58 code => $code, ··· 68 65 } 69 66 70 67 if ($command eq 'repair-binary-columns') { 71 - my $store = ATProto::PDS::Store::SQLite->new( 72 - path => $config->{db_path} || File::Spec->catfile($root, 'data', 'runtime', 'perlsky.sqlite'), 73 - )->bootstrap; 74 - 68 + my $store = _store($config, $root); 75 69 my $result = $store->repair_binary_columns; 76 70 for my $key (sort keys %$result) { 77 71 print "$key=$result->{$key}\n"; ··· 88 82 'force!' => \$force, 89 83 ) or die usage(); 90 84 91 - my $store = ATProto::PDS::Store::SQLite->new( 92 - path => $config->{db_path} || File::Spec->catfile($root, 'data', 'runtime', 'perlsky.sqlite'), 93 - )->bootstrap; 85 + my $store = _store($config, $root); 94 86 my $manager = ATProto::PDS::Repo::Manager->new(store => $store); 95 87 96 88 my @accounts = $did ··· 118 110 } 119 111 120 112 die usage(); 113 + 114 + sub _store { 115 + my ($config, $root) = @_; 116 + return ATProto::PDS::Store::SQLite->new( 117 + path => $config->{db_path} || File::Spec->catfile($root, 'data', 'runtime', 'perlsky.sqlite'), 118 + )->bootstrap; 119 + } 121 120 122 121 sub _new_invite_code { 123 122 return 'perlsky-' . substr(random_hex(8), 0, 12);