~cadence/cloudtube

ref: ec34702d90a94d70c1d531fe7b6c57b5d1c30802 cloudtube/pug/settings.pug -rw-r--r-- 4.1 KiB
ec34702dCadence Ember Fix footer on chromium 8 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
extends includes/layout.pug

mixin fieldset(name)
  fieldset
    legend= name
    .fieldset-contents
      block

mixin input({id, label, description, type, placeholder, disabled, list})
  - disabled = disabled || false
  .field-row
    label.field-row__label(for=id)= label
    input(type=type id=id name=id value=settings[id] placeholder=placeholder disabled=disabled list=`${id}-list`).border-look.field-row__input
    if list
      datalist(id=`${id}-list`)
        each item in list
          option(value=item)
    if description
      .field-row__description!= description

mixin select({id, label, description, disabled, options})
  - disabled = disabled || false
  .field-row
    label.field-row__label(for=id)= label
    select(id=id name=id disabled=disabled).border-look.field-row__input
      each option in options
        option(value=option.value selected=(option.value == settings[id]))= option.text
    if description
      .field-row__description!= description

block head
  title Settings - CloudTube

block content
  main.settings-page
    form(method="post" action="/settings")
      +fieldset("Settings")

        +input({
          id: "instance",
          label: "Instance",
          description: 'CloudTube will fetch information from this <a href="https://invidious.io/">Invidious</a> or <a href="https://git.sr.ht/~cadence/NewLeaf">NewLeaf</a> instance.',
          type: "url",
          placeholder: constants.user_settings.instance.default,
          list: instances
        })

        +select({
          id: "local",
          label: "Fetch videos",
          description: "If remote, the instance above will be used.\nIf local, CloudTube will try to connect to an instance running on your own computer. This can bypass blocks, but requires you to run the instance software.",
          options: [
            {value: "0", text: "Remote instance"},
            {value: "1", text: "Locally"}
          ]
        })

        +select({
          id: "quality",
          label: "Preferred qualities",
          description: "All qualities are available on the watch page. This defines their sort order.",
          options: [
            {value: "0", text: "720p"},
            {value: "4", text: "360p"},
            {value: "1", text: "Best possible"},
            {value: "2", text: "Best <=1080p"},
            {value: "3", text: "Best <=30fps"}
          ]
        })

        +select({
          id: "save_history",
          label: "Watched videos history",
          description: "Watched videos will appear in a dimmer colour.\nTurning this off will delete your existing watch history.",
          options: [
            {value: "0", text: "Don't store"},
            {value: "1", text: "Store on server"}
          ]
        })

      .save-settings
        button.border-look Save

    if user.token
      details.data-management
        summary Sync data
        p Open this link elsewhere to import your current CloudTube session there.
        p.
          If you clear your cookies often, you can bookmark this link and open it
          to restore your data, or if you have multiple devices, you can send this
          link to them to import your session and automatically keep everything
          in sync.
        - let url = `/formapi/importsession/${user.token}`
        a(href=url)= url

      details.data-management.delete-details
        summary Delete data
        p Press this button to erase all your data from CloudTube.
        p.
          Just the current session will be removed. If you lost access to a
          previous session, you cannot touch it.
        p.
          You will lose your subscriptions, watch history, settings, and anything
          else you stored on the server. The server will keep no record that they
          ever existed.
        p Deletion is instant and #[em cannot be undone.]
        input(type="checkbox" id="delete-confirm")
        .delete-confirm-container
          label(for="delete-confirm").delete-confirm-label I understand the consequences
        form(method="post" action="/formapi/erase")
          input(type="hidden" name="token" value=user.token)
          button.border-look#delete-button Permanently erase my data