Skip to content

Commit 2b5a067

Browse files
authored
Merge pull request #296 from AEtheve/add-nsfw-filter
Add NSFW filter in the settings
2 parents 8e76570 + ebc5b8f commit 2b5a067

File tree

2 files changed

+80
-4
lines changed

2 files changed

+80
-4
lines changed

electron_app/src/StableDiffusion.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export default {
2828
return {
2929
is_backend_loaded : false,
3030
is_input_avail : false,
31-
nsfw_filter: true,
3231
model_loading_msg : "",
3332
model_loading_title : "",
3433
loading_percentage : -1 ,
@@ -60,7 +59,7 @@ export default {
6059
6160
// check for nsfw content
6261
img.onload = () => {
63-
if (this.nsfw_filter == false) {
62+
if (this.$parent.app_state.app_data.settings.nsfw_filter == false) {
6463
if (img.attached_cbs) {
6564
if (img.attached_cbs.on_img)
6665
img.attached_cbs.on_img(impath);

electron_app/src/components/Settings.vue

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,21 @@
55
<h1>Settings</h1>
66
<br>
77
<h2>General Settings</h2>
8-
9-
<br><hr>
8+
<br>
9+
<div class="setting_box">
10+
<div class="settings_left">
11+
<h2>Block Adult Content</h2>
12+
<p>Prevents image generation considered NSFW</p>
13+
</div>
14+
<hr>
15+
<div style="float:right;margin-right: 9px;align-self: center;" >
16+
<label class="switch">
17+
<input type="checkbox" v-model="app_state.app_data.settings.nsfw_filter">
18+
<span class="toggle round"></span>
19+
</label>
20+
</div>
21+
</div>
22+
<hr>
1023
<div class="l_button button_colored" style="float:right" @click="add_model" >Add New Model</div>
1124
<h2>Custom Models</h2>
1225

@@ -91,4 +104,68 @@ export default {
91104
<style>
92105
</style>
93106
<style scoped>
107+
.switch {
108+
position: relative;
109+
display: inline-block;
110+
width: 60px;
111+
height: 30px;
112+
}
113+
114+
.switch input {
115+
opacity: 0;
116+
width: 0;
117+
height: 0;
118+
}
119+
120+
.toggle {
121+
position: absolute;
122+
cursor: pointer;
123+
top: 0;
124+
left: 0;
125+
right: 0;
126+
bottom: 0;
127+
background-color: #ccc;
128+
-webkit-transition: .4s;
129+
transition: .4s;
130+
}
131+
132+
.toggle:before {
133+
position: absolute;
134+
content: "";
135+
height: 22px;
136+
width: 23px;
137+
left: 5px;
138+
bottom: 4px;
139+
background-color: white;
140+
-webkit-transition: .4s;
141+
transition: .4s;
142+
}
143+
144+
input:checked + .toggle {
145+
background-color: #3E7BFA;
146+
}
147+
148+
149+
input:checked + .toggle:before {
150+
transform: translateX(27px);
151+
}
152+
153+
.toggle.round {
154+
border-radius: 34px;
155+
}
156+
157+
.toggle.round:before {
158+
border-radius: 50%;
159+
}
160+
161+
162+
.setting_box{
163+
display: flex;
164+
flex-direction: row;
165+
}
166+
167+
.settings_left{
168+
flex: 1 1 auto;
169+
}
170+
94171
</style>

0 commit comments

Comments
 (0)