How do can I create web pages on the fly from an iOS app? - ios

Context/Background: I have an iOS app with a Firebase backend. Each user on the app has a couple of public stories or journals. I am working on the v2 of the app and one of the main features of v2 is to give users the ability to publish their stories as static webpages by a click of a button. The goal is to have a journal for a user with a username "johnhouse", for example, be available at www.the-app-domain.com/johnhouse.
Question: How do can I create web pages on the fly from an iOS app? Im not sure where to start. Which online services should I look at?
I thought of spinning up a server and hosting www.the-app-domain.com on it, getting the app to ssh into the server and creating a directory called "johnhouse" (from the example above) inside the website's root directory and then pasting an index.html file inside it, But this doesn't only sound like a bad idea, it also sounds complicated as hell If I were to generate the html files on the app, how would I get them to the server? how would I get them into the right location?

There are a great many ways you might implement this behavior but I'll suggest one.
Consider what this product might look like if the app had no knowledge of how these static pages were published. All the app needs to be able to do is allow users to set which of their stories are published or not and to inform those users of the url at which their published stories will be available.
There may be real advantages to removing the app from your page-creation process.
If you find that you need to make change to the formatting of your pages you can do so without requiring an app update and you can choose if you want to rebuild every page or just have changes apply to new pages. This might be important if you discover that your pages don't render well on some devices or are not indexed the way you would like by search engines.
If you need to change where your pages are hosted you can do so (and provide redirects from the old location) without needing everyone to update to a new app version.
If you need to add moderation or curation of the content you publish you can do so more easily than if clients (your app) have direct control of your site content. This may be important when someone starts publishing SEO spam links to your site, or registers the username admin or login, or publishes a story containing malicious javascript, or publishes content which gets you a copyright infringement notice.
You don't need to give clients direct access to your web server which could allow them to edit each other's content or overwrite your site with their own malicious content.
Since you're already using Firebase take a look at how you might run your own web server as another client of this backend. One which looks for "published" stories (however you identify those in your data model) and generates appropriate pages for them. Depending on the tools you elect to use these could be dynamically generated pages (client side js or a web app) or static pages build by some backend process periodically or whenever stories change and added to a web server. Without any idea what server side tools would be most appropriate for you it's hard to know what specifically to suggest here.

Related

Umbraco 7 back-office user access control

This issue may have a bearing on whether we use Umbraco for a given company or use something else.
The company has both an intranet and web site(s) running on an old bespoke system which is scheduled to be replaced.
Having tested Umbraco extensively and built mock-up sites, I am very impressed with its flexibility, and I strongly suspect it would work for the web estate.
However,the intranet is first to be replaced and, as per an earlier post, the issue is here that that are a number of document types that comprise the intranet, and any one of the employees (and there are thousands) can create, publish and edit their own documents, but can't edit documents created by other users.
Also, they will have logged in to Windows and don't wan't to log in to again to edit documents in the intanet CMS.
The questions are
Can users be automatically logged into Umbraco back-office by intergrating with Active Directory?
If so, can this handle thousands of such users?
Is there any way of preventing users from editing each others' documents (as far as I can see, if we allow users to create, update and publish, they can edit documents created by other users as long as the documents are under their starting node). I suppose we could make a staring node for each user and all their documents go under that - but then this would make the node structure massive, unmanageable, and, I suspect, slow.
Admins should be able to edit anything.
Reading the above back it looks very much to me that Umbraco just isn't suitable for an intranet (and to be fair, it's not promoted as such), but its user access system is it's big failing. and I think it might make it a non-starter....
about Active Directory I answered your question in your 2nd thread here: Umbraco - members creating back-end content.
Regarding your concerns about Tree structure and blocking content, you can restrict permissions for each user to allow or dissalow specific actions for specific node (with / without children nodes).
Of course, it depends from requirements and desired solution. If you want to have shared three, but block some actions for specific users - this is the way. If you don't want to allow other users to even see structure of trees managed by other users - it will be better to create different parent nodes for them and restrict access only to those one.
The same options are visible when you right click on node and choose "Permissions".

iOS content management system

I'm new to iOS programming and am starting my first project. I'm wondering how clients manage the content (blogs, videos, etc) on their apps after you deliver the final product. Is their a content management system I should be implementing or do the developers usually handle that?
A developer would build it from scratch. An alternative to starting from the ground up would be to use CloudKit or some other NoSQL based web service to manage the content. Couchdb, Firebase, etc...
A client might add content in several ways. One could create a simple web form that allows a client to edit the content (empty form to add, a table with a link to edit or delete). If the client has a developer account you could add their Apple ID as a role to the CloudKit database with specific security rights to edit that database. Similar activities would apply to other platforms.

iOS app that creates HTML5 content

I'm trying to do something a bit complicated and I'm not entirely sure how to go about it. Could you please give me some pointers on the tech I should use and how I should go about implementing this. Here's what I need to do:
Create an iOS app that allows the user to upload pictures from his camera roll and modify variables with sliders. (so far so good)
These variables and graphics are used to modify some htlm5 code (i.e. the graphics the user supplies are called by the hmtl code and the variables modify some set variables in the script) (Do I just edit the code as a string?)
The code is put together and uploaded to a server where it is accessible at a unique URL. The user can save multiple times and each time it creates a new URL. (Do I need an FTP here?)
Your question is too general, but as far as I can help, Yes you have to create and edit some html source texts, and append every object that user is adding to the page as some html codes, files, css, etc.
and for uploading, if you want the user to upload the site to his/her own ftp server or web hosting service, yes you need FTP connection to create with the server.
But if you want your user to upload the website to a space you're providing for the user, then you need some server part and maybe some APIs. then you may use FTP or even some APIs to create and update files on your server. It highly depends on the service you want to provide.

System Architecture : How to Use the same Banner ( like google banner ) in multiple different websites hosted in different domains or subdomains )

I have a new big project with ASP MVC 4 and I will need to build in the future a lots of tiny web application that contains:
A Banner ( like Google banner in black , for authentication, notifications , search …… etc. )
A body that must access the banner info and knows if the user is authenticated or not.
Let me explain, if we look at :
Google play (subdomain )
Google Map (subdomain )
Google Translate (subdomain )
Google Gmail (subdomain )
Youtube ( different domain )
We will notice that it’s exactly the same banner for all its subdomains and even different domain (youtube ), and they have just the content that changes, and if I’m already authenticated in google play I do not need to authenticate again in Gmail or YouTube .
I want to do the same thing with my websites :
here a link to explain in images: http://www.use.com/ba3e6c12424c7696be7f
My Questions or just need for confirmation:
1- It is possible to host a banner and websites in different domains and still not authenticate again in every websites? I ‘am thinking about YouTube domain and google domain which is possible. How can I get the same experience?
2 -I assume it’s very easy with subdomains without the need of OAuth 2 for authentication just the normal ASP MVC 4 simple membership will do the job, am ‘I right?
3- Assuming I choose ASP MVC 4 simple membership with subdomains , how can I organize my projects so I don’t have duplicated code for my banner in every project if i want the same experience as google banner ?
a) First idea is to build the banner, put it in an assembly and Render It with an HTML helper, is that a good option? )
b) Do I still have the same experience if I host every subdomain in a different server?
c) Can I choose to host the banner in subdomain1 and load It in a website in subdomain 2 with JavaScript? (do I still have the same experience)
4- Assuming I have to give every website in different domains (not subdomains), how can I manage the architecture? I just need some clues.
5- If I’m wrong on everything, can you guide me to have the exact same experience with complete different domains, or different subdomains with an elegant solution ?
Thank you in advance, and sorry for my bad English (third language).
You really have two separate questions here. First, how to include a bit of HTML in multiple projects. There's really a myriad of possibilities here. If all of your sites are in the same solution in Visual Studio, the easiest method is to simply pick one project to hold the partial view for the banner and then link to it in your other projects. You do this by right-clicking somewhere in your project in the Solution Explorer and choosing Add -> Existing Item..., find the file in the other solution, but instead of "Add" to confirm, click the arrow next to it, to expand the dropdown and choose "Add As Link".
Alternately, or if one or more of your sites is not in the same solution or is in another language altogether, then your best bet is probably just to save the snippet of HTML as a flat file, somewhere each site will have access to. Then, you just read in from this file and display it.
Your second question is more complicated: how to share authentication. If all of the sites are on the same domain (subdomains), then you can just simply set the cookie on the domain itself, and all subdomains will receive the cookie and have access to the authentication status. If you have sites on different domains, though, it gets exponentially more complex. You either have to implement something like OAuth, which is awkward if all the sites belong together (i.e. OAuth is only really used to authenticate with third-parties, no one really uses this to share auth between related but different domains.) Or, you basically create a server that provides authentication for the other sites.
It's a kind of complex setup, but you've seen it in action on places like Google-owned properties. When you go to login, it takes you to accounts.google.com, and then you're redirected to the originating site after logging in. Essentially, what's happening is that technically the only place you're "logged in" at is accounts.google.com. If one of the sites in the family needs authentication, it redirects you to accounts.google.com. At which point, if you have a auth cookie already, it's sent and accounts.google.com restores your authenticated session, it then redirects back to the original site, with some token that identifies that you are logged in. Going into all the details and how to actually set this up is far beyond the scope of what can reasonably be done here on StackOverflow, but this is a really good reference and starting point. Part 1 describes the theory. The next installment details how to set it up.

