Skip to content

Add support for twitter cards (full image viewer only)#4260

Closed
manics wants to merge 5 commits intoome:metadatafrom
manics:twittercards
Closed

Add support for twitter cards (full image viewer only)#4260
manics wants to merge 5 commits intoome:metadatafrom
manics:twittercards

Conversation

@manics
Copy link
Copy Markdown
Member

@manics manics commented Oct 13, 2015

I've had this lurking around since January 2014. Given that we now have a public resource and Twitter no longer require manual approvals I thought it's time to resurrect it. See https://dev.twitter.com/cards/types/summary-large-image

The title and description fields are mandatory, I'm assuming there will always be a non-empty image name, description is set to the owner's name if empty.

At risk of stating the obvious this can only be tested with a public image on an external server. Open an image in the full image viewer, copy the url into a tweet.

@joshmoore
Copy link
Copy Markdown
Member

Does configuration need to be per server_list item?

@manics
Copy link
Copy Markdown
Member Author

manics commented Oct 14, 2015

Good point. I guess one option is

omero.web.twitter = {
    "<key>": {
        "enabled": true,
        "siteuser": "@openmicroscopy"
    }
}

with a key from omero.web.application_server.host- assuming its possible to obtain which host was selected.

Rename property as omero.web.sharing.twitter to provide a namespace for other sharing options.
@manics
Copy link
Copy Markdown
Member Author

manics commented Dec 15, 2015

The enabled key seemed redundant, so now it's just a dictionary of server-names to twitter-names, e.g. omero.web.sharing.twitter={"omero": "@openmicroscopy"}

@manics
Copy link
Copy Markdown
Member Author

manics commented Dec 15, 2015

Ideally this would be testable without deploying it live to the IDR.

@manics manics changed the title Add support for twitter cards Add support for twitter cards (full image viewer only) Dec 15, 2015
@manics
Copy link
Copy Markdown
Member Author

manics commented Dec 15, 2015

Also added opengraph (facebook) support

@joshmoore
Copy link
Copy Markdown
Member

Interesting (unrelated) travis failure:

package:
      [jar] error while reading original manifest in file: /home/travis/build/openmicroscopy/openmicroscopy/components/tools/OmeroJava/target/omero_client.jar due to error in opening zip file
BUILD FAILED
/home/travis/build/openmicroscopy/openmicroscopy/build.xml:179: The following error occurred while executing this line:
/home/travis/build/openmicroscopy/openmicroscopy/components/antlib/resources/global.xml:449: The following error occurred while executing this line:
/home/travis/build/openmicroscopy/openmicroscopy/components/tools/OmeroJava/build.xml:90: Problem reading /home/travis/build/openmicroscopy/openmicroscopy/components/tools/OmeroJava/target/omero_client.jar

Relaunched.

@manics
Copy link
Copy Markdown
Member Author

manics commented Dec 17, 2015

Example config

config set omero.web.server_list '[["demo.example.org",4064,"demotwitter"]]'
config set omero.web.sharing.twitter '{"demotwitter": "@openmicroscopy"}'
config set omero.web.sharing.opengraph '{"demotwitter": "Open Microscopy"}'

@manics
Copy link
Copy Markdown
Member Author

manics commented Dec 17, 2015

In theory the last line should set the name of the site shown in facebook, though it doesn't seem to.

@joshmoore
Copy link
Copy Markdown
Member

This is currently leading to:

Traceback (most recent call last):
  File "manage.py", line 38, in <module>
    import settings
  File "/home/omero/OMERO.server-5.1.4-232-1ff6fcd-ice35-b170/lib/python/omeroweb/settings.py", line 781, in <module>
    'DEPRECATED_SETTINGS_MAPPINGS')
  File "/home/omero/OMERO.server-5.1.4-232-1ff6fcd-ice35-b170/lib/python/omeroweb/settings.py", line 772, in process_custom_settings
    setattr(module, global_name, mapping(global_value))
  File "/opt/anaconda/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/opt/anaconda/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())

@manics
Copy link
Copy Markdown
Member Author

manics commented Jan 22, 2016

@joshmoore I think the last build you deployed was missing the last commit 7845fd6 which should've fixed that error.

@manics
Copy link
Copy Markdown
Member Author

manics commented Apr 26, 2016

--rebased-to #4613

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants