diff --git a/bin/svgs.js b/bin/svgs.js index ed7b4db6..ea9a48a4 100644 --- a/bin/svgs.js +++ b/bin/svgs.js @@ -14,6 +14,7 @@ module.exports = [ {id: 'fa-eye', src: 'node_modules/font-awesome-svg-png/white/svg/eye.svg', title: 'Show Sensitive Content'}, {id: 'fa-eye-slash', src: 'node_modules/font-awesome-svg-png/white/svg/eye-slash.svg', title: 'Hide Sensitive Content'}, {id: 'fa-lock', src: 'node_modules/font-awesome-svg-png/white/svg/lock.svg', title: 'Locked'}, + {id: 'fa-unlock', src: 'node_modules/font-awesome-svg-png/white/svg/unlock.svg', title: 'Unlocked'}, {id: 'fa-envelope', src: 'node_modules/font-awesome-svg-png/white/svg/envelope.svg', title: 'Sealed Envelope'}, {id: 'fa-user-times', src: 'node_modules/font-awesome-svg-png/white/svg/user-times.svg', title: 'Stop Following'}, {id: 'fa-user-plus', src: 'node_modules/font-awesome-svg-png/white/svg/user-plus.svg', title: 'Follow'}, @@ -25,7 +26,8 @@ module.exports = [ {id: 'fa-bars', src: 'node_modules/font-awesome-svg-png/white/svg/bars.svg', title: 'List'}, {id: 'fa-volume-off', src: 'node_modules/font-awesome-svg-png/white/svg/volume-off.svg', title: 'Volume off'}, {id: 'fa-ban', src: 'node_modules/font-awesome-svg-png/white/svg/ban.svg', title: 'Ban'}, - {id: 'fa-camera', src: 'node_modules/font-awesome-svg-png/white/svg/camera.svg', title: 'Camera'}, - {id: 'fa-smile', src: 'node_modules/font-awesome-svg-png/white/svg/smile-o.svg', title: 'Smile'}, - {id: 'fa-exclamation-triangle', src: 'node_modules/font-awesome-svg-png/white/svg/exclamation-triangle.svg', title: 'Warning'} + {id: 'fa-camera', src: 'node_modules/font-awesome-svg-png/white/svg/camera.svg', title: 'Add media'}, + {id: 'fa-smile', src: 'node_modules/font-awesome-svg-png/white/svg/smile-o.svg', title: 'Custom emoji'}, + {id: 'fa-exclamation-triangle', src: 'node_modules/font-awesome-svg-png/white/svg/exclamation-triangle.svg', title: 'Content warning'}, + {id: 'fa-check', src: 'node_modules/font-awesome-svg-png/white/svg/check.svg', title: 'Check'} ] diff --git a/routes/_actions/instances.js b/routes/_actions/instances.js index f4e269db..ba3b59de 100644 --- a/routes/_actions/instances.js +++ b/routes/_actions/instances.js @@ -63,7 +63,7 @@ export async function logOutOfInstance (instanceName) { } function setStoreVerifyCredentials (instanceName, thisVerifyCredentials) { - let verifyCredentials = store.get('verifyCredentials') || {} + let verifyCredentials = store.get('verifyCredentials') verifyCredentials[instanceName] = thisVerifyCredentials store.set({verifyCredentials: verifyCredentials}) } diff --git a/routes/_components/compose/ComposeToolbar.html b/routes/_components/compose/ComposeToolbar.html index f6181354..f3ff1813 100644 --- a/routes/_components/compose/ComposeToolbar.html +++ b/routes/_components/compose/ComposeToolbar.html @@ -4,14 +4,22 @@ href="#fa-smile" on:click="onEmojiClick()" /> - + + - - $currentUploadedMedia[realm] || [] + uploadedMedia: ($currentUploadedMedia, realm) => $currentUploadedMedia[realm] || [], + postPrivacy: (postPrivacyKey) => { + return POST_PRIVACY_OPTIONS.find(_ => _.key === postPrivacyKey) + }, + postPrivacyKey: ($currentPostPrivacy, $currentVerifyCredentials, realm) => { + return $currentPostPrivacy[realm] || $currentVerifyCredentials.source.privacy + } } } \ No newline at end of file diff --git a/routes/_components/dialog/PostPrivacyDialog.html b/routes/_components/dialog/PostPrivacyDialog.html new file mode 100644 index 00000000..417ffd83 --- /dev/null +++ b/routes/_components/dialog/PostPrivacyDialog.html @@ -0,0 +1,98 @@ + +
    + {{#each postPrivacyOptions as option}} +
  • + +
  • + {{/each}} +
+
+ + \ No newline at end of file diff --git a/routes/_components/dialog/dialogs.js b/routes/_components/dialog/dialogs.js index 731fab36..09d7d93f 100644 --- a/routes/_components/dialog/dialogs.js +++ b/routes/_components/dialog/dialogs.js @@ -2,3 +2,4 @@ export * from './showConfirmationDialog' export * from './showImageDialog' export * from './showVideoDialog' export * from './showEmojiDialog' +export * from './showPostPrivacyDialog' diff --git a/routes/_components/dialog/showPostPrivacyDialog.js b/routes/_components/dialog/showPostPrivacyDialog.js new file mode 100644 index 00000000..0f4aea99 --- /dev/null +++ b/routes/_components/dialog/showPostPrivacyDialog.js @@ -0,0 +1,13 @@ +import PostPrivacyDialog from './PostPrivacyDialog.html' + +export function showPostPrivacyDialog (realm) { + let dialog = new PostPrivacyDialog({ + target: document.getElementById('modal-dialog'), + data: { + label: 'Post privacy dialog', + title: 'Post privacy', + realm: realm + } + }) + dialog.show() +} diff --git a/routes/_static/statuses.js b/routes/_static/statuses.js index 43a2fc49..749ff32b 100644 --- a/routes/_static/statuses.js +++ b/routes/_static/statuses.js @@ -1 +1,24 @@ export const CHAR_LIMIT = 500 + +export const POST_PRIVACY_OPTIONS = [ + { + label: 'Public', + key: 'public', + icon: '#fa-globe' + }, + { + label: 'Unlisted', + key: 'unlisted', + icon: '#fa-unlock' + }, + { + label: 'Followers-only', + key: 'private', + icon: '#fa-lock' + }, + { + label: 'Direct', + key: 'direct', + icon: '#fa-envelope' + } +] diff --git a/routes/_store/instanceComputations.js b/routes/_store/instanceComputations.js index 093f6cb6..1ae6095b 100644 --- a/routes/_store/instanceComputations.js +++ b/routes/_store/instanceComputations.js @@ -1,4 +1,21 @@ +function computeForInstance (store, computedKey, key, defaultValue) { + store.compute(computedKey, + [key, 'currentInstance'], + (instanceData, currentInstance) => (currentInstance && instanceData[currentInstance]) || defaultValue) +} + export function instanceComputations (store) { + computeForInstance(store, 'currentTheme', 'instanceThemes', 'default') + computeForInstance(store, 'currentVerifyCredentials', 'verifyCredentials', null) + computeForInstance(store, 'currentInstanceInfo', 'instanceInfos', null) + computeForInstance(store, 'pinnedPage', 'pinnedPages', '/local') + computeForInstance(store, 'lists', 'instanceLists', []) + computeForInstance(store, 'currentStatusModifications', 'statusModifications', null) + computeForInstance(store, 'currentComposeText', 'composeText', {}) + computeForInstance(store, 'currentUploadedMedia', 'uploadedMedia', {}) + computeForInstance(store, 'currentCustomEmoji', 'customEmoji', []) + computeForInstance(store, 'currentPostPrivacy', 'postPrivacy', {}) + store.compute( 'isUserLoggedIn', ['currentInstance', 'loggedInInstances'], @@ -33,37 +50,6 @@ export function instanceComputations (store) { (currentInstanceData) => currentInstanceData && currentInstanceData.access_token ) - store.compute( - 'currentTheme', - ['currentInstance', 'instanceThemes'], - (currentInstance, instanceThemes) => { - return instanceThemes[currentInstance] || 'default' - } - ) - - store.compute( - 'currentVerifyCredentials', - ['currentInstance', 'verifyCredentials'], - (currentInstance, verifyCredentials) => verifyCredentials && verifyCredentials[currentInstance] - ) - - store.compute( - 'currentInstanceInfo', - ['currentInstance', 'instanceInfos'], - (currentInstance, instanceInfos) => instanceInfos && instanceInfos[currentInstance] - ) - - store.compute( - 'pinnedPage', - ['pinnedPages', 'currentInstance'], - (pinnedPages, currentInstance) => (currentInstance && pinnedPages[currentInstance]) || '/local') - - store.compute( - 'lists', - ['instanceLists', 'currentInstance'], - (instanceLists, currentInstance) => (currentInstance && instanceLists[currentInstance]) || [] - ) - store.compute( 'pinnedListTitle', ['lists', 'pinnedPage'], @@ -91,29 +77,6 @@ export function instanceComputations (store) { store.compute('hasNotifications', ['numberOfNotifications'], - (numberOfNotifications) => { - return !!numberOfNotifications - } - ) - - store.compute('currentStatusModifications', - ['statusModifications', 'currentInstance'], - (statusModifications, currentInstance) => { - return statusModifications[currentInstance] - }) - - store.compute('currentComposeText', - ['composeText', 'currentInstance'], - (composeText, currentInstance) => (composeText[currentInstance] || {}) - ) - - store.compute('currentUploadedMedia', - ['uploadedMedia', 'currentInstance'], - (uploadedMedia, currentInstance) => (uploadedMedia[currentInstance] || {}) - ) - - store.compute('currentCustomEmoji', - ['customEmoji', 'currentInstance'], - (customEmoji, currentInstance) => (customEmoji[currentInstance] || []) + (numberOfNotifications) => !!numberOfNotifications ) } diff --git a/routes/_store/store.js b/routes/_store/store.js index 50d58b29..32147f7e 100644 --- a/routes/_store/store.js +++ b/routes/_store/store.js @@ -15,7 +15,8 @@ const KEYS_TO_STORE_IN_LOCAL_STORAGE = new Set([ 'markMediaAsSensitive', 'pinnedPages', 'composeText', - 'uploadedMedia' + 'uploadedMedia', + 'postPrivacy' ]) class PinaforeStore extends LocalStorageStore { @@ -43,7 +44,9 @@ export const store = new PinaforeStore({ composeText: {}, rawComposeText: '', customEmoji: {}, - uploadedMedia: {} + uploadedMedia: {}, + postPrivacy: {}, + verifyCredentials: {} }) mixins(PinaforeStore) diff --git a/templates/2xx.html b/templates/2xx.html index 16ee342e..cc194f3b 100644 --- a/templates/2xx.html +++ b/templates/2xx.html @@ -79,6 +79,7 @@ body.offline,body.theme-hotpants.offline,body.theme-majesty.offline,body.theme-o Show Sensitive Content Hide Sensitive Content Locked +Unlocked Sealed Envelope Stop Following Follow @@ -90,9 +91,10 @@ body.offline,body.theme-hotpants.offline,body.theme-majesty.offline,body.theme-o List Volume off Ban -Camera -Smile -Warning +Add media +Custom emoji +Content warning +Check