mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
fixes #70: improve visibility of adult streams
This commit is contained in:
parent
2df7e1c2f8
commit
1f5f5ce104
5 changed files with 44 additions and 7 deletions
|
@ -15,7 +15,6 @@ export function setupSettings() {
|
|||
|
||||
// Local settings
|
||||
localCheckboxes.forEach(checkbox => {
|
||||
checkbox.checked = Boolean(store.get(checkbox.id));
|
||||
checkbox.addEventListener('change', () => {
|
||||
store.set(checkbox.id.replace('user_', ''), checkbox.checked);
|
||||
});
|
||||
|
|
25
lib/philomena_web/controllers/channel/nsfw_controller.ex
Normal file
25
lib/philomena_web/controllers/channel/nsfw_controller.ex
Normal file
|
@ -0,0 +1,25 @@
|
|||
defmodule PhilomenaWeb.Channel.NsfwController do
|
||||
use PhilomenaWeb, :controller
|
||||
|
||||
alias Plug.Conn
|
||||
|
||||
def create(conn, _params) do
|
||||
conn
|
||||
|> set_cookie("chan_nsfw", "true")
|
||||
|> put_flash(:info, "Successfully updated channel visibility.")
|
||||
|> redirect(to: Routes.channel_path(conn, :index))
|
||||
end
|
||||
|
||||
def delete(conn, _params) do
|
||||
conn
|
||||
|> set_cookie("chan_nsfw", "false")
|
||||
|> put_flash(:info, "Successfully updated channel visibility.")
|
||||
|> redirect(to: Routes.channel_path(conn, :index))
|
||||
end
|
||||
|
||||
# Duplicated from setting controller
|
||||
defp set_cookie(conn, cookie_name, value) do
|
||||
# JS wants access; max-age is set to 25 years from now
|
||||
Conn.put_resp_cookie(conn, cookie_name, value, max_age: 788_923_800, http_only: false)
|
||||
end
|
||||
end
|
|
@ -485,6 +485,10 @@ defmodule PhilomenaWeb.Router do
|
|||
resources "/history", Page.HistoryController, only: [:index]
|
||||
end
|
||||
|
||||
scope "/channels", Channel, as: :channel do
|
||||
resources "/nsfw", NsfwController, only: [:create, :delete], singleton: true
|
||||
end
|
||||
|
||||
resources "/dnp", DnpEntryController, only: [:index, :show]
|
||||
resources "/staff", StaffController, only: [:index]
|
||||
resources "/stats", StatController, only: [:index]
|
||||
|
|
|
@ -12,6 +12,15 @@ h1 Livestreams
|
|||
.block__header
|
||||
= pagination
|
||||
|
||||
= if @conn.cookies["chan_nsfw"] == "true" do
|
||||
a href=Routes.channel_nsfw_path(@conn, :delete) data-method="delete"
|
||||
i.fa.fa-eye-slash>
|
||||
' Hide NSFW streams
|
||||
- else
|
||||
a href=Routes.channel_nsfw_path(@conn, :create) data-method="create"
|
||||
i.fa.fa-eye>
|
||||
' Show NSFW streams
|
||||
|
||||
.block__content
|
||||
= for channel <- @channels do
|
||||
= render PhilomenaWeb.ChannelView, "_channel_box.html", channel: channel, conn: @conn, subscriptions: @subscriptions
|
||||
|
|
|
@ -104,28 +104,28 @@ h1 Content Settings
|
|||
.block.block--fixed.block--warning Settings on this tab are saved in the current browser. They are independent of your login.
|
||||
.field
|
||||
=> label f, :hidpi, "Serve HiDPI thumbnails"
|
||||
=> checkbox f, :hidpi, value: @conn.cookies["hidpi"]
|
||||
=> checkbox f, :hidpi, checked: @conn.cookies["hidpi"] == "true"
|
||||
.fieldlabel: i Use high quality thumbnails on displays with a high pixel density. Requires more data than regular thumbnails.
|
||||
.field
|
||||
=> label f, :serve_webm, "Serve WebM"
|
||||
=> checkbox f, :serve_webm, value: @conn.cookies["serve_webm"]
|
||||
=> checkbox f, :serve_webm, checked: @conn.cookies["serve_webm"] == "true"
|
||||
.fieldlabel: i Serve WebM/MP4 versions of GIF images when available. Good for lower-bandwidth connections, but the video versions may have missing start/end frames, and do not support transparency.
|
||||
.field
|
||||
=> label f, :webm, "Use video thumbnails"
|
||||
=> checkbox f, :webm, value: @conn.cookies["webm"]
|
||||
=> checkbox f, :webm, checked: @conn.cookies["webm"] == "true"
|
||||
.fieldlabel: i Use video thumbnails for WebM videos. Does not apply to GIF images.
|
||||
.field
|
||||
=> label f, :hide_uploader
|
||||
=> checkbox f, :hide_uploader, value: @conn.cookies["hide_uploader"]
|
||||
=> checkbox f, :hide_uploader, checked: @conn.cookies["hide_uploader"] == "true"
|
||||
.fieldlabel: i Hide the uploader and date posted information on image pages.
|
||||
.field
|
||||
=> label f, :chan_nsfw, "Show NSFW channels"
|
||||
=> checkbox f, :chan_nsfw, value: @conn.cookies["chan_nsfw"]
|
||||
=> checkbox f, :chan_nsfw, checked: @conn.cookies["chan_nsfw"] == "true"
|
||||
.fieldlabel: i Show streams marked as NSFW on the channels page.
|
||||
= if staff?(@conn.assigns.current_user) do
|
||||
.field
|
||||
=> label f, :hide_staff_tools
|
||||
=> checkbox f, :hide_staff_tools, value: @conn.cookies["hide_staff_tools"]
|
||||
=> checkbox f, :hide_staff_tools, checked: @conn.cookies["hide_staff_tools"] == "true"
|
||||
.fieldlabel: i Hide most of the staff tools (e.g. IPs, anon names) making your site appear as if you weren't staff, this is useful when browsing in public.
|
||||
|
||||
= if !@conn.assigns.current_user do
|
||||
|
|
Loading…
Reference in a new issue