Merge branch 'dev' into classic-theme
Cette révision appartient à :
révision
31317c579a
9 fichiers modifiés avec 2 ajouts et 41 suppressions
|
@ -34,7 +34,6 @@ func ChangePublicSettingsHandler(c *gin.Context) {
|
|||
mascot := c.PostForm("mascot")
|
||||
mascotURL := c.PostForm("mascot_url")
|
||||
altColors := c.PostForm("altColors")
|
||||
hideAds := c.PostForm("hideAds")
|
||||
|
||||
messages := msg.GetMessages(c)
|
||||
|
||||
|
@ -62,7 +61,6 @@ func ChangePublicSettingsHandler(c *gin.Context) {
|
|||
user.Mascot = mascot
|
||||
user.MascotURL = mascotURL
|
||||
user.AltColors = altColors
|
||||
user.HideAds = hideAds
|
||||
user.UpdateRaw()
|
||||
}
|
||||
// Set cookie with http and not gin for expires (maxage not supported in <IE8)
|
||||
|
@ -71,7 +69,6 @@ func ChangePublicSettingsHandler(c *gin.Context) {
|
|||
http.SetCookie(c.Writer, &http.Cookie{Name: "mascot", Value: mascot, Domain: getDomainName(), Path: "/", Expires: timeHelper.FewDaysLater(365)})
|
||||
http.SetCookie(c.Writer, &http.Cookie{Name: "mascot_url", Value: mascotURL, Domain: getDomainName(), Path: "/", Expires: timeHelper.FewDaysLater(365)})
|
||||
http.SetCookie(c.Writer, &http.Cookie{Name: "altColors", Value: altColors, Domain: getDomainName(), Path: "/", Expires: timeHelper.FewDaysLater(365)})
|
||||
http.SetCookie(c.Writer, &http.Cookie{Name: "hideAds", Value: hideAds, Domain: getDomainName(), Path: "/", Expires: timeHelper.FewDaysLater(365)})
|
||||
|
||||
c.Redirect(http.StatusSeeOther, "/")
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ type User struct {
|
|||
Language string `gorm:"column:language"`
|
||||
Theme string `gorm:"column:theme"`
|
||||
AltColors string `gorm:"column:alt_colors"`
|
||||
HideAds string `gorm:"column:hide_ads"`
|
||||
Mascot string `gorm:"column:mascot"`
|
||||
MascotURL string `gorm:"column:mascot_url"`
|
||||
UserSettings string `gorm:"column:settings"`
|
||||
|
|
|
@ -87,7 +87,7 @@ parseAllDates()
|
|||
//called if no Commit cookie is set or if the website has a newer commit than the one in cookie
|
||||
function resetCookies() {
|
||||
var cookies = document.cookie.split(";")
|
||||
var excludedCookies = ["mascot", "theme", "theme2", "mascot_url", "lang", "csrf_token", "altColors", "hideAds", "EU_Cookie"]
|
||||
var excludedCookies = ["mascot", "theme", "theme2", "mascot_url", "lang", "csrf_token", "altColors", "EU_Cookie"]
|
||||
|
||||
//Remove all cookies but exclude those in the above array
|
||||
for (var i = 0; i < cookies.length; i++) {
|
||||
|
|
|
@ -81,13 +81,10 @@
|
|||
<div class="container pagination">
|
||||
{{ genNav(Navigation, URL, 15)|raw }}
|
||||
</div>
|
||||
{{ if !HideAds }}
|
||||
<center class="container" id="ad-container">
|
||||
{{ adId = Sukebei() ? 634159 : 634157 }}
|
||||
<iframe data-aa='{{adId}}' src='//ad.a-ads.com/{{adId}}?size=728x90' scrolling='no' allowtransparency='true'></iframe>
|
||||
<span class="box" id="ad-blocked">why du u block ads</span>
|
||||
</center>
|
||||
{{ end }}
|
||||
<footer id="footer">
|
||||
<div class="container footer center">
|
||||
<div class="footer-opt">
|
||||
|
|
|
@ -49,15 +49,6 @@
|
|||
<br/>
|
||||
</span>
|
||||
|
||||
<span class="form-group">
|
||||
<h3>{{ T("hide_ads") }}</h3>
|
||||
<p><a href="/faq#why_ads">{{ T("hide_ads_setting_explanation")|raw }}</a></p>
|
||||
<select id="hideAds-selector" name="hideAds" class="form-input">
|
||||
<option value="false">Disabled</option>
|
||||
<option value="true" {{if HideAds}}selected{{end}}>Enabled</option>
|
||||
</select>
|
||||
</span>
|
||||
|
||||
<p>{{ T("cookies")}}</p>
|
||||
<button type="submit" class="form-input btn">{{ T("save_changes")}}</button>
|
||||
</div>
|
||||
|
|
|
@ -54,7 +54,6 @@ func Commonvariables(c *gin.Context) jet.VarMap {
|
|||
variables.Set("T", publicSettings.GetTfuncFromRequest(c))
|
||||
variables.Set("Theme", publicSettings.GetThemeFromRequest(c))
|
||||
variables.Set("AltColors", publicSettings.GetAltColorsFromRequest(c))
|
||||
variables.Set("HideAds", publicSettings.GetAdsEnabledFromRequest(c))
|
||||
variables.Set("Mascot", publicSettings.GetMascotFromRequest(c))
|
||||
variables.Set("MascotURL", publicSettings.GetMascotURLFromRequest(c))
|
||||
variables.Set("User", user)
|
||||
|
|
|
@ -51,7 +51,7 @@ func walkDirTest(dir string, t *testing.T) {
|
|||
em := "cop@cat.fe"
|
||||
|
||||
fakeTag := &models.Tag{1, 1, "12345", "anidbid", 1, 0, true}
|
||||
fakeUser := &models.User{1, "test", "test", "test", 1, time.Now(), time.Now(), "test", time.Now(), "en", "test", "test", "test", "test", "test", "test", 0.0, []models.User{}, []models.User{}, "test", []models.Torrent{}, []models.Notification{}, 1, models.UserSettings{}, []models.Tag{*fakeTag}}
|
||||
fakeUser := &models.User{1, "test", "test", "test", 1, time.Now(), time.Now(), "test", time.Now(), "en", "test", "test", "test", "test", "test", 0.0, []models.User{}, []models.User{}, "test", []models.Torrent{}, []models.Notification{}, 1, models.UserSettings{}, []models.Tag{*fakeTag}}
|
||||
fakeComment := &models.Comment{1, 1, 1, "test", time.Now(), time.Now(), nil, &models.Torrent{}, fakeUser}
|
||||
fakeScrapeData := &models.Scrape{1, 0, 0, 10, time.Now()}
|
||||
fakeFile := &models.File{1, 1, "l12:somefile.mp4e", 3}
|
||||
|
@ -282,7 +282,6 @@ func mockupCommonvariables(t *testing.T) jet.VarMap {
|
|||
variables.Set("T", T)
|
||||
variables.Set("Theme", "test")
|
||||
variables.Set("AltColors", "test")
|
||||
variables.Set("HideAds", "test")
|
||||
variables.Set("Mascot", "test")
|
||||
variables.Set("MascotURL", "test")
|
||||
variables.Set("User", &models.User{})
|
||||
|
|
|
@ -1095,14 +1095,6 @@
|
|||
"id": "upload_as_anon",
|
||||
"translation": "Upload Anonymously"
|
||||
},
|
||||
{
|
||||
"id": "hide_ads",
|
||||
"translation": "Hide Ads"
|
||||
},
|
||||
{
|
||||
"id": "hide_ads_setting_explanation",
|
||||
"translation": "This setting will prevent ads from loading if enabled. Why does pantsu has ads?"
|
||||
},
|
||||
{
|
||||
"id": "cookies",
|
||||
"translation": "By clicking save, you consent to our use of cookies"
|
||||
|
|
|
@ -197,19 +197,6 @@ func GetAltColorsFromRequest(c *gin.Context) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// GetAltColorsFromRequest : Return whether user wants to Hide ads (false by default)
|
||||
func GetAdsEnabledFromRequest(c *gin.Context) bool {
|
||||
user, _ := getCurrentUser(c)
|
||||
if user.ID > 0 {
|
||||
return user.HideAds == "true"
|
||||
}
|
||||
cookie, err := c.Cookie("hideAds")
|
||||
if err == nil {
|
||||
return cookie == "true"
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// GetMascotFromRequest : Return whether user has enabled mascot or not
|
||||
func GetMascotFromRequest(c *gin.Context) string {
|
||||
user, _ := getCurrentUser(c)
|
||||
|
|
Référencer dans un nouveau ticket