sketchucation logo sketchucation
    • 登入
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🔌 Easy Offset | Offset selected faces in SketchUp in positive and negative offsets. Download

    Unzipping archive from Ruby (Mac and Windows)

    已排程 已置頂 已鎖定 已移動 Developers' Forum
    55 貼文 11 Posters 10.3k 瀏覽 11 Watching
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • fredo6F 離線
      fredo6
      最後由 編輯

      @thomthom said:

      You could maybe send a POST message with XMLHttpRequest with login information to SCF's login page. ...though I'm not sure if doing that via XMLHttpRequest will give you a persistent session...

      Would anybody know:

      1. either the inline syntax in the request (if this is supported), like
        http://forums.sketchucation.com/viewtopic.php?f=323&t=29230&hilit=plugin#p254673&user=Fredo6&pwd=mypwd

      2. or the post syntax for the SCF login page?

      Thanks

      Fredo

      1 條回覆 最後回覆 回覆 引用 0
      • Dan RathbunD 離線
        Dan Rathbun
        最後由 編輯

        What URL do you see if you hover over the SCF Login link.
        (I have autologin set in my SCF cookie so I never go thru the login.)

        I'm not here much anymore.

        1 條回覆 最後回覆 回覆 引用 0
        • jeff hammondJ 離線
          jeff hammond
          最後由 編輯

          @dan rathbun said:

          What URL do you see if you hover over the SCF Login link.
          (I have autologin set in my SCF cookie so I never go thru the login.)

          the log in page at scf is this url:

          http://forums.sketchucation.com/ucp.php?mode=login
          

          dotdotdot

          1 條回覆 最後回覆 回覆 引用 0
          • thomthomT 離線
            thomthom
            最後由 編輯

            It would not be part of the URL - as that would be a GET.

            The HTML source for the login:

            
            <form method="post" action="./ucp.php?mode=login" class="headerspace" style="border;dashed 2px #ca0016;margin;auto auto 10px auto;padding;0 10px 10px 10px;width;97%;">
            	<p style="font-weight;bold;margin;11px 0 0 0;float;right;padding;3px 5px;"><img src="http://sketchucation.com/forums/styles/prosilver/imageset/help.gif" height="22" width="23" alt="" style="margin-right;5px;" /><a href="http://www.sketchucation.com/scf-contact-page2/" style="font-size;1.1em;">Problems with registering / logging in?</a></p>
            	<h3><a href="./ucp.php?mode=login">Login</a>&nbsp; &bull; &nbsp;<a href="./ucp.php?mode=register">Register</a></h3>
            		<fieldset class="quick-login">
            			<label for="username">Username;</label>&nbsp;<input type="text" name="username" id="username" size="10" class="inputbox" title="Username" />  
            			<label for="password">Password;</label>&nbsp;<input type="password" name="password" id="password" size="10" class="inputbox" title="Password" />
            			
            				| <label for="autologin">Log me on automatically each visit <input type="checkbox" name="autologin" id="autologin" /></label>
            			
            			<input type="submit" name="login" value="Login" class="button2" />
            		</fieldset>
            	</form>
            
            

            The important stuff here is:
            <form method="post" action="./ucp.php?mode=login"

            <input type="text" name="username" id="username" size="10" class="inputbox" title="Username" />
            <input type="password" name="password" id="password" size="10" class="inputbox" title="Password" />
            <input type="submit" name="login" value="Login" class="button2" />

            This means the POST request must be made to http ://forums.sketchucation.com/ucp.php?mode=login
            and you need to set the arguments, "username", "password" and quite possible "login" (login as very often the website software checks the value of the submit button to detect if a form has been used - but that depends on the software)

            Thomas Thomassen — SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 條回覆 最後回覆 回覆 引用 0
            • Dan RathbunD 離線
              Dan Rathbun
              最後由 編輯

              The form fieldnames on the SCF login page are:
              username
              password

              But there is also a "sid" (security ID) involved. The Admins may not want spambots being able to auto login. Ask Coen.

              I'm not here much anymore.

              1 條回覆 最後回覆 回覆 引用 0
              • thomthomT 離線
                thomthom
                最後由 編輯

                @dan rathbun said:

                What URL do you see if you hover over the SCF Login link.
                (I have autologin set in my SCF cookie so I never go thru the login.)

                HTML forms' submit buttons doesn't display the target URL info. One has to look at the source code.

                Thomas Thomassen — SketchUp Monkey & Coding addict
                List of my plugins and link to the CookieWare fund

                1 條回覆 最後回覆 回覆 引用 0
                • Dan RathbunD 離線
                  Dan Rathbun
                  最後由 編輯

                  @thomthom said:

                  One has to look at the source code.

                  I know (and I did,) it was a hint. But you cut and pasted the code before I could.

                  I'm not here much anymore.

                  1 條回覆 最後回覆 回覆 引用 0
                  • tbdT 離線
                    tbd
                    最後由 編輯

                    Fredo6: what do you want to do with SCF download ? maybe we can create a backend that suits your needs better thank going through forum software

                    SketchUp Ruby Consultant | Podium 1.x developer
                    http://plugins.ro

                    1 條回覆 最後回覆 回覆 引用 0
                    • fredo6F 離線
                      fredo6
                      最後由 編輯

                      @unknownuser said:

                      Fredo6: what do you want to do with SCF download ? maybe we can create a backend that suits your needs better thank going through forum software

                      I am investiogating 2 things:

                      1) Scan the SCF page where a plugin is.
                      That's sorted out with WebDialog and this will allow to check the current version and date of the plugin. This of course requires some strict syntax convention, for instance in the title, so that it is easy and discriminant to parse the info.
                      At least, this will tell whether the plugin is up to date or not

                      2) Download the file (zip or rb) to the local disk in the right place.
                      I assume that with some syntax convention, it will be possible to locate the URL address of the file.
                      For this however, this requires that the user is logged in to SCF (as ThomThom judiciously noticed).
                      Then, if the file URL is obtained, I can:

                      • either invoke the download dialog box via WebDialog
                      • or find out another way to download it
                        Not sure there is an easy way

                      Fred

                      1 條回覆 最後回覆 回覆 引用 0
                      • fredo6F 離線
                        fredo6
                        最後由 編輯

                        I was WRONG about the Mac unzipping as folder.

                        But I found out that there is an embedded unzip command, which can be invoked via the Ruby system call system.
                        see main post for details

                        I have no clue if this is present on all Macs.

                        Fredo

                        PS: just taking the opportunity that I have a Mac at hand to make a few tests about this question of plugin installation, as I usually prefer to release scripts for both environments and users.

                        1 條回覆 最後回覆 回覆 引用 0
                        • jeff hammondJ 離線
                          jeff hammond
                          最後由 編輯

                          @unknownuser said:

                          I was WRONG about the Mac unzipping as folder.

                          But I found out that there is an embedded unzip command, which can be invoked via the Ruby system call system.
                          see main post for details

                          I have no clue if this is present on all Macs.

                          yeah, osx has it's own compressor/expander called Archive Utility.app (located at HD/System/Library/Core Services) which is on all macs (unless for some odd reason, someone decides to delete it).. osx also comes with ruby.

                          i'd assume that if you can get it working on one mac then it will work on all..

                          one thing that may cause problems is if the user has changed the default expander to something other than Archive Utility (say Stuffit Expander for instance).. i don't think it would matter but then again, i don't really know.

                          dotdotdot

                          1 條回覆 最後回覆 回覆 引用 0
                          • thomthomT 離線
                            thomthom
                            最後由 編輯

                            @unknownuser said:

                            Fredo6: what do you want to do with SCF download ? maybe we can create a backend that suits your needs better thank going through forum software

                            I wonder - is there many out there at the moment looking at some download/update management system? I've been sketching down ideas for something like this.
                            Maybe we could brainstorm something together instead of working in solitude on this?

                            Thomas Thomassen — SketchUp Monkey & Coding addict
                            List of my plugins and link to the CookieWare fund

                            1 條回覆 最後回覆 回覆 引用 0
                            • tbdT 離線
                              tbd
                              最後由 編輯

                              @thomthom said:

                              Maybe we could brainstorm something together instead of working in solitude on this?

                              sure. some public read/invite write access mindmap would be nice. do you know something that we can use for the brainstorm part ?

                              SketchUp Ruby Consultant | Podium 1.x developer
                              http://plugins.ro

                              1 條回覆 最後回覆 回覆 引用 0
                              • thomthomT 離線
                                thomthom
                                最後由 編輯

                                No - I've never used such tools. Would be good to find one.
                                All I have at the moment are some text document and yellow stickers-notes.

                                Thomas Thomassen — SketchUp Monkey & Coding addict
                                List of my plugins and link to the CookieWare fund

                                1 條回覆 最後回覆 回覆 引用 0
                                • Dan RathbunD 離線
                                  Dan Rathbun
                                  最後由 編輯

                                  What about anonymous FTP download ?

                                  Would the user need to manually specify the save path ?

                                  I'm not here much anymore.

                                  1 條回覆 最後回覆 回覆 引用 0
                                  • eneroth3E 離線
                                    eneroth3
                                    最後由 編輯

                                    What sort of license applies to unzip.exe? I cannot find it anywhere and I'd like to use it for my next plugin.

                                    My website: http://julia-christina-eneroth.se/

                                    1 條回覆 最後回覆 回覆 引用 0
                                    • D 離線
                                      driven
                                      最後由 編輯

                                      you can use rubyzip gem...
                                      dan did an autoloader outline a couple of posts back...
                                      [anchor= goto=http://sketchucation.com/forums/viewtopic.php?f=180&t=59990&start=30#p548017:3q0rxtjb]should be here[/anchor:3q0rxtjb]
                                      john

                                      learn from the mistakes of others, you may not live long enough to make them all yourself...

                                      1 條回覆 最後回覆 回覆 引用 0
                                      • tt_suT 離線
                                        tt_su
                                        最後由 編輯

                                        @eneroth3 said:

                                        What sort of license applies to unzip.exe? I cannot find it anywhere and I'd like to use it for my next plugin.

                                        Unless you need support for SketchUp older than SU2014 I'd go with the zip gem that john mentions.

                                        1 條回覆 最後回覆 回覆 引用 0
                                        • eneroth3E 離線
                                          eneroth3
                                          最後由 編輯

                                          Thanks! The gem rubyzip gem does exactly what I wanted 😄 .

                                          However I don't know what's the best practice to use a gem. Should I ask the user to install it or should I check if it exists when the plugin loads and otherwise install it? Should I in that case use statusbar texts to tell the user the gem is being installed and that it may take some time?

                                          My website: http://julia-christina-eneroth.se/

                                          1 條回覆 最後回覆 回覆 引用 0
                                          • D 離線
                                            driven
                                            最後由 編輯

                                            It only instals into Sketchup gems, so if they want your plugin they will need it...

                                            If it not already installed:
                                            I guess you could ask if they want the download or to use 'your' supplied copy, but you would need to keep 'yours' up to date as other plugins use it already...

                                            it's very fast to load, did you try?

                                            Definitely mention it in your documentation...

                                            john

                                            learn from the mistakes of others, you may not live long enough to make them all yourself...

                                            1 條回覆 最後回覆 回覆 引用 0
                                            • 1
                                            • 2
                                            • 3
                                            • 3 / 3
                                            • 第一個貼文
                                              最後的貼文
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement