diff --git a/src/App.vue b/src/App.vue index 7a6cc30..1eb7451 100644 --- a/src/App.vue +++ b/src/App.vue @@ -202,6 +202,9 @@ export default { audioDevices: [], audioDeviceID: null, + // Advanced: automatically share your webcam when the page loads. + autoshare: false, + // After we get a device selected, remember it (by name) so that we // might hopefully re-select it by default IF we are able to enumerate // devices before they go on camera the first time. @@ -484,6 +487,7 @@ export default { // Webcam preferences that the user can edit while live. "webcam.nsfw": function () { + this.webcam.wasServerNSFW = false; LocalStorage.set('videoExplicit', this.webcam.nsfw); if (this.webcam.active) { this.sendMe(); @@ -528,6 +532,9 @@ export default { "webcam.autoMuteWebcams": function () { LocalStorage.set('autoMuteWebcams', this.webcam.autoMuteWebcams); }, + "webcam.autoshare": function () { + LocalStorage.set('videoAutoShare', this.webcam.autoshare); + }, // Misc preference watches "prefs.joinMessages": function () { @@ -709,7 +716,7 @@ export default { if (!this.webcam.active) return 0; // unset all flags if not active now if (this.webcam.active) status |= this.VideoFlag.Active; if (this.webcam.muted) status |= this.VideoFlag.Muted; - if (this.webcam.nsfw) status |= this.VideoFlag.NSFW; + if (this.webcam.nsfw && this.config.permitNSFW) status |= this.VideoFlag.NSFW; if (this.webcam.mutual) status |= this.VideoFlag.MutualRequired; if (this.webcam.mutualOpen) status |= this.VideoFlag.MutualOpen; if (this.webcam.nonExplicit) status |= this.VideoFlag.NonExplicit; @@ -929,10 +936,13 @@ export default { if (settings.videoAutoMute === true) { this.webcam.autoMute = true; } + if (settings.videoAutoShare === true) { + this.webcam.autoshare = true; + } if (settings.videoVipOnly === true) { this.webcam.vipOnly = true; } - if (settings.videoExplicit === true) { + if (settings.videoExplicit === true && this.config.permitNSFW) { this.webcam.nsfw = true; } if (settings.videoNonExplicit === true) { @@ -1229,6 +1239,9 @@ export default { let theirNSFW = (msg.video & this.VideoFlag.NSFW) > 0; if (this.webcam.active && myNSFW != theirNSFW && theirNSFW) { this.webcam.nsfw = theirNSFW; + window.requestAnimationFrame(() => { + this.webcam.wasServerNSFW = true; + }); } // Note: Me events only come when we join the server or a moderator has @@ -1571,6 +1584,7 @@ export default { jwt: this.jwt, prefs: this.prefs, + onLoggedIn: this.onLoggedIn, onWho: this.onWho, onMe: this.onMe, onMessage: this.onMessage, @@ -1613,6 +1627,14 @@ export default { }, 1000); }); }, + onLoggedIn() { + // Called after the first 'me' is received from the chat server, e.g. once per login. + + // Do we auto-broadcast our camera? + if (this.webcam.autoshare) { + this.startVideo({ force: true }); + } + }, /** * WebRTC concerns. @@ -2132,8 +2154,8 @@ export default { this.getDevices(); } - // If we are running in PermitNSFW mode, show the user the modal. - if (this.config.permitNSFW && !force) { + // Show the broadcast settings modal the first time. + if (!force) { this.nsfwModalCast.visible = true; return; } @@ -2297,6 +2319,24 @@ export default { LocalStorage.set('preferredDeviceNames', this.webcam.preferredDeviceNames); }, + // The 'Explicit' button at the top of the page: toggle the user's NSFW setting but + // with some smarts in case the user was just marked NSFW by an admin. + topNavExplicitButtonClicked() { + if (this.webcam.wasServerNSFW) { + this.webcam.wasServerNSFW = false; + this.ChatClient( + `Notice: your webcam was already marked as "Explicit" recently by the chat server.

` + + `If you were recently notified that a chat moderator has marked your camera as 'explicit' (red) for you, then ` + + `you do not need to do anything: your camera is marked Explicit already. Please leave it as Explicit if you are ` + + `being sexual on camera.

` + + `If you really mean to remove the Explicit label (and turn your camera 'blue'), then click on the ` + + `Explicit button at the top of the page one more time to confirm.`, + ); + return; + } + this.webcam.nsfw = !this.webcam.nsfw; + }, + // Replace your video/audio streams for your watchers (on camera changes) updateWebRTCStreams() { console.log("Re-negotiating video and audio channels to your watchers."); @@ -4037,17 +4077,18 @@ export default {

- +

-
+
+ +

+ +

+ +
+ +

+ Note: be sure that your web browser has remembered your webcam and mic + permission! This option can automatically share your webcam when you log onto chat again + from this device. +

+
@@ -4283,23 +4340,35 @@ export default { -

- If your camera will be featuring "Explicit" or sexual - content, please - mark it as such by clicking on the " - Explicit" - button at the top of the page, or check the box below to start with it enabled. +

+

-
+
+

+ You can toggle this at any time by clicking on the ' Explicit' + button at the top of the page. +

+
+ +
+ +

+ Close, and don't automatically open, other peoples' cameras when they toggle + to become explicit. +

- +

@@ -4316,17 +4385,6 @@ export default {
-
- -

- Don't auto-open explicit cameras when they open mine; and automatically - close a camera I am watching if it toggles to become explicit. -

-
-