Coder Social home page Coder Social logo

Comments (14)

Skii7niX avatar Skii7niX commented on July 26, 2024 5

XD Glad I could help a bit. This gives me something to do.
@acidjazz Found it, it seems as if dan200 messed up in the code for the pastebin program and you need to change:
"http://pastebin.com/raw.php?i="..textutils.urlEncode( paste )
to:
"http://pastebin.com/raw/"..textutils.urlEncode( paste )

He fixed it is his newer version of ComputerCraft but SkyFactory 2.5 is using an older version. I tested it myself and it works. :) (Credit dan200/ComputerCraft#64)

Fixing the issue:
So basically to fix it yourself you can either paste this code below into a generic file at:
C:\Users\USER\Documents\Curse\Minecraft\Instances\FTB Presents SkyFactory 2.5\saves\WORLDNAME\computer\COMPUTERID
(COMPUTERID is the id that is created by the mod, it starts at 1 being the first computer made/used and going numerically from then on out. You can check the files to see if you are in the correct folder)
Code:

local function printUsage()
    print( "Usages:" )
    print( "pastebin put <filename>" )
    print( "pastebin get <code> <filename>" )
    print( "pastebin run <code> <arguments>" )
end
 
local tArgs = { ... }
if #tArgs < 2 then
    printUsage()
    return
end
 
if not http then
    printError( "Pastebin requires http API" )
    printError( "Set http_enable to true in ComputerCraft.cfg" )
    return
end
 
local function get(paste)
    write( "Connecting to pastebin.com... " )
    local response = http.get(
        "http://pastebin.com/raw/"..textutils.urlEncode( paste )
    )
        
    if response then
        print( "Success." )
        
        local sResponse = response.readAll()
        response.close()
        return sResponse
    else
        printError( "Failed." )
    end
end
 
local sCommand = tArgs[1]
if sCommand == "put" then
    -- Upload a file to pastebin.com
    -- Determine file to upload
    local sFile = tArgs[2]
    local sPath = shell.resolve( sFile )
    if not fs.exists( sPath ) or fs.isDir( sPath ) then
        print( "No such file" )
        return
    end
    
    -- Read in the file
    local sName = fs.getName( sPath )
    local file = fs.open( sPath, "r" )
    local sText = file.readAll()
    file.close()
    
    -- POST the contents to pastebin
    write( "Connecting to pastebin.com... " )
    local key = "0ec2eb25b6166c0c27a394ae118ad829"
    local response = http.post(
        "http://pastebin.com/api/api_post.php", 
        "api_option=paste&"..
        "api_dev_key="..key.."&"..
        "api_paste_format=lua&"..
        "api_paste_name="..textutils.urlEncode(sName).."&"..
        "api_paste_code="..textutils.urlEncode(sText)
    )
        
    if response then
        print( "Success." )
        
        local sResponse = response.readAll()
        response.close()
                
        local sCode = string.match( sResponse, "[^/]+$" )
        print( "Uploaded as "..sResponse )
        print( "Run \"pastebin get "..sCode.."\" to download anywhere" )
 
    else
        print( "Failed." )
    end
    
elseif sCommand == "get" then
    -- Download a file from pastebin.com
    if #tArgs < 3 then
        printUsage()
        return
    end
 
    -- Determine file to download
    local sCode = tArgs[2]
    local sFile = tArgs[3]
    local sPath = shell.resolve( sFile )
    if fs.exists( sPath ) then
        print( "File already exists" )
        return
    end
    
    -- GET the contents from pastebin
    local res = get(sCode)
    if res then        
        local file = fs.open( sPath, "w" )
        file.write( res )
        file.close()
        
        print( "Downloaded as "..sFile )
    end 
elseif sCommand == "run" then
    local sCode = tArgs[2]
 
    local res = get(sCode)
    if res then
        local func, err = load(res, sCode, "t", _ENV)
        if not func then
            printError( err )
            return
        end
        local success, msg = pcall(func, table.unpack(tArgs, 3))
        if not success then
            printError( msg )
        end
    end
else
    printUsage()
    return
end

Or put the fixed jar file included below in this folder (make sure to replace "USER" with your local computer username):
C:\Users\USER\Documents\Curse\Minecraft\Instances\FTB Presents SkyFactory 2.5\mods

Go to https://github.com/Skii7niX/ComputerCraftFix/blob/master/ComputerCraft1.75-Skii7niXEdit.jar and click download to get the file. (Edited and tested by me; I just went and changed the one line in the ComputerCraft rom/programs/http folder.)
@acidjazz There :D Sorry if I came off as pushy or self-included :(

from drmon.

acidjazz avatar acidjazz commented on July 26, 2024

This might be something to do with the server you are on and pastebin blacklisting its' IP address. Is the server you're on populated with a lot of players @NopusEngibus ? after a certain amount of pastebin GET's they'll black the IP and you just get some 404 bs HTML for the file.

from drmon.

Skii7niX avatar Skii7niX commented on July 26, 2024

I had this exact same issue and I am on SkyFactory 2.5 as well. I had to go to the pastebin in my web browser and manually type the code into the ComputerCraft computer in the install file.
EDIT: I am in a singleplayer world (server technically because whenever I load up the world for some reason SkyFactory thinks it is a server) and I don't believe I am blacklisted because I could access Pastebin on my web browser.

from drmon.

acidjazz avatar acidjazz commented on July 26, 2024

@NopusEngibus have you tried what @Skii7niX did? is the server you are on trying to do this with public? I don't mind hopping on and checking things out.

from drmon.

Skii7niX avatar Skii7niX commented on July 26, 2024

@acidjazz I could port forward it you would like to take a look at mine to try to find an answer

from drmon.

acidjazz avatar acidjazz commented on July 26, 2024

@Skii7niX @NopusEngibus upon the install script not working when you did the pastebin get:

  • was the file 'install' created and on the computer if you did a dir or ls?
  • did you look at the contents of the file? was there anything inside of it?

from drmon.

Skii7niX avatar Skii7niX commented on July 26, 2024

@acidjazz It did create the install file but nothing was in it, I will test again to make sure.

from drmon.

Skii7niX avatar Skii7niX commented on July 26, 2024

Ok, so I checked again, and it does create the install file, but there is absolutely nothing in it
Image1
Image2

from drmon.

Skii7niX avatar Skii7niX commented on July 26, 2024

I just tried using another paste from pastebin, and it didn't work. hmm, this doesn't seem to be a problem with your code, just something to do with the connection between me and pastebin :/
Hmm, this is weird, my config is fine and the files really are there, but nothing is in them
screenshot_2
screenshot_4

from drmon.

acidjazz avatar acidjazz commented on July 26, 2024

Appreciate your research @Skii7niX, I'm installing skyfactory 2.5 right now to see if it is maybe something in the pack.

from drmon.

acidjazz avatar acidjazz commented on July 26, 2024

thanks @Skii7niX , i think since there is nothing we can do on our end for this I'll close this issue, make a known issues section on the front page and reference your fix. thanks again

from drmon.

FabianAlbertRub avatar FabianAlbertRub commented on July 26, 2024

Since pastebin uses TLS, the program part must be changed to
"https://pastebin.com/raw/"..textutils.urlEncode( paste )
(https instead of http)

from drmon.

spannerman79 avatar spannerman79 commented on July 26, 2024

@Skii7niX you might want to make another build of the update ComputerCraft fix - see @FabianAlbertRub comment above

from drmon.

TristanHayes01 avatar TristanHayes01 commented on July 26, 2024

Here is an easy fix if you're playing on a server.
https://www.youtube.com/watch?v=MkloBnl-W8s&ab_channel=Krakaen

from drmon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.