about.html: Update hw info (we got new hardware some time ago)
[girocco/radio.git] / cgi / regproj.cgi
blobf5379b2e16f3ae3c3704ceac6f097816d380b90a
1 #!/usr/bin/perl
2 # (c) Petr Baudis <pasky@suse.cz>
3 # GPLv2
5 use strict;
6 use warnings;
8 use lib qw(/home/repo/repomgr/cgi);
9 use Git::RepoCGI;
11 my $repo = Git::RepoCGI->new('Project Registration');
12 my $cgi = $repo->cgi;
14 my $name = $cgi->param('name');
15 $name ||= '';
17 if ($cgi->param('mail')) {
18 print "<p>Go away, bot.</p>";
19 exit;
22 if ($cgi->param('mode')) {
23 # submitted, let's see
24 # FIXME: racy, do a lock
25 my $name = $repo->wparam('name');
26 valid_proj_name($name)
27 and Git::RepoCGI::Project::does_exist($name)
28 and $repo->err("Project with the name '$name' already exists.");
29 $name =~ /\.git$/
30 and $repo->err("Project name should not end with <tt>.git</tt> - I'll add that automagically.");
32 my $mirror = $cgi->param('mode') eq 'mirror';
33 my $proj = Git::RepoCGI::Project->ghost($name, $mirror);
34 if ($proj->cgi_fill($repo)) {
35 if ($mirror) {
36 $proj->premirror;
37 print "<p>Initiated mirroring. You will be notified about the result by mail.</p>\n";
38 } else {
39 $proj->conjure;
40 print <<EOT;
41 <p>
42 Project <a href="/w/$name.git">$name</a> successfuly set up.</p>
43 <p>The push URL for the project is <tt>git+ssh://repo.or.cz/srv/git/$name.git</tt>.</p>
44 <p>You can <a href="editproj.cgi?name=$name">assign users</a> now (use project name (without <tt>.git</tt>) as username, admin password as password)
45 - don't forget to assign yourself as a user as well if you want to push!
46 Everyone who wants to push must <a href="reguser.cgi">register himself as a user</a> first.
47 (One user can have push access to multiple projects and multiple users can have push access to one project.)
48 </p>
49 <p>Note that you cannot clone an empty repository since it contains no branches; you need to make the first push from an existing repository.</p>
50 <p>You may experience permission problems if you try to push right now.
51 If so, that should get fixed automagically in few minutes, please be patient.</p>
52 <p>Enjoy yourself!</p>
53 EOT
55 exit;
59 print <<EOT;
60 <p>Here you can register a project.
61 It can be hosted in two modes: mirror mode and push mode.
62 In the <b>mirror mode</b>, our dedicated git monkeys will check another repository at a given URL every hour and mirror any new updates.
63 In the <b>push mode</b>, registered users with appropriate permissions will be able to push to the repository.
64 You currently cannot switch freely between those two modes;
65 if you want to switch from mirroring to push mode, just delete and recreate
66 the project. If you want to switch the other way, please contact the administrator.</p>
67 <p>You will need the admin password to adjust the project settings later
68 (mirroring URL, list of users allowed to push, project description, ...).
69 Use the project name (without <tt>.git</tt>) as the username when asked by the browser.</p>
70 EOT
71 unless ($name =~ m#/#) {
72 print <<EOT;
73 <p>Note that if your project is a <strong>fork of an existing project</strong>
74 (this does not mean anything socially bad), please instead go to the project's
75 gitweb page and click the 'fork' link in the top bar. This way, all of us
76 will save bandwidth and more importantly, your project will be properly categorized.
77 If your project is a fork but the existing project is not registered here yet, please
78 consider registering it first; you do not have to be involved in the project
79 in order to register it here as a mirror.</p>
80 EOT
81 } else {
82 my $xname = $name; $xname =~ s#/$#.git#;
83 print <<EOT;
84 <p>Great, your project will be created as a subproject of the '$xname' project.
85 This means that it will be properly categorized and you will need to push only
86 the data <em>you</em> created, not the whole project. (That will be done automagically,
87 you do not need to specify any extra arguments during the push.)</p>
88 EOT
90 print <<EOT;
91 <p>By submitting this form, you are confirming that the repository contains only free software
92 and redistributing it does not violate any law of Czech Republic. Read <a href="/about.html">more details</a>
93 about the hosting and terms and conditions.</p>
94 <p>Have fun!</p>
95 <form method="post">
96 <p>Project name (w/o the .git suffix): <input type="text" name="name" value="$name" /></p>
97 <p>Admin password: <input type="password" name="pwd" /></p>
98 <p>Admin password (retype): <input type="password" name="pwd2" /></p>
99 <p>E-mail contact: <input type="text" name="email" /></p>
100 <p>Hosting mode:</p><ul>
101 <li><input type="radio" name="mode" value="mirror" />Mirror mode. Repository URL: <input type="text" name="url" /></li>
102 <li><input type="radio" name="mode" value="push" />Push mode.</li></ul>
103 <p>Description: <input type="text" name="desc" /></p>
104 <p>Homepage URL: <input type="text" name="hp" /></p>
105 <p>README (HTML, lt 8kb): <textarea name="README" rows="5" cols="80"></textarea></p>
106 <p style="display:none">Anti-captcha (leave empty!): <input type="text" name="mail" /></p>
107 <p><input type="submit" name="y0" value="Register" /></p>
108 </form>