mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
General cleanup and fixed PR comments
This commit is contained in:
parent
fdf2289f8e
commit
395d039d41
@ -116,7 +116,7 @@ func (h *SettingsHandler) DeleteCustomRule(w http.ResponseWriter, r *http.Reques
|
|||||||
user := r.Context().Value(models.UserKey).(*models.User)
|
user := r.Context().Value(models.UserKey).(*models.User)
|
||||||
ruleId, err := strconv.Atoi(r.PostFormValue("ruleid"))
|
ruleId, err := strconv.Atoi(r.PostFormValue("ruleid"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
respondAlert(w, "internal server error", "", "settings.tpl.html", http.StatusInternalServerError)
|
respondAlert(w, "internal server error", "", conf.SettingsTemplate, http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ func (h *SettingsHandler) PostCreateCustomRule(w http.ResponseWriter, r *http.Re
|
|||||||
};
|
};
|
||||||
|
|
||||||
if _, err := h.customRuleSrvc.Create(rule); err != nil {
|
if _, err := h.customRuleSrvc.Create(rule); err != nil {
|
||||||
respondAlert(w, "internal server error", "", "settings.tpl.html", http.StatusInternalServerError)
|
respondAlert(w, "internal server error", "", conf.SettingsTemplate, http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,24 +2,25 @@ package services
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jinzhu/gorm"
|
"github.com/jinzhu/gorm"
|
||||||
|
"github.com/muety/wakapi/config"
|
||||||
"github.com/muety/wakapi/models"
|
"github.com/muety/wakapi/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CustomRuleService struct {
|
type CustomRuleService struct {
|
||||||
Config *models.Config
|
Config *config.Config
|
||||||
Db *gorm.DB
|
Db *gorm.DB
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewCustomRuleService(db *gorm.DB) *CustomRuleService {
|
func NewCustomRuleService(db *gorm.DB) *CustomRuleService {
|
||||||
return &CustomRuleService{
|
return &CustomRuleService{
|
||||||
Config: models.GetConfig(),
|
Config: config.Get(),
|
||||||
Db: db,
|
Db: db,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (srv *CustomRuleService) GetCustomRuleById(CustomRuleId uint) (*models.CustomRule, error) {
|
func (srv *CustomRuleService) GetCustomRuleById(customRuleId uint) (*models.CustomRule, error) {
|
||||||
r := &models.CustomRule{}
|
r := &models.CustomRule{}
|
||||||
if err := srv.Db.Where(&models.CustomRule{ID: CustomRuleId}).First(r).Error; err != nil {
|
if err := srv.Db.Where(&models.CustomRule{ID: customRuleId}).First(r).Error; err != nil {
|
||||||
return r, err
|
return r, err
|
||||||
}
|
}
|
||||||
return r, nil
|
return r, nil
|
||||||
|
@ -304,3 +304,4 @@ window.addEventListener('load', function () {
|
|||||||
togglePlaceholders(getPresentDataMask())
|
togglePlaceholders(getPresentDataMask())
|
||||||
draw()
|
draw()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -32,7 +32,8 @@
|
|||||||
<label class="inline-block text-sm mb-1 text-gray-500" for="password_new">New Password</label>
|
<label class="inline-block text-sm mb-1 text-gray-500" for="password_new">New Password</label>
|
||||||
<input class="shadow appearance-none bg-gray-800 focus:bg-gray-700 text-gray-300 border-green-700 focus:border-gray-500 border rounded w-full py-1 px-3"
|
<input class="shadow appearance-none bg-gray-800 focus:bg-gray-700 text-gray-300 border-green-700 focus:border-gray-500 border rounded w-full py-1 px-3"
|
||||||
type="password" id="password_new"
|
type="password" id="password_new"
|
||||||
name="password_new" placeholder="Choose a password" minlength="6" required> </div>
|
name="password_new" placeholder="Choose a password" minlength="6" required>
|
||||||
|
</div>
|
||||||
<div class="mb-8">
|
<div class="mb-8">
|
||||||
<label class="inline-block text-sm mb-1 text-gray-500" for="password_repeat">And again ...</label>
|
<label class="inline-block text-sm mb-1 text-gray-500" for="password_repeat">And again ...</label>
|
||||||
<input class="shadow appearance-none bg-gray-800 focus:bg-gray-700 text-gray-300 border-green-700 focus:border-gray-500 border rounded w-full py-1 px-3"
|
<input class="shadow appearance-none bg-gray-800 focus:bg-gray-700 text-gray-300 border-green-700 focus:border-gray-500 border rounded w-full py-1 px-3"
|
||||||
@ -154,8 +155,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<
|
<p>You can also add <span class="text-xs bg-gray-900 rounded py-1 px-2 font-mono">/project:your-cool-project</span> to the URL to filter by project.</p>
|
||||||
zzp>You can also add <span class="text-xs bg-gray-900 rounded py-1 px-2 font-mono">/project:your-cool-project</span> to the URL to filter by project.</p>
|
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<p>You have the ability to create badges from your coding statistics using <a href="https://shields.io" target="_blank" class="border-b border-green-800" rel="noopener noreferrer">Shields.io</a>. To do so, you need to grant public, unauthorized access to the respective endpoint.</p>
|
<p>You have the ability to create badges from your coding statistics using <a href="https://shields.io" target="_blank" class="border-b border-green-800" rel="noopener noreferrer">Shields.io</a>. To do so, you need to grant public, unauthorized access to the respective endpoint.</p>
|
||||||
<div class="flex justify-around mt-4">
|
<div class="flex justify-around mt-4">
|
||||||
@ -189,3 +189,4 @@
|
|||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [ "$WAKAPI_DB_TYPE" != "sqlite3" ]; then
|
if [ "$WAKAPI_DB_TYPE" != "sqlite3" ]; then
|
||||||
echo "Waiting 3 Seconds for DB to start"
|
echo "Waiting 10 Seconds for DB to start"
|
||||||
sleep 3;
|
sleep 10;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Starting Application"
|
echo "Starting Application"
|
||||||
./wakapi
|
./wakapi
|
Loading…
x
Reference in New Issue
Block a user