Integrating twitter,facebook and other services in one single site

I need to develop an application which should help me in getting all the status,messages from different servers like Twitter,facebook etc in my application and also when i post a message it should gets updated in all the services. I am using authlogic for authentication. Can anyone suggest me what gems/plug-ins i can use..
I need API help to get all the tweets/messages to be displayed in my application and also ways to post the messages to the corresponding services by posting it from my application. Can anyone help me from design point.
Walk through what you'd want to do in your head. Imagine the working site, imagine your webapp working before you start. So your user logs in (handled by authlogic) and sees a textbox called "What are you doing right now?". The user fills in a status message and clicks "post". The status message appears at the top of their previously posted messages.
Start with the easy part. Create a class that posts to two services. Use the twitter gem and rfacebook to post to two already defined services. In the future, you'll want to let the user associate services to their account and you would iterate through the associated services and post the message to each. Once you have this working, you can refactor or polish the UI a bit to round out this feature. I personally would do the "add a social media account to my profile" feature towards the end.
Harder is the reading of the data (strangely enough) because you're going to have to figure out how to store it. You could store nothing but I suspect you'd run into API limits just searching all the time (could design around this). I would keep a little cache of posts associated to the user's social media account. In this way, the data model would look like this:
A user has many social media accounts.
A social media account has many posts. (cache)
Of course, now you need to schedule the caching of the posts. This could be done manually, based on an event (like when they login) or time based. So when the update happens, you load up the posts for that social media account and the user will see the posts the next time they hit the page. For real-time push to the client's browser while they stare at the screen, use faye (non-trivial) and ajax to pull the new posts to the top of the social media stream view.
The time based one is tricky because you'd either have to have a cron job run or have rails handle it all with a gem like clockwork. But then you have to leave rails running. I've also solved this by having a class in /lib do all the work and a simple web call kicks off the update. But it wasn't in a multi-user use case. So that might not work. In any case, you'll want to have some nice reusable code for these problems since update requests can come from many different sources.
You'll also have to deal with the API limits. When pulling down content from twitter, you won't get everything. That will just have to be known by the user or you'll have to indicate a "break in time" somehow.
The UI should be pretty easy (functionally anyway), because you know which source the post/content is coming from. It'd be easy to throw a little icon next to the post to display which social media site it's coming from.
Anyway, good luck, sounds like a fun project.

Resources