{"id":31,"date":"2016-06-19T11:41:22","date_gmt":"2016-06-19T11:41:22","guid":{"rendered":"https:\/\/blogs.scummvm.org\/tkachov\/?p=31"},"modified":"2022-05-24T11:43:54","modified_gmt":"2022-05-24T11:43:54","slug":"gsoc-the-webserver","status":"publish","type":"post","link":"https:\/\/blogs.scummvm.org\/tkachov\/2016\/06\/19\/gsoc-the-webserver\/","title":{"rendered":"GSoC: The Webserver"},"content":{"rendered":"<p>This week\u00a0I have upgraded the StorageWizardDialog. Instead of\u00a0one big text field for code, we\u00a0decided to\u00a0put eight small text fields. The scummvm.org page shows the code you should enter, and each code group correctness is\u00a0checked separately.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/blogs.scummvm.org\/tkachov\/wp-content\/uploads\/sites\/60\/2022\/05\/s_code.png\" \/><\/p>\n<p>ScummVM also automatically checks that the whole code is\u00a0correct, too. When you enter a\u00a0valid code, \u00abConnect\u00bb button becomes active and you can get your cloud storage working.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.scummvm.org\/tkachov\/wp-content\/uploads\/sites\/60\/2022\/05\/s_code2.png\" \/><\/p>\n<p>However, we\u00a0don\u2019t think that 40\u00a0symbols long code is\u00a0an\u00a0easy thing to\u00a0enter. We\u2019re working on\u00a0different ways to\u00a0simplify that task, and one of\u00a0them\u00a0\u2014 probably the ultimate one\u00a0\u2014 is\u00a0not to\u00a0enter that code at\u00a0all! To\u00a0achieve that, we\u2019re adding a\u00a0local webserver into ScummVM. For now, it\u00a0looks like this:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.scummvm.org\/tkachov\/wp-content\/uploads\/sites\/60\/2022\/05\/s_localhost.png\" \/><\/p>\n<p>When you open the StorageWizardDialog in\u00a0the ScummVM built with SDL_Net (i.e. with local webserver support), there are no\u00a0fields. Only a\u00a0short URL for you to\u00a0visit.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.scummvm.org\/tkachov\/wp-content\/uploads\/sites\/60\/2022\/05\/s_localhost2.png\" \/><\/p>\n<p>When you\u00a0do, you\u2019re redirected to\u00a0service page, where you can allow ScummVM to\u00a0use that service\u2019s API. When you press the \u00abAllow\u00bb button, you\u2019re automatically redirected to\u00a0ScummVM\u2019s local webserver\u2019s page\u00a0\u2014 and ScummVM automatically gets the code!<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.scummvm.org\/tkachov\/wp-content\/uploads\/sites\/60\/2022\/05\/s_localhost3.png\" \/><\/p>\n<p>I\u2019ve also done a\u00a0few updates of\u00a0cloud sync procedure, so\u00a0now it\u00a0automatically started when you connect to\u00a0a\u00a0storage, or\u00a0when you save the game or\u00a0when the autosave happen. The last time\u00a0I said that if\u00a0you decide to\u00a0cancel the sync, the currently downloading file would be\u00a0left damaged. Well, not anymore\u00a0\u2014 such files are automatically removed.<\/p>\n<p>Finally, we\u00a0came up\u00a0with the plan! \ud83d\ude00<\/p>\n<p>First, some of\u00a0my\u00a0GUI dialogs require more space than ScummVM can provide. So, we\u00a0decided that\u00a0I should implement a\u00a0\u00abcontainer box\u00bb widget\u00a0\u2014 an\u00a0area with scrollbars, which would be\u00a0providing more virtual space than we\u00a0really have.<\/p>\n<p>After I\u00a0do that, I\u2019d start working on\u00a0cloud files management: users would be\u00a0able to\u00a0upload and download their game data right through ScummVM\u00a0interface.<\/p>\n<p>Then we\u2019re going to\u00a0add a\u00a0\u00abWi-Fi sharing\u00bb feature. It\u00a0basically means that local webserver would be\u00a0also used to\u00a0access files on\u00a0the device through a\u00a0browser. No\u00a0more USB cables! You can copy files from your phone by\u00a0clicking a\u00a0link in\u00a0your browser or\u00a0upload files onto your phone with that.<\/p>\n<p>Then comes the next cloud storage support\u00a0\u2014 Box. I\u00a0know nothing about it\u00a0yet, but hopefully it\u00a0should be\u00a0similar to\u00a0those three\u00a0I already added.<\/p>\n<p>And in\u00a0the end, I\u2019d work on\u00a0those things that would make it\u00a0easier to\u00a0enter the code if\u00a0your ScummVM doesn\u2019t have the local webserver feature. Those are browser opening and clipboard support. So, ScummVM would be\u00a0able to\u00a0automatically open a\u00a0browser for you to\u00a0allow it\u00a0to\u00a0use storage\u2019s API and you\u2019d be\u00a0able to\u00a0copy the code and paste it\u00a0in\u00a0the ScummVM\u2019s text fields. These are interesting features, but as\u00a0far as\u00a0I\u00a0know, those are highly not portable. For example, there is\u00a0ShellExecute on\u00a0Windows and special Intent on\u00a0Android, but no\u00a0such thing in\u00a0Unix. And not all platforms even have the clipboard. From the other hand, there is\u00a0SDL_GetClipboardText()&#8230; in\u00a0SDL2.<\/p>\n<p>Anyway, I\u2019ve got one (and probably the most difficult) exam to\u00a0pass the next week. Yeah, an\u00a0exam and the midterm at\u00a0the same week. I\u00a0hope I\u2019ll be\u00a0able to\u00a0do\u00a0at\u00a0least that \u00abcontainer box\u00bb \ud83d\ude00<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This week\u00a0I have upgraded the StorageWizardDialog. Instead of\u00a0one big text field for code, we\u00a0decided to\u00a0put eight small text fields. The scummvm.org page shows the code you should enter, and each code group correctness is\u00a0checked separately. ScummVM also automatically checks that the whole code is\u00a0correct, too. When you enter a\u00a0valid code, \u00abConnect\u00bb button becomes active and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-31","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.scummvm.org\/tkachov\/wp-json\/wp\/v2\/posts\/31","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.scummvm.org\/tkachov\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.scummvm.org\/tkachov\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/tkachov\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/tkachov\/wp-json\/wp\/v2\/comments?post=31"}],"version-history":[{"count":1,"href":"https:\/\/blogs.scummvm.org\/tkachov\/wp-json\/wp\/v2\/posts\/31\/revisions"}],"predecessor-version":[{"id":37,"href":"https:\/\/blogs.scummvm.org\/tkachov\/wp-json\/wp\/v2\/posts\/31\/revisions\/37"}],"wp:attachment":[{"href":"https:\/\/blogs.scummvm.org\/tkachov\/wp-json\/wp\/v2\/media?parent=31"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/tkachov\/wp-json\/wp\/v2\/categories?post=31"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/tkachov\/wp-json\/wp\/v2\/tags?post=31"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}