Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
freedombone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Context Sensitive Group
freedombone
Commits
fc6a3937
Commit
fc6a3937
authored
6 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Allow gogs registrations via web UI
parent
0f81679f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/freedombone-app-gogs
+16
-0
16 additions, 0 deletions
src/freedombone-app-gogs
webadmin/EN/settings_gogs_registration.html
+105
-0
105 additions, 0 deletions
webadmin/EN/settings_gogs_registration.html
webadmin/settings_gogs.php
+18
-0
18 additions, 0 deletions
webadmin/settings_gogs.php
with
139 additions
and
0 deletions
src/freedombone-app-gogs
+
16
−
0
View file @
fc6a3937
...
@@ -53,6 +53,22 @@ gogs_variables=(ONION_ONLY
...
@@ -53,6 +53,22 @@ gogs_variables=(ONION_ONLY
DDNS_PROVIDER
DDNS_PROVIDER
ARCHITECTURE
)
ARCHITECTURE
)
function
gogs_setting_registration
{
allow_registrations
=
"
$1
"
if
[[
"
$allow_registrations
"
==
'1'
]]
;
then
sed
-i
"s|DISABLE_REGISTRATION =.*|DISABLE_REGISTRATION = false|g"
/home/gogs/custom/conf/app.ini
sed
-i
"s|SHOW_REGISTRATION_BUTTON =.*|SHOW_REGISTRATION_BUTTON = true|g"
/home/gogs/custom/conf/app.ini
systemctl restart gogs
fi
if
[[
"
$allow_registrations
"
==
'0'
]]
;
then
sed
-i
"s|DISABLE_REGISTRATION =.*|DISABLE_REGISTRATION = true|g"
/home/gogs/custom/conf/app.ini
sed
-i
"s|SHOW_REGISTRATION_BUTTON =.*|SHOW_REGISTRATION_BUTTON = false|g"
/home/gogs/custom/conf/app.ini
systemctl restart gogs
fi
}
function
logging_on_gogs
{
function
logging_on_gogs
{
echo
-n
''
echo
-n
''
}
}
...
...
This diff is collapsed.
Click to expand it.
webadmin/EN/settings_gogs_registration.html
0 → 100644
+
105
−
0
View file @
fc6a3937
<!DOCTYPE html>
<html>
<style>
*
{
box-sizing
:
border-box
;
}
a
,
u
{
text-decoration
:
none
;
color
:
#72a7cf
;
font-weight
:
bold
;
}
a
:visited
{
color
:
#72a7cf
;
font-weight
:
bold
;
}
#headerpic
{
width
:
60%
;
height
:
auto
;
margin-right
:
auto
;
margin-left
:
auto
;
min-width
:
220px
;
}
body
{
margin
:
0
;
font-family
:
Arial
;
}
.header
{
text-align
:
center
;
padding
:
32px
;
}
.headertext
{
color
:
#72a7cf
;
text-align
:
center
;
font-size
:
120%
;
font-weight
:
bold
;
}
.settingtext
{
text-align
:
center
;
font-size
:
100%
;
}
.row
{
display
:
-ms-flexbox
;
display
:
flex
;
-ms-flex-wrap
:
wrap
;
flex-wrap
:
wrap
;
padding
:
0
4px
;
}
.column
{
-ms-flex
:
25%
;
flex
:
15%
;
max-width
:
25%
;
padding
:
0
4px
;
}
.column
img
{
margin-top
:
8px
;
vertical-align
:
middle
;
}
.card
{
box-shadow
:
0
4px
8px
0
rgba
(
0
,
0
,
0
,
0.2
);
max-width
:
600px
;
margin
:
auto
;
text-align
:
center
;
font-family
:
arial
;
clear
:
both
;
}
.card
input
[
type
=
text
]
{
width
:
50%
;
clear
:
both
;
text-align
:
left
;
color
:
black
;
background-color
:
lightblue
;
}
</style>
<body>
<div
class=
"card"
>
<div
class=
"header"
>
<a
href=
"app_gogs.html"
><img
id=
"headerpic"
class=
"img-responsive"
src=
"images/logo.png"
></a>
<p
class=
"headertext"
>
Gogs allow new registrations
</p>
<form
action=
"settings_gogs.php"
method=
"post"
>
<input
type=
"radio"
name=
"allowregistrations"
value=
"0"
checked
>
No
<input
type=
"radio"
name=
"allowregistrations"
value=
"1"
>
Yes
<br><br>
<input
type=
"submit"
name=
"submitallowregistrations"
value=
"Update"
/>
</form>
</div>
</div>
</body>
</html>
This diff is collapsed.
Click to expand it.
webadmin/settings_gogs.php
0 → 100755
+
18
−
0
View file @
fc6a3937
<?php
// Gogs settings menu
$output_filename
=
"app_gogs.html"
;
if
(
isset
(
$_POST
[
'submitallowregistrations'
]))
{
$confirm
=
htmlspecialchars
(
$_POST
[
'allowregistrations'
]);
$settings_file
=
fopen
(
".appsettings.txt"
,
"w"
)
or
die
(
"Unable to write to appsettings file"
);
fwrite
(
$settings_file
,
"gogs,registration,"
.
$confirm
);
fclose
(
$settings_file
);
}
$htmlfile
=
fopen
(
"
$output_filename
"
,
"r"
)
or
die
(
"Unable to open
$output_filename
"
);
echo
fread
(
$htmlfile
,
filesize
(
"
$output_filename
"
));
fclose
(
$htmlfile
);
?>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment