1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-08-31 10:56:24 -07:00
gochan/templates/install.html

120 lines
No EOL
5 KiB
HTML

<form class="install-container" method="POST" action="/install/{{.nextPage}}">
{{- if eq "" .page -}}
<p>Welcome to the Gochan installer! This installer will help you configure Gochan, including setting the necessary directories and connecting to the SQL database, in preparation for running a fresh Gochan installation or migrating another imageboard database (if supported) to Gochan.</p>
<p class="text-bold">This does not install files like templates (yet), or provision the database. It only creates a configuration file for gochan to use.</p>
{{- else if eq .page "license" -}}
<p class="text-center">Gochan is licensed under the BSD 3-Clause License, shown below. By using Gochan, you agree to the terms of this license,</p>
<textarea class="center-margin-50">{{.license}}</textarea>
{{- else if eq .page "paths" -}}
<table>
<tr>
<th>Output gochan.json Path</th>
<td>{{with .cfgPaths -}}
<select name="configdir" required>
<option value="" disabled selected>Select a directory</option>
{{range . -}}
<option value="{{.}}">{{.}}</option>
{{- end}}
</select>
{{- else -}}
<input type="hidden" name="configdir" value="gochan.json" />
./gochan.json (current directory)
{{- end -}}</td>
</tr>
<tr>
<th>Templates Directory</th>
<td><input type="text" name="templatedir" class="path" value="{{.config.TemplateDir}}"/></td>
</tr>
<tr>
<th>Document Root</th>
<td><input type="text" name="documentroot" class="path" value="{{.config.DocumentRoot}}" required/></td>
</tr>
<tr>
<th>Log Directory</th>
<td><input type="text" name="logdir" class="path" required/></td>
</tr>
<tr>
<th>Web Root</th>
<td><input type="text" name="webroot" class="path" value="{{.config.WebRoot}}" required/></td>
</tr>
</table>
{{- else if eq .page "database" -}}
<table>
<tr>
<th>SQL Provider</th>
<td><select name="dbtype" required>
<option value="" disabled selected>Select a database</option>
<option value="mysql">MySQL/MariaDB</option>
<option value="postgres">PostgreSQL</option>
<option value="sqlite3">SQLite</option>
</select></td>
</tr>
<tr>
<th>Database Host</th>
<td><input type="text" name="dbhost" required/></td>
</tr>
<tr>
<th>Database Name</th>
<td><input type="text" name="dbname" required/></td>
</tr>
<tr>
<th>Database User</th>
<td><input type="text" name="dbuser" required/></td>
</tr>
<tr>
<th>Database Password</th>
<td><input type="password" name="dbpass"/></td>
</tr>
<tr>
<th>Database Prefix</th>
<td><input type="text" name="dbprefix"/></td>
</tr>
<tr>
<th>Database Request Timeout (seconds)</th>
<td><input type="number" name="timeoutseconds" value="{{.config.DBTimeoutSeconds}}" min="1" required/></td>
</tr>
<tr>
<th>Database Max Open Connections</th>
<td><input type="number" name="maxopenconns" value="{{.config.DBMaxOpenConnections}}" min="1" required/></td>
</tr>
<tr>
<th>Max Idle Database Connections</th>
<td><input type="number" name="maxidleconns" value="{{.config.DBMaxIdleConnections}}" min="1" required/></td>
</tr>
<tr>
<th>Max DB Connection Lifetime (minutes)</th>
<td><input type="number" name="connmaxlifetimemin" value="{{.config.DBConnMaxLifetimeMin}}" min="1" required/></td>
</tr>
</table>
{{- else if eq .page "dbtest" -}}
<p class="text-center">{{.testResult}}</p>
{{- else if eq .page "staff" -}}
{{- with .alreadyCreated -}}
<p class="text-center">Administrator account already created. Click Next to go to miscellaneous settings (flags and </p>
{{- else -}}
<p class="text-center">Enter a username and password for an administrator staff acount</p>
<input type="hidden" name="newstaff" value="yes" />
<table>
<tr><th>Username</th><td><input type="text" name="username"></td></tr>
<tr><th>Password</th><td><input type="password" name="password"></td></tr>
<tr><th>Confirm Password</th><td><input type="password" name="confirmpassword"></td></tr>
</table>
{{- end -}}
{{- else if eq .page "pre-save" -}}
<p>Initial configuration is complete. In the textbox below, you can see the JSON output that will be saved to {{.configPath}} on the server. After clicking Save, you can then edit it as needed. See config.md for more info</p>
<textarea class="center-margin-50" readonly>{{.configJSON}}</textarea>
{{- else if eq .page "save" -}}
<p class="text-center">Gochan has been configured and provisioned successfully, a board has been created, and the installer server has exited. Now you can run gochan, log into the staff account you created <a href="{{webPath `/manage`}}">here</a>, and create new boards as desired. Thank you for using Gochan!</p>
<p class="text-center">If you experience any bugs, you can report them <a href="https://github.com/gochan-org/gochan/issues">here</a>.</p>
{{- else -}}
<p class="text-center">Invalid page</p>
{{- end -}}
{{- if ne .nextPage "" -}}
<section class="buttons">
<input type="submit" value="{{.nextButton}}" />
{{- if .skipButton -}}
<input type="submit" name="skip" value="Skip" />
{{- end -}}
</section>
{{- end -}}
</form>